wok-current diff memtest/stuff/unpack.S @ rev 25488
memtest: typos
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Nov 15 16:33:54 2022 +0000 (24 months ago) |
parents | 17a7f1c3ddc6 |
children | 2ccf00d9c1cd |
line diff
1.1 --- a/memtest/stuff/unpack.S Thu Feb 01 15:51:03 2018 +0100 1.2 +++ b/memtest/stuff/unpack.S Tue Nov 15 16:33:54 2022 +0000 1.3 @@ -7,7 +7,7 @@ 1.4 #define UPDATE_SYSSIZE 1 1.5 #define HARDCODED_SYSSIZE 1 1.6 #define HARDCODED_SETUPSIZE 1 1.7 -#define FLAT16 1 1.8 +#define FLAT16 1 // lzma case 1.9 //#define FLAT16OUT 0 1.10 #define SAVEREGS 0 1.11 #define ELKS 0 1.12 @@ -52,7 +52,7 @@ 1.13 pushw %ds 1.14 cld 1.15 #else 1.16 - pushw %cs 1.17 + pushw %cs // return adress is %cs:0 1.18 # if FLAT16 1.19 xorw %di, %di 1.20 pushw %di 1.21 @@ -64,96 +64,89 @@ 1.22 movw $0x100, %ax 1.23 pushw %ax 1.24 #else 1.25 -#if UPDATE_SYSSIZE 1.26 +# if UPDATE_SYSSIZE 1.27 pushw %ds // <A> 1.28 -#else 1.29 +# else 1.30 pushw %cs // <A> 1.31 -#endif 1.32 +# endif 1.33 #endif 1.34 #if FLAT16 1.35 # 1- move 9020..9020+stp -> TOPSEG 1.36 -#if ELKS 1.37 +# if ELKS 1.38 movb $TOPSEG/256, %ah 1.39 movw %ax, %es 1.40 -#else 1.41 +# else 1.42 pushw $TOPSEG 1.43 - popw %es 1.44 -#endif 1.45 - movw $0x200, %si 1.46 -#if SAVEREGS == 0 1.47 + popw %es // %es:%di = TOPSEG:0 1.48 +# endif 1.49 + movw $0x200, %si // %ds:%si = 9000:0200 1.50 +# if SAVEREGS == 0 1.51 pushw %es 1.52 -#if ELKS 1.53 - movw $cont, %ax 1.54 - pushw %ax 1.55 -#else 1.56 - // pushw $cont 1.57 - .byte 0x6A, cont 1.58 -#endif 1.59 - jmp jumpinto 1.60 -#else 1.61 -# if HARDCODED_SETUPSIZE 1.62 + call jumpinto // move setup & jmp %es:cont 1.63 +# else 1.64 +# if HARDCODED_SETUPSIZE 1.65 setup_word: 1.66 movw $SETUP*256, %cx 1.67 -# else 1.68 +# else 1.69 xorw %cx, %cx 1.70 movb SETUPSIZE, %ch 1.71 movw %cx, %dx 1.72 -# endif 1.73 +# endif 1.74 pushw %cx // <B> 1.75 pushw %es 1.76 pushw %di 1.77 rep 1.78 movsw 1.79 lret 1.80 -#endif 1.81 +# endif 1.82 cont: 1.83 # 2- move 1000..1000+sys -> TOPSEG+stp 1.84 -#if ELKS 1.85 +# if ELKS 1.86 movw $0x1000, %ax 1.87 movw %ax, %ds 1.88 -#else 1.89 +# else 1.90 pushw $0x1000 1.91 popw %ds 1.92 -#endif 1.93 - xorw %si, %si 1.94 - subw %di, %cx 1.95 +# endif 1.96 + xorw %si, %si // %ds:%si = 1000:0 1.97 + subw %di, %cx // %cx = 64K - setupsz 1.98 rep 1.99 movsb 1.100 # 3- unlz(TOPSEG+stp:end, 1000-stp:0) 1.101 pushw %es // <C> 1.102 # if HARDCODED_SETUPSIZE 1.103 setup_seg: 1.104 -#if ELKS 1.105 -# if UPDATE_SYSSIZE 1.106 +# if ELKS 1.107 +# if UPDATE_SYSSIZE 1.108 movw $0x1000-(SETUP*32)-32, %ax 1.109 +# else 1.110 + movw $0x1000-(SETUP*32), %ax 1.111 +# endif 1.112 + movw %ax, %es 1.113 # else 1.114 - movw $0x1000-(SETUP*32), %ax 1.115 +# if UPDATE_SYSSIZE 1.116 + pushw $0x1000-(SETUP*32)-32 1.117 +# else 1.118 + pushw $0x1000-(SETUP*32) 1.119 +# endif 1.120 + popw %es 1.121 # endif 1.122 - movw %ax, %es 1.123 -#else 1.124 -# if UPDATE_SYSSIZE 1.125 - pushw $0x1000-(SETUP*32)-32 1.126 -# else 1.127 - pushw $0x1000-(SETUP*32) 1.128 -# endif 1.129 - popw %es 1.130 -#endif 1.131 # else 1.132 # if UPDATE_SYSSIZE 1.133 incb %dh 1.134 # endif 1.135 -#if ELKS 1.136 +# if ELKS 1.137 shrw $1, %dx 1.138 shrw $1, %dx 1.139 shrw $1, %dx 1.140 -#else 1.141 +# else 1.142 shrw $3, %dx 1.143 -#endif 1.144 +# endif 1.145 movw %ds, %ax 1.146 subw %dx, %ax 1.147 movw %ax, %es 1.148 -# endif 1.149 -#else // FLAT16 1.150 +# endif 1.151 +# else // FLAT16 1.152 # 1- move 1000..1000+sys -> 9000-sys 1.153 # if HARDCODED_SYSSIZE 1.154 packed_syssize: 1.155 @@ -185,27 +178,29 @@ 1.156 # else 1.157 movb %ss:SETUPSIZE, %ch 1.158 movw %cx, %ax 1.159 -#if ELKS 1.160 +# if ELKS 1.161 shrw $1, %ax 1.162 shrw $1, %ax 1.163 shrw $1, %ax 1.164 -#else 1.165 +# else 1.166 shrw $3, %ax 1.167 -#endif 1.168 +# endif 1.169 subw %ax, %dx 1.170 # endif 1.171 +# if SAVEREGS != 0 1.172 pushw %cx // <B> 1.173 +# endif 1.174 movw %dx, %es 1.175 - xorw %si, %si 1.176 - xorw %di, %di 1.177 + xorw %si, %si // %cs:%si = 9020:0 1.178 + xorw %di, %di // %es:%di = 9000-sys-stp:0 1.179 rep 1.180 movsw %cs:(%si),%es:(%di) 1.181 - pushw %es 1.182 + pushw %es // <C> 1.183 # 3- reloc itself in 0x7C00 1.184 pushw $0x07C0 1.185 popw %es 1.186 - movw $cont, %si 1.187 - movw %si, %di 1.188 + movw $cont, %si // %cs:%si = 9020:cont 1.189 + movw %si, %di // %es:%di = 7C0:cont 1.190 movw $end-_start, %cx 1.191 pushw %es 1.192 pushw %di 1.193 @@ -233,9 +228,9 @@ 1.194 # endif 1.195 #endif // FLAT16 1.196 popw %ds // <C> 1.197 - movw $end-_start, %si 1.198 + movw $end-_start, %si // %ds:%si = TOPSSEG:compressed / 9000-sys-stp:compressed 1.199 #if UPDATE_SYSSIZE 1.200 - movw $SYSSIZE, %di 1.201 + movw $SYSSIZE, %di // %es:%di = 1000-setup-bootsector:SYSSIZE 1.202 #else 1.203 xorw %di, %di 1.204 #endif 1.205 @@ -243,7 +238,7 @@ 1.206 pushw %es 1.207 call unpack 1.208 popw %ds 1.209 - popw %si 1.210 + popw %si // %ds:%si = 1000-setup-bootsector:SYSSIZE 1.211 movw %si, %di 1.212 # if SAVEREGS != 0 1.213 popw %cx // <B> 1.214 @@ -253,7 +248,7 @@ 1.215 popw %es // <A> 1.216 # 5- move 1000-stp..1000 -> 9020 1.217 # else 1.218 - popw %es // <A> 1.219 + popw %es // <A> %es:%di = 9000:SYSSIZE (the last 12 bytes are missing) 1.220 jumpinto: 1.221 # if HARDCODED_SETUPSIZE 1.222 setup_word: 1.223 @@ -279,6 +274,6 @@ 1.224 #if ELKS 1.225 #define ONLY8086 1 1.226 #endif 1.227 -#include "unlzma.S" 1.228 +#include "uncompress.S" 1.229 1.230 end: