wok-6.x annotate memtest/stuff/unpack.S @ rev 19404

Up openssh (7.3p1)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Sep 09 12:06:28 2016 +0200 (2016-09-09)
parents fd3dadf90ba9
children e4d1fb5556df
rev   line source
pascal@15188 1 #define TOP (0x90000+_start-end)
pascal@13288 2 #define SYSTEM 0x10000
pascal@19404 3 #define SETUP 14
pascal@15188 4 #define SYSSIZE 0x1F4
pascal@15188 5 #define SETUPSIZE 0x1F1
pascal@13288 6
pascal@15188 7 #define LINUX_HEADER 0
pascal@15188 8 #define UPDATE_SYSSIZE 1
pascal@15188 9 #define HARDCODED_SYSSIZE 1
pascal@15188 10 #define HARDCODED_SETUPSIZE 1
pascal@19391 11 #define FLAT16 1
pascal@19391 12 //#define FLAT16OUT 0
pascal@19404 13 #define SAVEREGS 0
pascal@13269 14
pascal@13269 15 .text
pascal@13269 16 .code16
pascal@13269 17 .org 0
pascal@13269 18
pascal@13269 19 .globl _start
pascal@13269 20 _start:
pascal@13289 21 #if LINUX_HEADER
pascal@13289 22 jmp start2
pascal@13289 23 .ascii "HdrS" // 202 magic
pascal@13289 24 .word 0x200 // 206 version 2.00
pascal@13289 25 .long 0 // 208 realmode_swtch
pascal@13289 26 .word SYSTEM/16 // 20C start_sys_seg
pascal@13289 27 .word 0 // 20E kernel_version
pascal@13289 28 .byte 0 // 210 type_of_loader
pascal@13289 29 .byte 0 // 211 loadflags
pascal@13289 30 .word 0 // 212 setup_move_size
pascal@13289 31 .long SYSTEM // 214 code32_start
pascal@13289 32 .long 0 // 218 ramdisk_image
pascal@13289 33 .long 0 // 21C ramdisk_size
pascal@13289 34 .long 0 // 220 bootsect_kludge
pascal@13289 35 start2:
pascal@13289 36 #endif
pascal@19404 37 #if SAVEREGS
pascal@19404 38 pushfw
pascal@13269 39 pushw %cs
pascal@15188 40 pushw $0
pascal@19404 41 pushal
pascal@19404 42 pushw %ds
pascal@15188 43 #else
pascal@19404 44 pushw %cs
pascal@19404 45 pushw $0
pascal@15188 46 #endif
pascal@19404 47 #if UPDATE_SYSSIZE
pascal@19404 48 pushw %ds
pascal@15188 49 #else
pascal@19404 50 pushw %es
pascal@19404 51 pushw %cs
pascal@15188 52 #endif
pascal@19404 53 cld
pascal@19404 54 #if FLAT16
pascal@19404 55 # 1- move 9020..9020+stp -> 8000
pascal@19404 56 # if HARDCODED_SETUPSIZE
pascal@19404 57 setup_word:
pascal@19404 58 movw $SETUP*256, %cx
pascal@19404 59 # else
pascal@19404 60 xorw %cx, %cx
pascal@19404 61 movb SETUPSIZE, %ch
pascal@19404 62 movw %cx, %dx
pascal@19404 63 # endif
pascal@19404 64 pushw %cx
pascal@19404 65 pushw $0x8000
pascal@19404 66 popw %es
pascal@15188 67 xorw %si, %si
pascal@19404 68 xorw %di, %di
pascal@19404 69 rep
pascal@19404 70 movsw %cs:(%si),%es:(%di)
pascal@13269 71 pushw %es
pascal@19404 72 // pushw $cont
pascal@19404 73 .byte 0x6A, cont
pascal@19404 74 lret
pascal@19404 75 cont:
pascal@19404 76 # 2- move 1000..1000+sys -> 8000+stp
pascal@19404 77 pushw $0x1000
pascal@19404 78 popw %ds
pascal@19391 79 xorw %si, %si
pascal@19391 80 subw %di, %cx
pascal@19391 81 rep
pascal@19404 82 movsb
pascal@19404 83 # 3- unlz(8000+stp:end, 1000-stp:0)
pascal@19404 84 pushw %es
pascal@19404 85 # if HARDCODED_SETUPSIZE
pascal@19404 86 setup_seg:
pascal@19404 87 # if UPDATE_SYSSIZE
pascal@19404 88 pushw $0x1000-(SETUP*32)-32
pascal@19404 89 # else
pascal@19404 90 pushw $0x1000-(SETUP*32)
pascal@19404 91 # endif
pascal@19404 92 popw %es
pascal@19404 93 # else
pascal@19404 94 # if UPDATE_SYSSIZE
pascal@19404 95 incb %dh
pascal@19404 96 # endif
pascal@19404 97 shrw $3, %dx
pascal@19404 98 movw %ds, %ax
pascal@19404 99 subw %dx, %ax
pascal@19404 100 movw %ax, %es
pascal@19404 101 # endif
pascal@15188 102 #else
pascal@19404 103 # 1- move 1000..1000+sys -> 9000-sys
pascal@19404 104 # if HARDCODED_SYSSIZE
pascal@19404 105 packed_syssize:
pascal@19404 106 movw $0x1000+0, %ax
pascal@19404 107 # else
pascal@19404 108 movw SYSSIZE, %ax
pascal@19404 109 addw $0x1000, %ax
pascal@19404 110 # endif
pascal@19404 111 movw %ds, %dx
pascal@19404 112 mvsys:
pascal@19404 113 decw %ax
pascal@19404 114 decw %dx
pascal@19404 115 movw %ax, %ds
pascal@19404 116 movw %dx, %es
pascal@19404 117 xorw %si, %si
pascal@19404 118 xorw %di, %di
pascal@19404 119 movw $8, %cx
pascal@19404 120 rep
pascal@19404 121 movsw
pascal@19404 122 cmpw $0x1000, %ax
pascal@19404 123 jne mvsys
pascal@19404 124 # 2- move 9020..9020+stp -> 9000-sys-stp
pascal@19404 125
pascal@19404 126 # if HARDCODED_SETUPSIZE
pascal@19404 127 setup_byte:
pascal@19404 128 movb $SETUP, %ch
pascal@19404 129 setup_para:
pascal@19404 130 subw $SETUP*32, %dx
pascal@19404 131 # else
pascal@19404 132 movb %ss:SETUPSIZE, %ch
pascal@19404 133 movw %cx, %ax
pascal@19404 134 shrw $3, %ax
pascal@19404 135 subw %ax, %dx
pascal@19404 136 # endif
pascal@19404 137 pushw %cx
pascal@19404 138 movw %dx, %es
pascal@19404 139 xorw %si, %si
pascal@19404 140 xorw %di, %di
pascal@19404 141 rep
pascal@19404 142 movsw %cs:(%si),%es:(%di)
pascal@19404 143 pushw %es
pascal@19404 144 # 3- reloc itself in 0x7C00
pascal@19404 145 pushw $0x07C0
pascal@19404 146 popw %es
pascal@19404 147 xorw %si, %si
pascal@15188 148 xorw %di, %di
pascal@13269 149 movw $end-_start, %cx
pascal@13269 150 rep
pascal@19404 151 movsb %cs:(%si),%es:(%di)
pascal@19404 152 pushw %es
pascal@19404 153 // pushw $cont
pascal@19404 154 .byte 0x6A, cont
pascal@19404 155 lret
pascal@19404 156 cont:
pascal@19404 157 # 4- unlz(9000-sys-stp:end, 1000-stp:0)
pascal@19404 158 # if HARDCODED_SETUPSIZE
pascal@19404 159 setup_seg:
pascal@19404 160 # if UPDATE_SYSSIZE
pascal@19404 161 pushw $0x1000-(SETUP*32)-32
pascal@19404 162 # else
pascal@19404 163 pushw $0x1000-(SETUP*32)
pascal@19404 164 # endif
pascal@19404 165 popw %es
pascal@19404 166 # else
pascal@19404 167 negw %ax
pascal@19404 168 # if UPDATE_SYSSIZE
pascal@19404 169 addw $0x1000-32, %ax
pascal@19404 170 # else
pascal@19404 171 addw $0x1000, %ax
pascal@19404 172 # endif
pascal@13269 173 movw %ax, %es
pascal@19404 174 # endif
pascal@19404 175 #endif
pascal@19404 176 popw %ds
pascal@19404 177 movw $end-_start, %si
pascal@19404 178 #if UPDATE_SYSSIZE
pascal@19404 179 movw $SYSSIZE, %di
pascal@19404 180 #else
pascal@13269 181 xorw %di, %di
pascal@19404 182 #endif
pascal@19404 183 pushw %di
pascal@19404 184 pushw %es
pascal@19404 185 call unpack
pascal@15188 186 popw %ds
pascal@15188 187 popw %si
pascal@19404 188 movw %si, %di
pascal@19404 189 popw %cx
pascal@15188 190 #if UPDATE_SYSSIZE
pascal@19404 191 // not need with memtest movb $(512-SYSSIZE)/2, %cl
pascal@15188 192 #endif
pascal@13269 193 popw %es
pascal@19404 194 # 5- move 1000-stp..1000 -> 9020
pascal@19404 195 rep
pascal@19404 196 movsw
pascal@19404 197 #if UPDATE_SYSSIZE == 0
pascal@19404 198 popw %es
pascal@19404 199 #endif
pascal@19404 200 #if SAVEREGS
pascal@13269 201 popw %ds
pascal@13269 202 popal
pascal@13269 203 iret
pascal@19404 204 #else
pascal@19404 205 lret
pascal@19404 206 #endif
pascal@13269 207
pascal@13269 208 unpack:
pascal@19403 209 #define NO_LZMA_HEADER
pascal@13288 210 #include "unlzma.S"
pascal@13269 211
pascal@13269 212 end: