wok-current view linld/stuff/src/JUMP.ASM @ rev 20119

slitaz-base-files (333), slitaz-boot-scripts (445), slitaz-configs (313), slitaz-tools (1025), tazbug (152), tazinst (93), tazirc (22), tazlito (469), tazpanel (617), tazweb (208): revision of german messages
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Oct 14 10:45:51 2017 +0200 (2017-10-14)
parents 485b1db348fd
children 04feaffdc0d9
line source
1 ;***************************************************************
2 ;****** This file is distributed under GPL
3 ;***************************************************************
4 ideal
5 %crefref
6 %noincl
7 %nomacs
8 ifdef NO386
9 p8086
10 else
11 p386
12 endif
14 group DGROUP _TEXT,_DATA,_BSS
15 assume cs:DGROUP,ds:DGROUP
17 segment _DATA byte public use16 'DATA'
19 overflow db "Loaded too close to 9000:0",0
21 ends _DATA
23 segment _BSS byte public use16 'BSS'
25 global _imgs:dword
27 ends _BSS
30 segment _TEXT byte public use16 'CODE'
32 ;***************************************************************
33 ;void boot_kernel();
34 ;****** Never returns
35 ;***************************************************************
36 global _boot_kernel:near
37 proc _boot_kernel near
39 ; Shrink stack: we won't need much of it now and have no malloc() plans
40 extrn _heap_top:word
41 mov ax,[_heap_top]
42 inc ah
43 cmp ax,sp
44 ja @@samesp
45 xchg ax,sp
46 @@samesp:
47 ifdef NO386
48 extrn _topseg:near
49 call near _topseg
50 mov es,ax
51 xchg ax,bx
52 mov cl,4
53 mov ax,sp
54 shr ax,cl
55 else
56 mov bx,9000h
57 mov es,bx
58 mov ax,sp
59 shr ax,4
60 endif
61 mov dx,cs
62 add ax,dx
63 cmp ax,bx
64 jb @@nooverflow
65 ; Oops! We can stomp on our toes... better stop now
66 mov bx,offset overflow
67 extrn die:near
68 jmp near die
69 @@nooverflow:
70 cli ; we start doing destructive things to DOS
71 push es
72 pop ss
73 mov sp,0A000h
74 extrn _csip:dword
75 push [dword _csip]
76 extrn _rm_size:word
77 mov si,offset _rm_size ; _rm_size, _pm_high, _rm_buf
78 lodsw
79 xchg ax,cx ; _rm_size
80 lodsb ; _pm_high
81 mov si,[si] ; _rm_buf
82 xor di,di
83 ;cld
84 rep
85 movsb
86 extrn _cmdline:word
87 mov si,[_cmdline]
88 mov di,8000h
89 mov ch,10h ; 4k
90 rep
91 movsb
92 cmp al,cl ; load high ?
93 jne @@isbzimage
94 ifdef NO386
95 add bh,9
96 push bx ; topseg()+0x0900
97 else
98 push 9800h+(4096/16) ; 4096 bytes for cmdline
99 endif
100 ; finish loading
101 extrn @last_ditch$qv:near
102 push cs
103 call @last_ditch$qv
104 mov ax,[word _imgs+2+2] ; get pm->fallback high word
105 ; self move
106 ;cld
107 pop es ; min 2048 bytes for stack
108 xor si,si ; A000 -9000 -0800(>movedend)
109 xor di,di ; set ZF
110 mov cx,offset movedend
111 rep
112 movsb
113 push es
114 call near @@doretf ; mov cs,es
115 push ss
116 pop es
117 push cs
118 pop ds
119 push ax
120 extrn dos_shutdown:near
121 call near dos_shutdown
122 ;in al,70h
123 ;or al,80h ; disable NMI
124 ;out 70h,al
125 pop bx
126 ; move zImage pm
127 mov ax,8
128 cwd ; clear dx
129 cmp bx,ax
130 ja @@bufhigh
131 sub ax,bx
132 inc ax
133 @@bufhigh:
134 push ax
135 push dx ; size=up to 512k
136 push bx ; src ofs= pm.fallback
137 push dx
138 push dx ; srcseg=0
139 ifdef NO386
140 inc dx
141 push dx ; dst
142 dec dx
143 else
144 push 1 ; dst
145 endif
146 push dx ; ofs=64k
147 extrn _memcpy32:near
148 call _memcpy32
149 add sp,14
151 ifndef noelks
152 push ss
153 pop ds
154 ifndef NO386
155 cmp [dword 1E6h],'SKLE'
156 else
157 cmp [word 1E6h],'LE'
158 jne @@notelks
159 cmp [word 1E8h],'SK'
160 endif
161 jne @@notelks
162 ifdef NO386
163 mov cx,120h
164 push cx
165 mov cl,0h
166 push cx
167 else
168 push 120h
169 push 100h
170 endif
171 pop es
172 xor si,si
173 xor di,di
174 mov ch,05h
175 rep
176 movsw
177 push es
178 pop ss
179 push cx
180 @@notelks:
181 endif
182 @@isbzimage:
183 push ss
184 pop ds
185 ;push ss
186 ;pop es
187 ifndef NO386
188 push ss
189 pop fs
190 push ss
191 pop gs
192 endif
193 assume nothing
194 assume cs:DGROUP
195 @@doretf:
196 retf
198 movedend:
199 endp _boot_kernel
201 ends _TEXT
203 end
205 ;###### END OF FILE ############################################