wok-current view linld/stuff/src/JUMP.ASM @ rev 22632
linux: add CONFIG_SND_PCSP
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Mon Jan 13 11:52:56 2020 +0100 (2020-01-13) |
parents | 65ea21135647 |
children | d70f7cc6e3ac |
line source
1 ;***************************************************************
2 ;****** This file is distributed under GPL
3 ;***************************************************************
4 ideal
5 %PAGESIZE 1000
6 %crefref
7 %noincl
8 %nomacs
9 ifdef NO386
10 p8086
11 else
12 p386
13 endif
15 group DGROUP _TEXT,_BSS
16 assume cs:DGROUP,ds:DGROUP
18 segment _BSS byte public use16 'BSS'
20 global _imgs:dword
22 ends _BSS
25 segment _TEXT byte public use16 'CODE'
27 ;***************************************************************
28 ;void dos_shutdown()
29 ;***************************************************************
31 macro dos_shutdown
32 xor si,si
33 mov ds,si
34 ifndef NO386
35 push [dword si+4] ; save step
36 mov [word si+4],offset step19
37 else
38 mov ax,offset step19
39 xchg ax,[word si+4]
40 push [word si+6]
41 push ax ; save step
42 endif
43 mov [word cs:sssp],sp
44 ;cmp [byte si+7],0F0h
45 ;jnc notdos
46 mov [si+6],cs
47 pushf
48 pushf
49 pop ax
50 inc ah ; set TF
51 push ax
52 popf
53 call [dword si+4*19h]
54 notdos:
55 ifndef NO386
56 lss sp,[dword cs:sssp]
57 else
58 lds ax,[dword cs:sssp]
59 push ds
60 pop ss
61 xchg ax,sp
62 endif
63 xor si,si
64 mov ds,si
65 pop [dword si+4] ; restore step
66 endm
67 macro step19code
68 step19:
69 push si
70 push ds
71 mov si,sp
72 lds si,[dword ss:si+4] ; read cs:ip
73 cmp [word si],19CDh ; int 19h ?
74 pop ds
75 pop si
76 je notdos
77 iret
78 endm
81 ;***************************************************************
82 ;void boot_kernel();
83 ;****** Never returns
84 ;***************************************************************
85 global _boot_kernel:near
86 proc _boot_kernel near
88 ifdef NO386
89 p8086
90 else
91 p386
92 endif
93 ;cli ; we start doing destructive things to DOS
94 extrn sssp:word
95 mov ax,[sssp+2]
96 mov es,ax
97 extrn _cmdline:word
98 mov si,[_cmdline]
99 mov di,8000h
100 mov cx,2000h ; 4k for cmdline + 4k up to sp
101 rep
102 movsb
103 push es
104 pop ss
105 mov sp,di
107 mov dx,2000h
108 global _csip_hilo:word
109 org $-2
110 _csip_hilo dw ?
111 xchg al,dh ; 9020 / 9000
112 push ax
113 push dx ; 0000 / 0042
115 mov cl,1 ; load high ?
116 org $-1
117 global _pm_low:byte
118 _pm_low db ?
119 push cx
120 mov ax,[word ss:024Ch]
121 xor ax,2b30h ; ipxe ?
122 loopne @@notipxe
124 ; finish loading
125 extrn @last_ditch$qv:near
126 push cs
127 call @last_ditch$qv
128 dos_shutdown ; clear si; ds=0; kill VCPI
129 push cs
130 pop ds
132 @@notipxe:
133 pop cx
134 loop @@isbzimage
136 ; prepare memcpy32 size & srcofs param to move zImage pm
137 ifndef NO386
138 push 8 ; size hi
139 else
140 mov dx,8
141 push dx ; size hi
142 endif
143 push si ; size lo=up to 512k
144 push [dword _imgs+2] ; src ofs = pm.fallback
146 ;in al,70h
147 ;or al,80h ; disable NMI
148 ;out 70h,al
150 push si ; src seg=0
151 inc cx
152 push cx ; dst ofs hi
153 push si ; dst ofs lo : 64k
155 ; self move
156 extrn gdt_data
157 mov cx,offset gdt_data+8
158 ;xor di,di ; A000 -9000 -0800(>movedend)
160 ifdef NO386
161 mov ax,ss
162 add ax,900h
163 push ax ; topseg()+0x0900
164 else
165 push 9800h+(4096/16) ; 4096 bytes for cmdline
166 endif
167 pop es
168 push es
170 call near @@movsb@jmp ; movsb; pop cs ; ds=es=ss
172 extrn memcpy32:near
173 call memcpy32
175 ifdef MOVE_SETUP
176 mov si,0
177 global _rm_offset:word
178 org $-2
179 _rm_offset dw ?
180 ;xor di,di
181 ;mov cx,8000h
182 ;sub cx,si
183 ;rep
184 ; movsb
185 endif
187 ifndef noelks
188 ifdef MOVE_SETUP
189 ifndef NO386
190 mov eax,[dword si+1E6h]
191 xor eax,'SKLE'
192 else
193 mov ax,[si+1E6h]
194 xor ax,'LE'
195 jne @@notelks
196 mov ax,[si+1E8h]
197 xor ax,'SK'
198 endif
199 else
200 ifndef NO386
201 mov eax,[dword 1E6h]
202 xor eax,'SKLE'
203 else
204 mov ax,[1E6h]
205 xor ax,'LE'
206 jne @@notelks
207 mov ax,[1E8h]
208 xor ax,'SK'
209 endif
210 endif
211 jne @@notelks
212 mov cx,100h ; DS=ES=SS=0100
213 mov ss,cx
214 push ss
215 pop es
216 mov cl,20h ; CS=0120
217 push cx
218 push ax ; IP=0000
219 endif
220 ifdef MOVE_SETUP
221 @@notelks:
222 mov ch,7Eh
223 @@movsb@jmp:
224 xor di,di
225 rep
226 movsb
227 else
228 ifndef noelks
229 xchg ax,si
230 mov ch,7Eh ; 0Ah min, 7Eh max
231 @@movsb@jmp:
232 xor di,di
233 rep
234 movsb
235 @@notelks:
236 endif
237 endif
238 @@isbzimage:
239 push ss
240 pop ds
241 push ss
242 pop es
243 ifndef NO386
244 push ss
245 pop fs
246 push ss
247 pop gs
248 endif
249 assume nothing
250 assume cs:DGROUP
251 retf
253 step19code
255 endp _boot_kernel
257 movedend:
259 ends _TEXT
261 end
263 ;###### END OF FILE ############################################