wok view linld/stuff/src/JUMP.ASM @ rev 25037

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