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

Add at-spi2-atk
author Yuri Pourre <yuripourre@gmail.com>
date Sun Jul 13 15:22:00 2014 -0300 (2014-07-13)
parents b0e9e83532e2
children 3b334b26197f
rev   line source
pascal@15188 1 #define TOP (0x90000+_start-end)
pascal@13288 2 #define SYSTEM 0x10000
pascal@13288 3 #define SETUP 4
pascal@15188 4 #define SYSSIZE 0x1F4
pascal@15188 5 #define SETUPSIZE 0x1F1
pascal@13288 6
pascal@15188 7 #define CHANGE_STACK 0
pascal@15188 8 #define LINUX_HEADER 0
pascal@15188 9 #define UPDATE_SYSSIZE 1
pascal@15188 10 #define HARDCODED_SYSSIZE 1
pascal@15188 11 #define HARDCODED_SETUPSIZE 1
pascal@15188 12 #define HARDCODED_IP 1
pascal@13269 13
pascal@13269 14 .text
pascal@13269 15 .code16
pascal@13269 16 .org 0
pascal@13269 17
pascal@13269 18 .globl _start
pascal@13269 19 _start:
pascal@13289 20 #if LINUX_HEADER
pascal@13289 21 jmp start2
pascal@13289 22 .ascii "HdrS" // 202 magic
pascal@13289 23 .word 0x200 // 206 version 2.00
pascal@13289 24 .long 0 // 208 realmode_swtch
pascal@13289 25 .word SYSTEM/16 // 20C start_sys_seg
pascal@13289 26 .word 0 // 20E kernel_version
pascal@13289 27 .byte 0 // 210 type_of_loader
pascal@13289 28 .byte 0 // 211 loadflags
pascal@13289 29 .word 0 // 212 setup_move_size
pascal@13289 30 .long SYSTEM // 214 code32_start
pascal@13289 31 .long 0 // 218 ramdisk_image
pascal@13289 32 .long 0 // 21C ramdisk_size
pascal@13289 33 .long 0 // 220 bootsect_kludge
pascal@13289 34 start2:
pascal@13289 35 #endif
pascal@13269 36 pushf
pascal@13269 37 pushw %cs
pascal@15188 38 #if HARDCODED_IP
pascal@15188 39 pushw $0
pascal@15188 40 #else
pascal@13269 41 call getip
pascal@13269 42 getip:
pascal@15188 43 #endif
pascal@13269 44 pushal
pascal@15188 45 #if HARDCODED_SYSSIZE
pascal@15188 46 packed_syssize:
pascal@15188 47 movw $0, %bx // system size
pascal@15188 48 #else
pascal@15188 49 movw SYSSIZE, %bx
pascal@15188 50 #endif
pascal@15188 51 #if HARDCODED_SETUPSIZE == 0
pascal@15188 52 xorw %dx, %dx
pascal@15188 53 movb SETUPSIZE, %dh
pascal@15188 54 #endif
pascal@15188 55 #if HARDCODED_IP
pascal@15188 56 xorw %si, %si
pascal@15188 57 #else
pascal@13269 58 movw %sp, %bp
pascal@13269 59 #define START_IP 32(%bp)
pascal@15188 60 subw $getip-_start, START_IP
pascal@15188 61 movw START_IP, %si
pascal@15188 62 #endif
pascal@13269 63 pushw %ds
pascal@13269 64 pushw %es
pascal@13269 65
pascal@13269 66 cld
pascal@15188 67 #if CHANGE_STACK
pascal@15188 68 STKSZ=0x9000-0x0990
pascal@15188 69 movw $(TOP-STKSZ)/16, %ax
pascal@15188 70 #else
pascal@15188 71 movw $TOP/16, %ax
pascal@15188 72 #endif
pascal@15188 73 movw %ax, %es
pascal@15188 74 pushw %es // moved
pascal@15188 75 .byte 0x6A, moved-_start // unpack code
pascal@13269 76 pushw %cs
pascal@13269 77 popw %ds
pascal@15188 78 xorw %di, %di
pascal@13269 79 movw $end-_start, %cx
pascal@15188 80 pushw %si
pascal@13269 81 rep
pascal@13269 82 movsb // move upack code to $TOP
pascal@15188 83
pascal@15188 84 leaw SYSTEM/16(%bx), %bp
pascal@15188 85 movlp:
pascal@15188 86 decw %bp
pascal@15188 87 movw %bp, %ds
pascal@15188 88 decw %ax
pascal@13269 89 movw %ax, %es
pascal@13269 90 xorw %si, %si
pascal@13269 91 xorw %di, %di
pascal@15188 92 movb $8, %cl
pascal@13269 93 rep
pascal@13269 94 movsw // move system part
pascal@13269 95 decw %bx
pascal@15188 96 jnz movlp
pascal@15188 97
pascal@15188 98 pushw %cs
pascal@15188 99 popw %ds
pascal@15188 100 popw %si
pascal@15188 101 xorw %di, %di
pascal@15188 102 #if HARDCODED_SETUPSIZE
pascal@15188 103 movb $SETUP, %ch
pascal@15188 104 subw $SETUP*32, %ax
pascal@15188 105 #else
pascal@15188 106 movb %dh, %ch
pascal@15188 107 shrw $3, %dx
pascal@15188 108 subw %dx, %ax
pascal@15188 109 #endif
pascal@15188 110 movw %ax, %es
pascal@15188 111 pushw %si
pascal@15188 112 rep
pascal@15188 113 movsw // move header part
pascal@15188 114
pascal@15188 115 pushw %es
pascal@15188 116 popw %ds
pascal@15188 117 movw $end-_start, %si
pascal@15188 118 pushw %cs
pascal@15188 119 popw %es // restore setup seg
pascal@15188 120 popw %di
pascal@13269 121 retf
pascal@13269 122
pascal@13269 123 moved:
pascal@13288 124 #if CHANGE_STACK
pascal@15188 125 movw $STKSZ, %ax // trick: %ss = %sp
pascal@13288 126 movw %ss, %bx
pascal@15188 127 pushw %ax
pascal@13288 128 popw %ss
pascal@13288 129 xchgw %ax, %sp
pascal@13288 130 pushw %bx // %ss
pascal@13288 131 pushw %ax // %sp
pascal@13288 132 #endif
pascal@15188 133 pushw %bp // SYSTEM/16
pascal@13269 134 call unpack // unpack setup
pascal@13269 135 popw %es
pascal@13269 136 xorw %di,%di
pascal@13269 137 call unpack // unpack system
pascal@13288 138 #if CHANGE_STACK
pascal@13288 139 popw %ax // %sp
pascal@13288 140 popw %ss
pascal@13288 141 xchgw %ax, %sp
pascal@13288 142 #endif
pascal@15188 143 #if UPDATE_SYSSIZE
pascal@15188 144 # if HARDCODED_SYSSIZE
pascal@15188 145 original_syssize:
pascal@15188 146 movw $0, %ax
pascal@15188 147 # else
pascal@15188 148 addw $15, %di
pascal@15188 149 shrw $4, %di
pascal@15188 150 movw %es, %ax
pascal@15188 151 addw %di, %ax
pascal@15188 152 subw $SYSTEM/16, %ax
pascal@15188 153 # endif
pascal@15188 154 #endif
pascal@13269 155 popw %es
pascal@13269 156 popw %ds
pascal@15188 157 #if UPDATE_SYSSIZE
pascal@15188 158 movw %ax, SYSSIZE
pascal@15193 159 # if HARDCODED_SETUPSIZE
pascal@15193 160 original_setupsize:
pascal@15193 161 movb $4, SETUPSIZE
pascal@15193 162 # endif
pascal@15188 163 #endif
pascal@13269 164 popal
pascal@13269 165 iret
pascal@13269 166
pascal@13269 167 unpack:
pascal@13288 168 #include "unlzma.S"
pascal@13269 169
pascal@13269 170 end: