wok-current view linld/stuff/src/JUMP.ASM @ rev 24034
Openssh (8.5p1)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu Apr 08 09:21:26 2021 +0000 (2021-04-08) |
parents | 217c02cbbe8d |
children | 06547d8cf241 |
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 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 proc _boot_kernel near
92 ifdef NO386
93 p8086
94 else
95 p386
96 endif
97 ;cli ; we start doing destructive things to DOS
98 extrn sssp:word
99 mov ax,[sssp+2]
100 mov es,ax
101 extrn _cmdstr:word
102 _cmdline = _cmdstr+0
103 mov si,[_cmdline]
104 mov di,8000h
105 mov cx,2000h ; 4k for cmdline + 4k up to sp
106 rep
107 movsb
108 push es
109 pop ss
110 mov sp,di
112 ifdef LINUX001
113 mov dx,2000h
114 global _csip_hilo:word
115 org $-2
116 _csip_hilo dw ?
117 xchg al,dh ; 9020 / 9000
118 else
119 mov al,20h ; 9020:0
120 xor dx,dx
121 endif
122 push ax
123 push dx ; 0000 / 0042
125 mov cl,1 ; load high ?
126 org $-1
127 global _pm_low:byte
128 _pm_low db ?
129 push cx
130 ifdef IPXE
131 mov ax,[word ss:024Ch]
132 xor ax,2b30h ; ipxe ?
133 loopne @@notipxe
134 else
135 loop @@truebzimage
136 endif
138 ; finish loading
139 extrn @last_ditch$qv:near
140 push cs
141 call @last_ditch$qv
142 ifdef SHUTDOWN
143 dos_shutdown ; clear si; ds=0; kill VCPI
144 push cs
145 pop ds
146 else
147 xor si,si
148 endif
150 @@truebzimage:
151 @@notipxe:
152 pop cx
153 loop @@isbzimage
155 ; prepare memcpy32 size & srcofs param to move zImage pm
156 ifndef NO386
157 push 8 ; size hi
158 else
159 mov dx,8
160 push dx ; size hi
161 endif
162 push si ; size lo=up to 512k
164 include "himem.inc"
166 extrn _imgs:image_himem
167 ifdef NO386
168 les ax,[_imgs.fallback] ; src ofs = pm.fallback
169 push es
170 push ax
171 else
172 push [_imgs.fallback] ; src ofs = pm.fallback
173 endif
175 ;in al,70h
176 ;or al,80h ; disable NMI
177 ;out 70h,al
179 push si ; src seg=0
180 inc cx
181 push cx ; dst ofs hi
182 push si ; dst ofs lo : 64k = 0x10000
184 ; self move
185 extrn gdt_data
186 mov cx,offset gdt_data+8
187 ;xor di,di ; A000 -9000 -0800(>movedend)
189 ifdef NO386
190 mov ax,ss
191 add ax,800h+(4096/16)
192 push ax ; topseg()+0x0900
193 else
194 push 9800h+(4096/16) ; 4096 bytes for cmdline
195 endif
196 pop es
197 push es
199 ifdef ELKS
200 call near @@movsb@jmp ; movsb; pop cs ; ds=es=ss
201 elseifdef MOVE_SETUP
202 call near @@movsb@jmp ; movsb; pop cs ; ds=es=ss
203 else
204 xor di,di
205 rep
206 movsb
207 call near @@isbzimage ; pop cs ; ds=es=ss
208 endif
210 ;mov es,cx
211 ;mov [es:15*4+2],cs ; update int15/88h hook
213 extrn memcpy32:near
214 call memcpy32
216 ifdef MOVE_SETUP
217 mov si,0
218 global _rm_offset:word
219 org $-2
220 _rm_offset dw ?
221 ;xor di,di
222 ;mov cx,8000h
223 ;sub cx,si
224 ;rep
225 ; movsb
226 endif
228 ifdef ELKS
229 ifdef MOVE_SETUP
230 ifndef NO386
231 mov eax,[dword si+1E6h]
232 xor eax,'SKLE'
233 else
234 mov ax,[si+1E6h]
235 xor ax,'LE'
236 jne @@notelks
237 mov ax,[si+1E8h]
238 xor ax,'SK'
239 endif
240 else
241 ifndef NO386
242 mov eax,[dword 1E6h]
243 xor eax,'SKLE'
244 else
245 mov ax,[1E6h]
246 xor ax,'LE'
247 jne @@notelks
248 mov ax,[1E8h]
249 xor ax,'SK'
250 endif
251 endif
252 jne @@notelks
253 mov cx,100h ; DS=ES=SS=0100
254 mov ss,cx
255 push ss
256 pop es
257 mov cl,20h ; CS=0120
258 push cx
259 push ax ; IP=0000
260 endif
261 ifdef MOVE_SETUP
262 @@notelks:
263 mov ch,7Eh
264 @@movsb@jmp:
265 xor di,di
266 rep
267 movsb
268 else
269 ifdef ELKS
270 xchg ax,si
271 mov ch,7Eh ; 0Ah min, 7Eh max
272 @@movsb@jmp:
273 xor di,di
274 rep
275 movsb
276 @@notelks:
277 endif
278 endif
279 @@isbzimage:
280 push ss
281 pop ds
282 push ss
283 pop es
284 ifndef NO386
285 push ss
286 pop fs
287 push ss
288 pop gs
289 endif
290 assume nothing
291 assume cs:DGROUP
292 retf
294 ifdef SHUTDOWN
295 step19code
296 endif
298 endp _boot_kernel
300 ends _TEXT
302 end
304 ;###### END OF FILE ############################################