wok annotate memtest/stuff/unpack.S @ rev 23090

updated libnl, libnl-dev and libnl-tools (3.4.0 -> 3.5.0)
author Hans-G?nter Theisgen
date Wed Mar 11 14:00:21 2020 +0100 (2020-03-11)
parents 1421f93cc28a
children 608a017317a8
rev   line source
pascal@13288 1 #define SYSTEM 0x10000
pascal@19404 2 #define SETUP 14
pascal@15188 3 #define SYSSIZE 0x1F4
pascal@15188 4 #define SETUPSIZE 0x1F1
pascal@13288 5
pascal@15188 6 #define LINUX_HEADER 0
pascal@15188 7 #define UPDATE_SYSSIZE 1
pascal@15188 8 #define HARDCODED_SYSSIZE 1
pascal@15188 9 #define HARDCODED_SETUPSIZE 1
pascal@19391 10 #define FLAT16 1
pascal@19391 11 //#define FLAT16OUT 0
pascal@19404 12 #define SAVEREGS 0
pascal@20187 13 #define ELKS 0
pascal@13269 14
pascal@13269 15 .text
pascal@13269 16 .code16
pascal@13269 17 .org 0
pascal@13269 18
pascal@20184 19 #if ELKS
pascal@20184 20 .arch i8086
pascal@20184 21 #define FLAT16 1
pascal@20184 22 #define LINUX_HEADER 0
pascal@20184 23 #define SAVEREGS 0
pascal@20184 24 #define TOPSEG 0x2000
pascal@20184 25 #else
pascal@20184 26 #define TOPSEG 0x8000
pascal@20184 27 #endif
pascal@20184 28
pascal@13269 29 .globl _start
pascal@13269 30 _start:
pascal@13289 31 #if LINUX_HEADER
pascal@13289 32 jmp start2
pascal@13289 33 .ascii "HdrS" // 202 magic
pascal@13289 34 .word 0x200 // 206 version 2.00
pascal@13289 35 .long 0 // 208 realmode_swtch
pascal@13289 36 .word SYSTEM/16 // 20C start_sys_seg
pascal@13289 37 .word 0 // 20E kernel_version
pascal@13289 38 .byte 0 // 210 type_of_loader
pascal@13289 39 .byte 0 // 211 loadflags
pascal@13289 40 .word 0 // 212 setup_move_size
pascal@13289 41 .long SYSTEM // 214 code32_start
pascal@13289 42 .long 0 // 218 ramdisk_image
pascal@13289 43 .long 0 // 21C ramdisk_size
pascal@13289 44 .long 0 // 220 bootsect_kludge
pascal@13289 45 start2:
pascal@13289 46 #endif
pascal@19404 47 #if SAVEREGS
pascal@19404 48 pushfw
pascal@13269 49 pushw %cs
pascal@15188 50 pushw $0
pascal@19404 51 pushal
pascal@19404 52 pushw %ds
pascal@19942 53 cld
pascal@15188 54 #else
pascal@19404 55 pushw %cs
pascal@19942 56 # if FLAT16
pascal@19942 57 xorw %di, %di
pascal@19942 58 pushw %di
pascal@19942 59 # else
pascal@19404 60 pushw $0
pascal@19942 61 # endif
pascal@15188 62 #endif
pascal@20184 63 #if ELKS
pascal@20184 64 movw $0x100, %ax
pascal@20184 65 pushw %ax
pascal@20184 66 #else
pascal@19404 67 #if UPDATE_SYSSIZE
pascal@19942 68 pushw %ds // <A>
pascal@15188 69 #else
pascal@19942 70 pushw %cs // <A>
pascal@15188 71 #endif
pascal@20184 72 #endif
pascal@19404 73 #if FLAT16
pascal@20184 74 # 1- move 9020..9020+stp -> TOPSEG
pascal@20184 75 #if ELKS
pascal@20184 76 movb $TOPSEG/256, %ah
pascal@20184 77 movw %ax, %es
pascal@20184 78 #else
pascal@20184 79 pushw $TOPSEG
pascal@19942 80 popw %es
pascal@20184 81 #endif
pascal@19942 82 movw $0x200, %si
pascal@19942 83 #if SAVEREGS == 0
pascal@19942 84 pushw %es
pascal@20184 85 #if ELKS
pascal@20184 86 movw $cont, %ax
pascal@20184 87 pushw %ax
pascal@20184 88 #else
pascal@19942 89 // pushw $cont
pascal@19942 90 .byte 0x6A, cont
pascal@20184 91 #endif
pascal@19942 92 jmp jumpinto
pascal@19942 93 #else
pascal@19404 94 # if HARDCODED_SETUPSIZE
pascal@19404 95 setup_word:
pascal@19404 96 movw $SETUP*256, %cx
pascal@19404 97 # else
pascal@19404 98 xorw %cx, %cx
pascal@19404 99 movb SETUPSIZE, %ch
pascal@19404 100 movw %cx, %dx
pascal@19404 101 # endif
pascal@19942 102 pushw %cx // <B>
pascal@19942 103 pushw %es
pascal@19942 104 pushw %di
pascal@19404 105 rep
pascal@19942 106 movsw
pascal@19404 107 lret
pascal@19942 108 #endif
pascal@19404 109 cont:
pascal@20184 110 # 2- move 1000..1000+sys -> TOPSEG+stp
pascal@20184 111 #if ELKS
pascal@20184 112 movw $0x1000, %ax
pascal@20184 113 movw %ax, %ds
pascal@20184 114 #else
pascal@19404 115 pushw $0x1000
pascal@19404 116 popw %ds
pascal@20184 117 #endif
pascal@19391 118 xorw %si, %si
pascal@19391 119 subw %di, %cx
pascal@19391 120 rep
pascal@19404 121 movsb
pascal@20184 122 # 3- unlz(TOPSEG+stp:end, 1000-stp:0)
pascal@19942 123 pushw %es // <C>
pascal@19404 124 # if HARDCODED_SETUPSIZE
pascal@19404 125 setup_seg:
pascal@20184 126 #if ELKS
pascal@20184 127 # if UPDATE_SYSSIZE
pascal@20184 128 movw $0x1000-(SETUP*32)-32, %ax
pascal@20184 129 # else
pascal@20184 130 movw $0x1000-(SETUP*32), %ax
pascal@20184 131 # endif
pascal@20184 132 movw %ax, %es
pascal@20184 133 #else
pascal@19404 134 # if UPDATE_SYSSIZE
pascal@19404 135 pushw $0x1000-(SETUP*32)-32
pascal@19404 136 # else
pascal@19404 137 pushw $0x1000-(SETUP*32)
pascal@19404 138 # endif
pascal@19404 139 popw %es
pascal@20184 140 #endif
pascal@19404 141 # else
pascal@19404 142 # if UPDATE_SYSSIZE
pascal@19404 143 incb %dh
pascal@19404 144 # endif
pascal@20184 145 #if ELKS
pascal@20184 146 shrw $1, %dx
pascal@20184 147 shrw $1, %dx
pascal@20184 148 shrw $1, %dx
pascal@20184 149 #else
pascal@19404 150 shrw $3, %dx
pascal@20184 151 #endif
pascal@19404 152 movw %ds, %ax
pascal@19404 153 subw %dx, %ax
pascal@19404 154 movw %ax, %es
pascal@19404 155 # endif
pascal@19942 156 #else // FLAT16
pascal@19404 157 # 1- move 1000..1000+sys -> 9000-sys
pascal@19404 158 # if HARDCODED_SYSSIZE
pascal@19404 159 packed_syssize:
pascal@19404 160 movw $0x1000+0, %ax
pascal@19404 161 # else
pascal@19404 162 movw SYSSIZE, %ax
pascal@19404 163 addw $0x1000, %ax
pascal@19404 164 # endif
pascal@19404 165 movw %ds, %dx
pascal@19404 166 mvsys:
pascal@19404 167 decw %ax
pascal@19404 168 decw %dx
pascal@19404 169 movw %ax, %ds
pascal@19404 170 movw %dx, %es
pascal@19404 171 xorw %si, %si
pascal@19404 172 xorw %di, %di
pascal@19404 173 movw $8, %cx
pascal@19404 174 rep
pascal@19404 175 movsw
pascal@19404 176 cmpw $0x1000, %ax
pascal@19404 177 jne mvsys
pascal@19404 178 # 2- move 9020..9020+stp -> 9000-sys-stp
pascal@19404 179
pascal@19404 180 # if HARDCODED_SETUPSIZE
pascal@19404 181 setup_byte:
pascal@19404 182 movb $SETUP, %ch
pascal@19404 183 setup_para:
pascal@19404 184 subw $SETUP*32, %dx
pascal@19404 185 # else
pascal@19404 186 movb %ss:SETUPSIZE, %ch
pascal@19404 187 movw %cx, %ax
pascal@20184 188 #if ELKS
pascal@20184 189 shrw $1, %ax
pascal@20184 190 shrw $1, %ax
pascal@20184 191 shrw $1, %ax
pascal@20184 192 #else
pascal@19404 193 shrw $3, %ax
pascal@20184 194 #endif
pascal@19404 195 subw %ax, %dx
pascal@19404 196 # endif
pascal@19942 197 pushw %cx // <B>
pascal@19404 198 movw %dx, %es
pascal@19404 199 xorw %si, %si
pascal@19404 200 xorw %di, %di
pascal@19404 201 rep
pascal@19404 202 movsw %cs:(%si),%es:(%di)
pascal@19404 203 pushw %es
pascal@19404 204 # 3- reloc itself in 0x7C00
pascal@19404 205 pushw $0x07C0
pascal@19404 206 popw %es
pascal@19942 207 movw $cont, %si
pascal@19942 208 movw %si, %di
pascal@13269 209 movw $end-_start, %cx
pascal@19942 210 pushw %es
pascal@19942 211 pushw %di
pascal@13269 212 rep
pascal@19404 213 movsb %cs:(%si),%es:(%di)
pascal@19404 214 lret
pascal@19404 215 cont:
pascal@19404 216 # 4- unlz(9000-sys-stp:end, 1000-stp:0)
pascal@19404 217 # if HARDCODED_SETUPSIZE
pascal@19404 218 setup_seg:
pascal@19404 219 # if UPDATE_SYSSIZE
pascal@19404 220 pushw $0x1000-(SETUP*32)-32
pascal@19404 221 # else
pascal@19404 222 pushw $0x1000-(SETUP*32)
pascal@19404 223 # endif
pascal@19404 224 popw %es
pascal@19404 225 # else
pascal@19404 226 negw %ax
pascal@19404 227 # if UPDATE_SYSSIZE
pascal@19404 228 addw $0x1000-32, %ax
pascal@19404 229 # else
pascal@19404 230 addw $0x1000, %ax
pascal@19404 231 # endif
pascal@13269 232 movw %ax, %es
pascal@19404 233 # endif
pascal@19942 234 #endif // FLAT16
pascal@19942 235 popw %ds // <C>
pascal@19404 236 movw $end-_start, %si
pascal@19404 237 #if UPDATE_SYSSIZE
pascal@19404 238 movw $SYSSIZE, %di
pascal@19404 239 #else
pascal@13269 240 xorw %di, %di
pascal@19404 241 #endif
pascal@19404 242 pushw %di
pascal@19404 243 pushw %es
pascal@19404 244 call unpack
pascal@15188 245 popw %ds
pascal@15188 246 popw %si
pascal@19404 247 movw %si, %di
pascal@19942 248 # if SAVEREGS != 0
pascal@19942 249 popw %cx // <B>
pascal@15188 250 #if UPDATE_SYSSIZE
pascal@19404 251 // not need with memtest movb $(512-SYSSIZE)/2, %cl
pascal@15188 252 #endif
pascal@19942 253 popw %es // <A>
pascal@19404 254 # 5- move 1000-stp..1000 -> 9020
pascal@19942 255 # else
pascal@19942 256 popw %es // <A>
pascal@19942 257 jumpinto:
pascal@19942 258 # if HARDCODED_SETUPSIZE
pascal@19942 259 setup_word:
pascal@19942 260 movw $SETUP*256, %cx
pascal@19942 261 # else
pascal@19942 262 xorw %cx, %cx
pascal@19942 263 movb %ss:SETUPSIZE, %ch
pascal@19942 264 movw %cx, %dx
pascal@19942 265 # endif
pascal@19942 266 # endif
pascal@19404 267 rep
pascal@19404 268 movsw
pascal@19404 269 #if SAVEREGS
pascal@13269 270 popw %ds
pascal@13269 271 popal
pascal@13269 272 iret
pascal@19404 273 #else
pascal@19404 274 lret
pascal@19404 275 #endif
pascal@13269 276
pascal@13269 277 unpack:
pascal@19403 278 #define NO_LZMA_HEADER
pascal@20184 279 #if ELKS
pascal@20184 280 #define ONLY8086 1
pascal@20184 281 #endif
pascal@13288 282 #include "unlzma.S"
pascal@13269 283
pascal@13269 284 end: