wok rev 13289

memtest: optionnal linux header (disabled)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Aug 26 11:33:29 2012 +0200 (2012-08-26)
parents 1d5a6d3ed1f5
children 288cb68b9302
files memtest/stuff/pack memtest/stuff/unlzma.S memtest/stuff/unpack.S
line diff
     1.1 --- a/memtest/stuff/pack	Sun Aug 26 00:28:25 2012 +0200
     1.2 +++ b/memtest/stuff/pack	Sun Aug 26 11:33:29 2012 +0200
     1.3 @@ -1,9 +1,12 @@
     1.4  #!/bin/sh
     1.5  if [ "$1" == "--build" ]; then
     1.6 +	bin=${2:-unpack.bin}
     1.7  	cat >> $0 <<EOM
     1.8 -$(gzip -9 < ${2:-unpack.bin} | uuencode -m -)
     1.9 +$(gzip -9 < $bin | uuencode -m -)
    1.10  EOT
    1.11  EOM
    1.12 +	getip=0x$(grep getip ${bin/.bin/.lst} | sed '$!d;s/.*t:\([^ ]*\).*/\1/')
    1.13 +	sed -i "s/XXX/$((515+$getip))/" $0
    1.14  	sed -i '/--build/,/^fi/d' $0
    1.15  	exit
    1.16  fi
    1.17 @@ -26,12 +29,12 @@
    1.18  {
    1.19  	dd if=$1 bs=512 count=1 >$2
    1.20  	uudecode | gunzip >>$2
    1.21 -	setup="$( echo $(od -j 497 -N 1 -dAn $1))"
    1.22 +	setup="$(echo $(od -j 497 -N 1 -dAn $1))"
    1.23  	syssize="$(echo $(od -j 500 -N 2 -dAn $1))"
    1.24  	dd if=$1 bs=512 count=$setup skip=1 | compress >>$2
    1.25  	dd if=$1 bs=16 count=$syssize skip=$((32*(1+$setup))) | compress >>$2
    1.26  	size=$(stat -c %s $2)
    1.27 -	store $((($size-512)/16)) $2 520 2
    1.28 +	store $((($size-512)/16)) $2 XXX 2
    1.29  	store $((($size-2560)/16)) $2 500 2
    1.30  	store 4 $2 497 1
    1.31  }
     2.1 --- a/memtest/stuff/unlzma.S	Sun Aug 26 00:28:25 2012 +0200
     2.2 +++ b/memtest/stuff/unlzma.S	Sun Aug 26 11:33:29 2012 +0200
     2.3 @@ -447,7 +447,6 @@
     2.4  	cmp	$4+1, AX
     2.5  	jb	lzd21
     2.6  	mov	$3+1, AX
     2.7 -	//??movb	$3+1, %al
     2.8  
     2.9  lzd21:
    2.10  
    2.11 @@ -514,7 +513,7 @@
    2.12  
    2.13  //             } while (--numDirectBits != 0);
    2.14  
    2.15 -	cmp	$4+1, CX
    2.16 +	cmpb	$4+1, %cl
    2.17  	loopne	lzd23z
    2.18  
    2.19  //             prob = p + Align /* 802 */; numDirectBits = kNumAlignBits /*4*/;
    2.20 @@ -726,7 +725,7 @@
    2.21  
    2.22  	call  RC_NORMALIZE		// kill %ax, update %si
    2.23  
    2.24 -	pushal		// FIXME pushaw?
    2.25 +	pushal
    2.26  
    2.27  	xchg	AX, DI
    2.28  	add	DI, DI			// short *
    2.29 @@ -779,7 +778,7 @@
    2.30  	sarw	$5, %ax
    2.31  	addw	%ax, (BP, DI)
    2.32  	popf
    2.33 -	popal		// FIXME popaw?
    2.34 +	popal
    2.35  	sbb	AX, AX
    2.36  
    2.37  // 	}
     3.1 --- a/memtest/stuff/unpack.S	Sun Aug 26 00:28:25 2012 +0200
     3.2 +++ b/memtest/stuff/unpack.S	Sun Aug 26 11:33:29 2012 +0200
     3.3 @@ -3,6 +3,7 @@
     3.4  #define SETUP		4
     3.5  
     3.6  #define CHANGE_STACK	1
     3.7 +#define LINUX_HEADER	0
     3.8  
     3.9  	.text
    3.10  	.code16
    3.11 @@ -10,6 +11,22 @@
    3.12  
    3.13  	.globl	_start
    3.14  _start:
    3.15 +#if LINUX_HEADER
    3.16 +	jmp	start2
    3.17 +	.ascii	"HdrS"		// 202 magic
    3.18 +	.word	0x200		// 206 version 2.00
    3.19 +	.long	0		// 208 realmode_swtch
    3.20 +	.word	SYSTEM/16	// 20C start_sys_seg
    3.21 +	.word	0		// 20E kernel_version
    3.22 +	.byte	0		// 210 type_of_loader
    3.23 +	.byte	0		// 211 loadflags
    3.24 +	.word	0		// 212 setup_move_size
    3.25 +	.long	SYSTEM		// 214 code32_start
    3.26 +	.long	0		// 218 ramdisk_image
    3.27 +	.long	0		// 21C ramdisk_size
    3.28 +	.long	0		// 220 bootsect_kludge
    3.29 +start2:
    3.30 +#endif
    3.31  	pushf
    3.32  	pushw	%cs
    3.33  	call	getip