wok view linld/stuff/tobzimage.S @ rev 21894
updated scrub (2.4 -> 2.6.1)
author | Hans-G?nter Theisgen |
---|---|
date | Thu Oct 03 14:15:41 2019 +0100 (2019-10-03) |
parents | 58452392e881 |
children |
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 notdos:
76 loadsp19:
77 movw $0, %sp
78 popl 4(%si)
79 pushw %ss
80 popw %ds
81 #else
82 xorw %si, %si
83 #endif
84 #if defined(ELKS_SUPPORT) || defined(LINUX001_SUPPORT)
85 movw %sp, %bx
86 #endif
87 movw $9, %cx
88 z1:
89 pushw %si # 0000 0000 0000 0000 0000 0000 0000 0000 0000
90 loop z1
91 movw $0x9301, %ax
92 cwd
93 pushw %ax # 9301
94 pushw %si # 0000
95 pushw %dx # FFFF
96 pushw %si # 0000
97 movb 0x216, %al
98 pushw %ax # 93xx
99 pushw %si # 0000
100 pushw %dx # FFFF
101 movb $8, %cl
102 z2:
103 pushw %si # 0000 0000 0000 0000 0000 0000 0000 0000
104 loop z2
105 movw $0x200, %di
106 movw -12(%di), %dx
107 pushw %ss
108 popw %es
109 movw %sp, %si
110 mvlp:
111 movw $0x8000, %cx
112 movb $0x87, %ah
113 int $0x15
114 incw 20(%si)
115 incw 28(%si)
116 subw $0x1000, %dx
117 ja mvlp
118 addw $48, %sp
119 #ifdef ELKS_SUPPORT
120 //cmpl $0x534B4C45, -26(%di)
121 movw $0x100, %cx
122 elks_patch:
123 jmp notelks
124 movb %ch, 23(%bx)
125 movw %cx, %es
126 pushw %di
127 xorw %di, %di
128 xorw %si, %si
129 movb $0x6, %ch
130 rep
131 movsw
132 popw %di
133 pushw %es
134 popw %ds
135 notelks:
136 #endif
137 movw $0x400, %si
138 decb -15(%di)
139 #ifdef LINUX001_SUPPORT
140 //cmpw $0x3AE8, 0x3F(%si)
141 linux001_patch:
142 jmp notlnx001
143 movb $0x42, (%bx)
144 xorw %di, %di
145 # ifndef ELKS_SUPPORT
146 movw $0x100, %cx
147 # endif
148 rep
149 movsw
150 notlnx001:
151 #endif
152 movb -15(%di), %ch
153 lret
154 endcode:
156 .org 256
157 kernel_version:
158 .asciz "zImage"
159 .org 512
160 oldsetup: