wok-6.x view linld/stuff/src/JUMP.ASM @ rev 24022
linld: basic iso9660 support
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Mar 14 19:55:20 2021 +0000 (2021-03-14) |
parents | 61df94a0fa43 |
children | 6b6d14c9f7e9 |
line source
1 ;***************************************************************
2 ;****** This file is distributed under GPL
3 ;***************************************************************
4 ideal
5 %PAGESIZE 1000
6 %crefref
7 %noincl
8 %nomacs
10 include "common.inc"
12 ifdef NO386
13 p8086
14 else
15 p386
16 endif
18 group DGROUP _TEXT
19 assume cs:DGROUP,ds:DGROUP
21 segment _TEXT byte public use16 'CODE'
23 ;***************************************************************
24 ;void dos_shutdown()
25 ;***************************************************************
27 macro dos_shutdown
28 xor si,si
29 ifdef QUICK_BOOT
30 extrn _cmdnum:dword
31 quickboot = (word _cmdnum+20)
32 cmp si,[quickboot]
33 mov ds,si
34 jne skip_shutdown
35 else
36 mov ds,si
37 endif
38 ifndef NO386
39 push [dword si+4] ; save step
40 mov [word si+4],offset step19
41 else
42 mov ax,offset step19
43 xchg ax,[word si+4]
44 push [word si+6]
45 push ax ; save step
46 endif
47 mov [word cs:sssp],sp
48 ;cmp [byte si+7],0F0h
49 ;jnc notdos
50 mov [si+6],cs
51 pushf
52 pushf
53 pop ax
54 inc ah ; set TF
55 push ax
56 popf
57 call [dword si+4*19h]
58 notdos:
59 ifndef NO386
60 lss sp,[dword cs:sssp]
61 else
62 lds ax,[dword cs:sssp]
63 push ds
64 pop ss
65 xchg ax,sp
66 endif
67 xor si,si
68 mov ds,si
69 pop [dword si+4] ; restore step
70 skip_shutdown:
71 endm
72 macro step19code
73 step19:
74 push si
75 push ds
76 mov si,sp
77 lds si,[dword ss:si+4] ; read cs:ip
78 cmp [word si],19CDh ; int 19h ?
79 pop ds
80 pop si
81 je notdos
82 iret
83 endm
86 ;***************************************************************
87 ;void boot_kernel();
88 ;****** Never returns
89 ;***************************************************************
90 global _boot_kernel:near
91 proc _boot_kernel near
93 ifdef NO386
94 p8086
95 else
96 p386
97 endif
98 ;cli ; we start doing destructive things to DOS
99 extrn sssp:word
100 mov ax,[sssp+2]
101 mov es,ax
102 extrn _cmdstr:word
103 _cmdline = _cmdstr+0
104 mov si,[_cmdline]
105 mov di,8000h
106 mov cx,2000h ; 4k for cmdline + 4k up to sp
107 rep
108 movsb
109 push es
110 pop ss
111 mov sp,di
113 ifdef LINUX001
114 mov dx,2000h
115 global _csip_hilo:word
116 org $-2
117 _csip_hilo dw ?
118 xchg al,dh ; 9020 / 9000
119 else
120 mov al,20h ; 9020:0
121 xor dx,dx
122 endif
123 push ax
124 push dx ; 0000 / 0042
126 mov cl,1 ; load high ?
127 org $-1
128 global _pm_low:byte
129 _pm_low db ?
130 push cx
131 ifdef IPXE
132 mov ax,[word ss:024Ch]
133 xor ax,2b30h ; ipxe ?
134 loopne @@notipxe
135 else
136 loop @@truebzimage
137 endif
139 ; finish loading
140 extrn @last_ditch$qv:near
141 push cs
142 call @last_ditch$qv
143 ifdef SHUTDOWN
144 dos_shutdown ; clear si; ds=0; kill VCPI
145 push cs
146 pop ds
147 else
148 xor si,si
149 endif
151 @@truebzimage:
152 @@notipxe:
153 pop cx
154 loop @@isbzimage
156 ; prepare memcpy32 size & srcofs param to move zImage pm
157 ifndef NO386
158 push 8 ; size hi
159 else
160 mov dx,8
161 push dx ; size hi
162 endif
163 push si ; size lo=up to 512k
165 include "himem.inc"
167 extrn _imgs:image_himem
168 push [_imgs.fallback] ; src ofs = pm.fallback
170 ;in al,70h
171 ;or al,80h ; disable NMI
172 ;out 70h,al
174 push si ; src seg=0
175 inc cx
176 push cx ; dst ofs hi
177 push si ; dst ofs lo : 64k = 0x10000
179 ; self move
180 extrn gdt_data
181 mov cx,offset gdt_data+8
182 ;xor di,di ; A000 -9000 -0800(>movedend)
184 ifdef NO386
185 mov ax,ss
186 add ax,900h
187 push ax ; topseg()+0x0900
188 else
189 push 9800h+(4096/16) ; 4096 bytes for cmdline
190 endif
191 pop es
192 push es
194 ifdef ELKS
195 call near @@movsb@jmp ; movsb; pop cs ; ds=es=ss
196 elseifdef MOVE_SETUP
197 call near @@movsb@jmp ; movsb; pop cs ; ds=es=ss
198 else
199 xor di,di
200 rep
201 movsb
202 call near @@isbzimage ; movsb; pop cs ; ds=es=ss
203 endif
205 extrn memcpy32:near
206 call memcpy32
208 ifdef MOVE_SETUP
209 mov si,0
210 global _rm_offset:word
211 org $-2
212 _rm_offset dw ?
213 ;xor di,di
214 ;mov cx,8000h
215 ;sub cx,si
216 ;rep
217 ; movsb
218 endif
220 ifdef ELKS
221 ifdef MOVE_SETUP
222 ifndef NO386
223 mov eax,[dword si+1E6h]
224 xor eax,'SKLE'
225 else
226 mov ax,[si+1E6h]
227 xor ax,'LE'
228 jne @@notelks
229 mov ax,[si+1E8h]
230 xor ax,'SK'
231 endif
232 else
233 ifndef NO386
234 mov eax,[dword 1E6h]
235 xor eax,'SKLE'
236 else
237 mov ax,[1E6h]
238 xor ax,'LE'
239 jne @@notelks
240 mov ax,[1E8h]
241 xor ax,'SK'
242 endif
243 endif
244 jne @@notelks
245 mov cx,100h ; DS=ES=SS=0100
246 mov ss,cx
247 push ss
248 pop es
249 mov cl,20h ; CS=0120
250 push cx
251 push ax ; IP=0000
252 endif
253 ifdef MOVE_SETUP
254 @@notelks:
255 mov ch,7Eh
256 @@movsb@jmp:
257 xor di,di
258 rep
259 movsb
260 else
261 ifdef ELKS
262 xchg ax,si
263 mov ch,7Eh ; 0Ah min, 7Eh max
264 @@movsb@jmp:
265 xor di,di
266 rep
267 movsb
268 @@notelks:
269 endif
270 endif
271 @@isbzimage:
272 push ss
273 pop ds
274 push ss
275 pop es
276 ifndef NO386
277 push ss
278 pop fs
279 push ss
280 pop gs
281 endif
282 assume nothing
283 assume cs:DGROUP
284 retf
286 ifdef SHUTDOWN
287 step19code
288 endif
290 endp _boot_kernel
292 ends _TEXT
294 end
296 ;###### END OF FILE ############################################