wok rev 25488

memtest: typos
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Nov 15 16:33:54 2022 +0000 (17 months ago)
parents ed5f25d05ff6
children e1d0a02a021e
files memtest/receipt memtest/stuff/pack memtest/stuff/unpack.S
line diff
     1.1 --- a/memtest/receipt	Tue Nov 15 16:20:54 2022 +0000
     1.2 +++ b/memtest/receipt	Tue Nov 15 16:33:54 2022 +0000
     1.3 @@ -30,26 +30,26 @@
     1.4  {
     1.5  	file=$1
     1.6  	shift
     1.7 -	for i in lzma lz4 lzsa1 ; do
     1.8 -		cp $stuff/*.S $stuff/packx .
     1.9 -		sed "s/VERSION/$VERSION/;s|lzma1=|&nice=${1:-64},|" -i packx
    1.10 +	for i in lzma lz4 lzsa1 lzsa2 ; do
    1.11 +		cp $stuff/*.S $stuff/pack .
    1.12 +		sed "s/VERSION/$VERSION/;s|lzma1=|&nice=${1:-64},|" -i pack
    1.13  		while [ -n "$2" ]; do
    1.14  			sed "s|^#define PROP_$2 .*|#define PROP_$2 $3|" -i unlzma.S
    1.15  			shift 2
    1.16  		done
    1.17 -		sed -i "s|uncompress|un$i|" unpackx.S
    1.18 +		sed -i "s|uncompress|un$i|" unpack.S
    1.19  		asm bootloader
    1.20 -		asm unpackx
    1.21 -		cp packx packx.bak
    1.22 -		./packx --build bootloader.bin unpackx.bin
    1.23 -		PACKER=$i ./packx $file $file.$i
    1.24 +		asm unpack
    1.25 +		cp pack pack.bak
    1.26 +		./pack --build bootloader.bin unpack.bin
    1.27 +		PACKER=$i ./pack $file $file.$i
    1.28  		if [ $(stat -c %s $file.$i) -ge $((0x101F0)) ]; then
    1.29  			rm $file.$i
    1.30 -			cp packx.bak packx
    1.31 -			sed -e "s|^#define FLAT16.*// lzma case|#define FLAT16 0 // $i|" -i unpackx.S
    1.32 -			asm unpackx
    1.33 -			./packx --build bootloader.bin unpackx.bin
    1.34 -			PACKER=$i ./packx $file $file.$i
    1.35 +			cp pack.bak pack
    1.36 +			sed -e "s|^#define FLAT16.*// lzma case|#define FLAT16 0 // $i|" -i unpack.S
    1.37 +			asm unpack
    1.38 +			./pack --build bootloader.bin unpack.bin
    1.39 +			PACKER=$i ./pack $file $file.$i
    1.40  		fi
    1.41  	done
    1.42  }
     2.1 --- a/memtest/stuff/pack	Tue Nov 15 16:20:54 2022 +0000
     2.2 +++ b/memtest/stuff/pack	Tue Nov 15 16:33:54 2022 +0000
     2.3 @@ -45,7 +45,12 @@
     2.4  
     2.5  compress()
     2.6  {
     2.7 -	xz -z -e --format=raw --lzma1=lc=$(bits LC),lp=$(bits LP),pb=$(bits PB) --stdout 
     2.8 +	case "$PACKER" in
     2.9 +	lz4) lz4 -l --best ;;
    2.10 +	lzsa1) cat > /tmp/in$$ ; lzsa -f1 /tmp/in$$ /tmp/out$$ ; cat /tmp/out$$ ; rm -f /tmp/in$$ /tmp/out$$ ;;
    2.11 +	lzsa2) cat > /tmp/in$$ ; lzsa -f2 /tmp/in$$ /tmp/out$$ ; cat /tmp/out$$ ; rm -f /tmp/in$$ /tmp/out$$ ;;
    2.12 +	*) xz -z -e --format=raw --lzma1=lc=$(bits LC),lp=$(bits LP),pb=$(bits PB) --stdout 
    2.13 +	esac
    2.14  }
    2.15  
    2.16  main()
     3.1 --- a/memtest/stuff/unpack.S	Tue Nov 15 16:20:54 2022 +0000
     3.2 +++ b/memtest/stuff/unpack.S	Tue Nov 15 16:33:54 2022 +0000
     3.3 @@ -7,7 +7,7 @@
     3.4  #define UPDATE_SYSSIZE		1
     3.5  #define HARDCODED_SYSSIZE	1
     3.6  #define HARDCODED_SETUPSIZE	1
     3.7 -#define FLAT16			1
     3.8 +#define FLAT16			1	// lzma case
     3.9  //#define FLAT16OUT		0
    3.10  #define SAVEREGS		0 
    3.11  #define ELKS			0
    3.12 @@ -52,7 +52,7 @@
    3.13  	pushw	%ds
    3.14  	cld
    3.15  #else
    3.16 -	pushw	%cs
    3.17 +	pushw	%cs		// return adress is %cs:0
    3.18  # if FLAT16
    3.19  	xorw	%di, %di
    3.20  	pushw	%di
    3.21 @@ -64,96 +64,89 @@
    3.22  	movw	$0x100, %ax
    3.23  	pushw	%ax
    3.24  #else
    3.25 -#if UPDATE_SYSSIZE
    3.26 +# if UPDATE_SYSSIZE
    3.27  	pushw	%ds			// <A>
    3.28 -#else
    3.29 +# else
    3.30  	pushw	%cs			// <A>
    3.31 -#endif
    3.32 +# endif
    3.33  #endif
    3.34  #if FLAT16
    3.35  # 1- move 9020..9020+stp -> TOPSEG
    3.36 -#if ELKS
    3.37 +# if ELKS
    3.38  	movb	$TOPSEG/256, %ah
    3.39  	movw	%ax, %es
    3.40 -#else
    3.41 +# else
    3.42  	pushw	$TOPSEG
    3.43 -	popw	%es
    3.44 -#endif
    3.45 -	movw	$0x200, %si
    3.46 -#if SAVEREGS == 0
    3.47 +	popw	%es			// %es:%di = TOPSEG:0
    3.48 +# endif
    3.49 +	movw	$0x200, %si		// %ds:%si = 9000:0200
    3.50 +# if SAVEREGS == 0
    3.51  	pushw	%es
    3.52 -#if ELKS
    3.53 -	movw	$cont, %ax
    3.54 -	pushw	%ax
    3.55 -#else
    3.56 -	// pushw	$cont
    3.57 -	.byte	0x6A, cont
    3.58 -#endif
    3.59 -	jmp	jumpinto
    3.60 -#else
    3.61 -# if HARDCODED_SETUPSIZE
    3.62 +	call	jumpinto		// move setup & jmp %es:cont
    3.63 +# else
    3.64 +#  if HARDCODED_SETUPSIZE
    3.65  setup_word:
    3.66  	movw	$SETUP*256, %cx
    3.67 -# else
    3.68 +#  else
    3.69  	xorw	%cx, %cx
    3.70  	movb	SETUPSIZE, %ch
    3.71  	movw	%cx, %dx
    3.72 -# endif
    3.73 +#  endif
    3.74  	pushw	%cx			// <B>
    3.75  	pushw	%es
    3.76  	pushw	%di
    3.77  	rep
    3.78  	  movsw
    3.79  	lret
    3.80 -#endif
    3.81 +# endif
    3.82  cont:
    3.83  # 2- move 1000..1000+sys -> TOPSEG+stp
    3.84 -#if ELKS
    3.85 +# if ELKS
    3.86  	movw	$0x1000, %ax
    3.87  	movw	%ax, %ds
    3.88 -#else
    3.89 +# else
    3.90  	pushw	$0x1000
    3.91  	popw	%ds
    3.92 -#endif
    3.93 -	xorw	%si, %si
    3.94 -	subw	%di, %cx
    3.95 +# endif
    3.96 +	xorw	%si, %si		// %ds:%si = 1000:0
    3.97 +	subw	%di, %cx		// %cx = 64K - setupsz
    3.98  	rep
    3.99  	  movsb
   3.100  # 3- unlz(TOPSEG+stp:end, 1000-stp:0)
   3.101  	pushw	%es		// <C>
   3.102  # if HARDCODED_SETUPSIZE
   3.103  setup_seg:
   3.104 -#if ELKS
   3.105 -#  if UPDATE_SYSSIZE
   3.106 +#  if ELKS
   3.107 +#   if UPDATE_SYSSIZE
   3.108  	movw	$0x1000-(SETUP*32)-32, %ax
   3.109 +#   else
   3.110 +	movw	$0x1000-(SETUP*32), %ax
   3.111 +#   endif
   3.112 +	movw	%ax, %es
   3.113  #  else
   3.114 -	movw	$0x1000-(SETUP*32), %ax
   3.115 +#   if UPDATE_SYSSIZE
   3.116 +	pushw	$0x1000-(SETUP*32)-32
   3.117 +#   else
   3.118 +	pushw	$0x1000-(SETUP*32)
   3.119 +#   endif
   3.120 +	popw	%es
   3.121  #  endif
   3.122 -	movw	%ax, %es
   3.123 -#else
   3.124 -#  if UPDATE_SYSSIZE
   3.125 -	pushw	$0x1000-(SETUP*32)-32
   3.126 -#  else
   3.127 -	pushw	$0x1000-(SETUP*32)
   3.128 -#  endif
   3.129 -	popw	%es
   3.130 -#endif
   3.131  # else
   3.132  #  if UPDATE_SYSSIZE
   3.133  	incb	%dh
   3.134  #  endif
   3.135 -#if ELKS
   3.136 +#   if ELKS
   3.137  	shrw	$1, %dx
   3.138  	shrw	$1, %dx
   3.139  	shrw	$1, %dx
   3.140 -#else
   3.141 +#   else
   3.142  	shrw	$3, %dx
   3.143 -#endif
   3.144 +#   endif
   3.145  	movw	%ds, %ax
   3.146  	subw	%dx, %ax
   3.147  	movw	%ax, %es
   3.148 -# endif
   3.149 -#else		// FLAT16
   3.150 +#  endif
   3.151 +# else		// FLAT16
   3.152  # 1- move 1000..1000+sys -> 9000-sys
   3.153  # if HARDCODED_SYSSIZE
   3.154  packed_syssize:
   3.155 @@ -185,27 +178,29 @@
   3.156  # else
   3.157  	movb	%ss:SETUPSIZE, %ch
   3.158  	movw	%cx, %ax
   3.159 -#if ELKS
   3.160 +#  if ELKS
   3.161  	shrw	$1, %ax
   3.162  	shrw	$1, %ax
   3.163  	shrw	$1, %ax
   3.164 -#else
   3.165 +#  else
   3.166  	shrw	$3, %ax
   3.167 -#endif
   3.168 +#  endif
   3.169  	subw	%ax, %dx
   3.170  # endif
   3.171 +# if SAVEREGS != 0
   3.172  	pushw	%cx			// <B>
   3.173 +# endif
   3.174  	movw	%dx, %es
   3.175 -	xorw	%si, %si
   3.176 -	xorw	%di, %di
   3.177 +	xorw	%si, %si		// %cs:%si = 9020:0
   3.178 +	xorw	%di, %di		// %es:%di = 9000-sys-stp:0
   3.179  	rep
   3.180  	  movsw	%cs:(%si),%es:(%di)
   3.181 -	pushw	%es
   3.182 +	pushw	%es			// <C>
   3.183  # 3- reloc itself in 0x7C00
   3.184  	pushw	$0x07C0
   3.185  	popw	%es
   3.186 -	movw	$cont, %si
   3.187 -	movw	%si, %di
   3.188 +	movw	$cont, %si		// %cs:%si = 9020:cont
   3.189 +	movw	%si, %di		// %es:%di = 7C0:cont
   3.190  	movw	$end-_start, %cx
   3.191  	pushw	%es
   3.192  	pushw	%di
   3.193 @@ -233,9 +228,9 @@
   3.194  # endif
   3.195  #endif		// FLAT16
   3.196  	popw	%ds			// <C>
   3.197 -	movw	$end-_start, %si
   3.198 +	movw	$end-_start, %si	// %ds:%si = TOPSSEG:compressed / 9000-sys-stp:compressed
   3.199  #if UPDATE_SYSSIZE
   3.200 -	movw	$SYSSIZE, %di
   3.201 +	movw	$SYSSIZE, %di		// %es:%di = 1000-setup-bootsector:SYSSIZE
   3.202  #else
   3.203  	xorw	%di, %di
   3.204  #endif
   3.205 @@ -243,7 +238,7 @@
   3.206  	pushw	%es
   3.207  	call	unpack
   3.208  	popw	%ds
   3.209 -	popw	%si
   3.210 +	popw	%si			// %ds:%si = 1000-setup-bootsector:SYSSIZE
   3.211  	movw	%si, %di
   3.212  #   if SAVEREGS != 0
   3.213  	popw	%cx			// <B>
   3.214 @@ -253,7 +248,7 @@
   3.215  	popw	%es			// <A>
   3.216  # 5- move 1000-stp..1000 -> 9020
   3.217  #   else
   3.218 -	popw	%es			// <A>
   3.219 +	popw	%es			// <A>  %es:%di = 9000:SYSSIZE (the last 12 bytes are missing)
   3.220  jumpinto:
   3.221  # if HARDCODED_SETUPSIZE
   3.222  setup_word:
   3.223 @@ -279,6 +274,6 @@
   3.224  #if ELKS
   3.225  #define ONLY8086	1
   3.226  #endif
   3.227 -#include "unlzma.S"
   3.228 +#include "uncompress.S"
   3.229  
   3.230  end: