wok rev 19942

memtest: shrink unpack.S
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat May 06 08:25:09 2017 +0200 (2017-05-06)
parents 9e463ebef079
children dcabf9550aaf
files memtest/stuff/unpack.S
line diff
     1.1 --- a/memtest/stuff/unpack.S	Thu May 04 12:47:15 2017 +0200
     1.2 +++ b/memtest/stuff/unpack.S	Sat May 06 08:25:09 2017 +0200
     1.3 @@ -11,7 +11,6 @@
     1.4  #define FLAT16			1
     1.5  //#define FLAT16OUT		0
     1.6  #define SAVEREGS		0 
     1.7 -#define VM2RM			1
     1.8  
     1.9  	.text
    1.10  	.code16
    1.11 @@ -41,19 +40,32 @@
    1.12  	pushw	$0
    1.13  	pushal
    1.14  	pushw	%ds
    1.15 +	cld
    1.16  #else
    1.17  	pushw	%cs
    1.18 +# if FLAT16
    1.19 +	xorw	%di, %di
    1.20 +	pushw	%di
    1.21 +# else
    1.22  	pushw	$0
    1.23 +# endif
    1.24  #endif
    1.25  #if UPDATE_SYSSIZE
    1.26 -	pushw	%ds
    1.27 +	pushw	%ds			// <A>
    1.28  #else
    1.29 -	pushw	%es
    1.30 -	pushw	%cs
    1.31 +	pushw	%cs			// <A>
    1.32  #endif
    1.33 -	cld
    1.34  #if FLAT16
    1.35  # 1- move 9020..9020+stp -> 8000
    1.36 +	pushw	$0x8000
    1.37 +	popw	%es
    1.38 +	movw	$0x200, %si
    1.39 +#if SAVEREGS == 0
    1.40 +	pushw	%es
    1.41 +	// pushw	$cont
    1.42 +	.byte	0x6A, cont
    1.43 +	jmp	jumpinto
    1.44 +#else
    1.45  # if HARDCODED_SETUPSIZE
    1.46  setup_word:
    1.47  	movw	$SETUP*256, %cx
    1.48 @@ -62,17 +74,13 @@
    1.49  	movb	SETUPSIZE, %ch
    1.50  	movw	%cx, %dx
    1.51  # endif
    1.52 -	pushw	%cx
    1.53 -	pushw	$0x8000
    1.54 -	popw	%es
    1.55 -	xorw	%si, %si
    1.56 -	xorw	%di, %di
    1.57 +	pushw	%cx			// <B>
    1.58 +	pushw	%es
    1.59 +	pushw	%di
    1.60  	rep
    1.61 -	  movsw	%cs:(%si),%es:(%di)
    1.62 -	pushw	%es
    1.63 -	// pushw	$cont
    1.64 -	.byte	0x6A, cont
    1.65 +	  movsw
    1.66  	lret
    1.67 +#endif
    1.68  cont:
    1.69  # 2- move 1000..1000+sys -> 8000+stp
    1.70  	pushw	$0x1000
    1.71 @@ -82,7 +90,7 @@
    1.72  	rep
    1.73  	  movsb
    1.74  # 3- unlz(8000+stp:end, 1000-stp:0)
    1.75 -	pushw	%es
    1.76 +	pushw	%es		// <C>
    1.77  # if HARDCODED_SETUPSIZE
    1.78  setup_seg:
    1.79  #  if UPDATE_SYSSIZE
    1.80 @@ -100,7 +108,7 @@
    1.81  	subw	%dx, %ax
    1.82  	movw	%ax, %es
    1.83  # endif
    1.84 -#else
    1.85 +#else		// FLAT16
    1.86  # 1- move 1000..1000+sys -> 9000-sys
    1.87  # if HARDCODED_SYSSIZE
    1.88  packed_syssize:
    1.89 @@ -135,7 +143,7 @@
    1.90  	shrw	$3, %ax
    1.91  	subw	%ax, %dx
    1.92  # endif
    1.93 -	pushw	%cx
    1.94 +	pushw	%cx			// <B>
    1.95  	movw	%dx, %es
    1.96  	xorw	%si, %si
    1.97  	xorw	%di, %di
    1.98 @@ -145,14 +153,13 @@
    1.99  # 3- reloc itself in 0x7C00
   1.100  	pushw	$0x07C0
   1.101  	popw	%es
   1.102 -	xorw	%si, %si
   1.103 -	xorw	%di, %di
   1.104 +	movw	$cont, %si
   1.105 +	movw	%si, %di
   1.106  	movw	$end-_start, %cx
   1.107 +	pushw	%es
   1.108 +	pushw	%di
   1.109  	rep
   1.110  	  movsb	%cs:(%si),%es:(%di)
   1.111 -	pushw	%es
   1.112 -	// pushw	$cont
   1.113 -	.byte	0x6A, cont
   1.114  	lret
   1.115  cont:
   1.116  # 4- unlz(9000-sys-stp:end, 1000-stp:0)
   1.117 @@ -173,8 +180,8 @@
   1.118  #  endif
   1.119  	movw	%ax, %es
   1.120  # endif
   1.121 -#endif
   1.122 -	popw	%ds
   1.123 +#endif		// FLAT16
   1.124 +	popw	%ds			// <C>
   1.125  	movw	$end-_start, %si
   1.126  #if UPDATE_SYSSIZE
   1.127  	movw	$SYSSIZE, %di
   1.128 @@ -187,17 +194,27 @@
   1.129  	popw	%ds
   1.130  	popw	%si
   1.131  	movw	%si, %di
   1.132 -	popw	%cx
   1.133 +#   if SAVEREGS != 0
   1.134 +	popw	%cx			// <B>
   1.135  #if UPDATE_SYSSIZE
   1.136  // not need with memtest	movb	$(512-SYSSIZE)/2, %cl
   1.137  #endif
   1.138 -	popw	%es
   1.139 +	popw	%es			// <A>
   1.140  # 5- move 1000-stp..1000 -> 9020
   1.141 +#   else
   1.142 +	popw	%es			// <A>
   1.143 +jumpinto:
   1.144 +# if HARDCODED_SETUPSIZE
   1.145 +setup_word:
   1.146 +	movw	$SETUP*256, %cx
   1.147 +# else
   1.148 +	xorw	%cx, %cx
   1.149 +	movb	%ss:SETUPSIZE, %ch
   1.150 +	movw	%cx, %dx
   1.151 +# endif
   1.152 +#  endif
   1.153  	rep
   1.154  	  movsw
   1.155 -#if UPDATE_SYSSIZE == 0
   1.156 -	popw	%es
   1.157 -#endif
   1.158  #if SAVEREGS
   1.159  	popw	%ds
   1.160  	popal