wok view linld/stuff/tobzimage.S @ rev 19357

Up p7zip (16.02)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Jul 30 10:07:40 2016 +0200 (2016-07-30)
parents 1c8a113c536a
children 1dce8e8602f2
line source
2 #define REALMODE_SWITCH
3 #define SHUTDOWNDOS
4 #define ELKS_SUPPORT
5 #define LINUX001_SUPPORT
7 .code16
8 .org 0
10 #define CODE32_START 0x100000
11 jmp start
12 .ascii "HdrS"
13 .word 0x200 # version
14 .long 0 # realmode_swtch
15 .word 0x1000 # start_sys_seg
16 .word kernel_version
17 .byte 0 # type of loader
18 .byte 1 # loadflags
19 .word 0x8000 # setup_move_size
20 .long CODE32_START # code32_start
21 .long 0 # ramdisk_image
22 .long 0 # ramdisk_size
23 .long 0 # bootsect_kludge
24 .word 0 # heap_end_ptr 2.01+, patched by bootloader
26 start:
27 pushf
28 pushw %cs
29 pushw $0
30 pushaw
31 xorw %di, %di
32 .byte 0x66, 0xC7, 0x05 # movl $?, (%di)
33 rep
34 movsw
35 popaw
36 doiret:
37 iret
38 pushw %ds
39 pushw %di
40 #ifdef REALMODE_SWITCH
41 movw $0x0208, %si
42 lodsw
43 orw (%si), %ax
44 jz norealmode_switch
45 lcallw *-2(%si)
46 norealmode_switch:
47 #endif
49 #ifdef SHUTDOWNDOS
50 xorw %si, %si
51 movw %si, %ds # %ds = 0
52 pushl 4(%si)
53 movw %sp, %cs:loadsp19+1(%si)
54 cmpb $0xF0, 7(%si)
55 jnb notdos
56 movw $step19, 4(%si)
57 movw %cs, 6(%si)
58 pushfw
59 popw %ax
60 incb %ah # set TF
61 pushw %ax
62 popfw
63 ljmp *4*0x19(%si)
64 step19:
65 pushw %si
66 pushw %ds
67 movw %sp, %si
68 ldsw %ss:4(%si), %si
69 cmpw $0x19CD, (%si)
70 popw %ds
71 popw %si
72 jne doiret
73 xorw %si, %si
74 mov %si, %ds
75 popl 4*0x19(%si)
76 notdos:
77 loadsp19:
78 movw $0, %sp
79 popl 4(%si)
80 pushw %ss
81 popw %ds
82 #else
83 xorw %si, %si
84 #endif
85 #if defined(ELKS_SUPPORT) || defined(LINUX001_SUPPORT)
86 movw %sp, %bx
87 #endif
88 movw $9, %cx
89 z1:
90 pushw %si # 0000 0000 0000 0000 0000 0000 0000 0000 0000
91 loop z1
92 movw $0x9301, %ax
93 cwd
94 pushw %ax # 9301
95 pushw %si # 0000
96 pushw %dx # FFFF
97 pushw %si # 0000
98 movb 0x216, %al
99 pushw %ax # 93xx
100 pushw %si # 0000
101 pushw %dx # FFFF
102 movb $8, %cl
103 z2:
104 pushw %si # 0000 0000 0000 0000 0000 0000 0000 0000
105 loop z2
106 movw $0x200, %di
107 movw -12(%di), %dx
108 pushw %ss
109 popw %es
110 movw %sp, %si
111 mvlp:
112 movw $0x8000, %cx
113 movb $0x87, %ah
114 int $0x15
115 incw 20(%si)
116 incw 28(%si)
117 subw $0x1000, %dx
118 ja mvlp
119 addw $48, %sp
120 #ifdef ELKS_SUPPORT
121 //cmpl $0x534B4C45, -26(%di)
122 movw $0x100, %cx
123 elks_patch:
124 jmp notelks
125 movb %ch, 23(%bx)
126 movw %cx, %es
127 pushw %di
128 xorw %di, %di
129 xorw %si, %si
130 movb $0x6, %ch
131 rep
132 movsw
133 popw %di
134 pushw %es
135 popw %ds
136 notelks:
137 #endif
138 movw $0x400, %si
139 decb -15(%di)
140 #ifdef LINUX001_SUPPORT
141 //cmpw $0x3AE8, 0x3F(%si)
142 linux001_patch:
143 jmp notlnx001
144 movb $0x42, (%bx)
145 xorw %di, %di
146 # ifndef ELKS_SUPPORT
147 movw $0x100, %cx
148 # endif
149 rep
150 movsw
151 notlnx001:
152 #endif
153 movb -15(%di), %ch
154 lret
155 endcode:
157 .org 256
158 kernel_version:
159 .asciz "zImage"
160 .org 512
161 oldsetup: