Subversion Repositories Kolibri OS

Rev

Rev 7132 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7132 Rev 7734
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;  Shutdown for Menuet                                         ;;
6
;;  Shutdown for Menuet                                         ;;
7
;;                                                              ;;
7
;;                                                              ;;
8
;;  Distributed under General Public License                    ;;
8
;;  Distributed under General Public License                    ;;
9
;;  See file COPYING for details.                               ;;
9
;;  See file COPYING for details.                               ;;
10
;;  Copyright 2003 Ville Turjanmaa                              ;;
10
;;  Copyright 2003 Ville Turjanmaa                              ;;
11
;;                                                              ;;
11
;;                                                              ;;
12
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
13
 
13
 
-
 
14
$Revision: 7734 $
-
 
15
 
-
 
16
; ACPI Generic Address Structure
-
 
17
struct GAS
-
 
18
        asid        db ? ; address space id
-
 
19
        bit_width   db ?
-
 
20
        bit_offset  db ?
-
 
21
        access_size db ?
-
 
22
        address     DQ ?
-
 
23
ends
-
 
24
 
-
 
25
ASID.SYSTEM_MEMORY = 0
-
 
26
ASID.SYSTEM_IO     = 1
-
 
27
ASID.PCI_CONFIG    = 2
-
 
28
ASID.PCI_EC        = 3
-
 
29
ASID.PCI_SMBUS     = 4
-
 
30
 
-
 
31
ACCESS_SIZE.UNDEFINED = 0
-
 
32
ACCESS_SIZE.BYTE      = 1
-
 
33
ACCESS_SIZE.WORD      = 2
-
 
34
ACCESS_SIZE.DWORD     = 3
14
$Revision: 7132 $
35
ACCESS_SIZE.QWORD     = 4
15
 
36
 
16
align 4
37
align 4
17
system_shutdown:          ; shut down the system
38
system_shutdown:          ; shut down the system
18
 
39
 
19
        cmp     byte [BOOT.shutdown_type], SYSTEM_SHUTDOWN
40
        cmp     byte [BOOT.shutdown_type], SYSTEM_SHUTDOWN
20
        jb      @F
41
        jb      @F
21
        cmp     byte [BOOT.shutdown_type], SYSTEM_RESTART
42
        cmp     byte [BOOT.shutdown_type], SYSTEM_RESTART
22
        jbe     .valid
43
        jbe     .valid
23
@@:
44
@@:
24
        ret
45
        ret
25
.valid:
46
.valid:
26
        call    stop_all_services
47
        call    stop_all_services
27
 
48
 
28
yes_shutdown_param:
49
yes_shutdown_param:
29
; Shutdown other CPUs, if initialized
50
; Shutdown other CPUs, if initialized
30
        cmp     [ap_initialized], 0
51
        cmp     [ap_initialized], 0
31
        jz      .no_shutdown_cpus
52
        jz      .no_shutdown_cpus
32
        mov     edi, [LAPIC_BASE]
53
        mov     edi, [LAPIC_BASE]
33
        add     edi, 300h
54
        add     edi, 300h
34
        mov     esi, smpt+4
55
        mov     esi, smpt+4
35
        mov     ebx, [cpu_count]
56
        mov     ebx, [cpu_count]
36
        dec     ebx
57
        dec     ebx
37
.shutdown_cpus_loop:
58
.shutdown_cpus_loop:
38
        lodsd
59
        lodsd
39
        push    esi
60
        push    esi
40
        xor     esi, esi
61
        xor     esi, esi
41
        inc     esi
62
        inc     esi
42
        shl     eax, 24
63
        shl     eax, 24
43
        mov     [edi+10h], eax
64
        mov     [edi+10h], eax
44
; assert INIT IPI
65
; assert INIT IPI
45
        mov     dword [edi], 0C500h
66
        mov     dword [edi], 0C500h
46
        call    delay_ms
67
        call    delay_ms
47
@@:
68
@@:
48
        test    dword [edi], 1000h
69
        test    dword [edi], 1000h
49
        jnz     @b
70
        jnz     @b
50
; deassert INIT IPI
71
; deassert INIT IPI
51
        mov     dword [edi], 8500h
72
        mov     dword [edi], 8500h
52
        call    delay_ms
73
        call    delay_ms
53
@@:
74
@@:
54
        test    dword [edi], 1000h
75
        test    dword [edi], 1000h
55
        jnz     @b
76
        jnz     @b
56
; don't send STARTUP IPI: let other CPUs be in wait-for-startup state
77
; don't send STARTUP IPI: let other CPUs be in wait-for-startup state
57
        pop     esi
78
        pop     esi
58
        dec     ebx
79
        dec     ebx
59
        jnz     .shutdown_cpus_loop
80
        jnz     .shutdown_cpus_loop
60
.no_shutdown_cpus:
81
.no_shutdown_cpus:
61
 
82
 
62
        cli
83
        cli
63
        call    IRQ_mask_all
84
        call    IRQ_mask_all
64
 
85
 
65
        mov     eax, dword[BOOT.shutdown_type]
86
        mov     eax, dword[BOOT.shutdown_type]
66
        cmp     al, SYSTEM_RESTART
87
        cmp     al, SYSTEM_RESTART
67
        jne     @F
88
        jne     @F
68
 
89
 
69
; load kernel.mnt to _CLEAN_ZONE
90
; load kernel.mnt to _CLEAN_ZONE
70
        mov     ebx, kernel_file_load
91
        mov     ebx, kernel_file_load
71
        pushad
92
        pushad
72
        call    file_system_lfn
93
        call    file_system_lfn
73
        popad
94
        popad
74
@@:
95
@@:
75
        mov     esi, OS_BASE+restart_code_start ; move kernel re-starter to 0x5000:0
96
        mov     esi, OS_BASE+restart_code_start ; move kernel re-starter to 0x5000:0
76
        mov     edi, OS_BASE+0x50000
97
        mov     edi, OS_BASE+0x50000
77
        mov     ecx, (restart_code_end - restart_code_start)/4
98
        mov     ecx, (restart_code_end - restart_code_start)/4
78
        rep movsd
99
        rep movsd
79
 
100
 
80
        call    create_trampoline_pgmap
101
        call    create_trampoline_pgmap
81
        mov     cr3, eax
102
        mov     cr3, eax
82
        jmp     @F
103
        jmp     @F
83
org $-OS_BASE
104
org $-OS_BASE
84
@@:
105
@@:
85
 
106
 
86
;disable paging
107
;disable paging
87
 
108
 
88
        mov     eax, cr0
109
        mov     eax, cr0
89
        and     eax, 0x7FFFFFFF
110
        and     eax, 0x7FFFFFFF
90
        mov     cr0, eax
111
        mov     cr0, eax
91
        mov     eax, cr3
112
        mov     eax, cr3
92
        mov     cr3, eax
113
        mov     cr3, eax
93
 
114
 
94
        cmp     byte [BOOT_LO.shutdown_type], SYSTEM_SHUTDOWN
115
        cmp     byte [BOOT_LO.shutdown_type], SYSTEM_SHUTDOWN
95
        jne     no_acpi_power_off
116
        jne     no_acpi_power_off
96
 
117
 
97
; system_power_off
118
; system_power_off
98
 
119
 
99
        mov     ebx, [acpi_fadt_base-OS_BASE]
120
        mov     ebx, [acpi_fadt_base-OS_BASE]
100
        cmp     dword [ebx], 'FACP'
121
        cmp     dword [ebx], 'FACP'
101
        jne     no_acpi_power_off
122
        jne     no_acpi_power_off
102
        mov     esi, [acpi_dsdt_base-OS_BASE]
123
        mov     esi, [acpi_dsdt_base-OS_BASE]
103
        cmp     dword [esi], 'DSDT'
124
        cmp     dword [esi], 'DSDT'
104
        jne     no_acpi_power_off
125
        jne     no_acpi_power_off
105
        mov     eax, [esi+4] ; DSDT length
126
        mov     eax, [esi+4] ; DSDT length
106
        sub     eax, 36+4
127
        sub     eax, 36+4
107
        jbe     no_acpi_power_off
128
        jbe     no_acpi_power_off
108
        add     esi, 36
129
        add     esi, 36
109
.scan_dsdt:
130
.scan_dsdt:
110
        cmp     dword [esi], '_S5_'
131
        cmp     dword [esi], '_S5_'
111
        jnz     .scan_dsdt_cont
132
        jnz     .scan_dsdt_cont
112
        cmp     byte [esi+4], 12h ; DefPackage opcode
133
        cmp     byte [esi+4], 12h ; DefPackage opcode
113
        jnz     .scan_dsdt_cont
134
        jnz     .scan_dsdt_cont
114
        mov     dl, [esi+6]
135
        mov     dl, [esi+6]
115
        cmp     dl, 4 ; _S5_ package must contain 4 bytes
136
        cmp     dl, 4 ; _S5_ package must contain 4 bytes
116
                      ; ...in theory; in practice, VirtualBox has 2 bytes
137
                      ; ...in theory; in practice, VirtualBox has 2 bytes
117
        ja      .scan_dsdt_cont
138
        ja      .scan_dsdt_cont
118
        cmp     dl, 1
139
        cmp     dl, 1
119
        jb      .scan_dsdt_cont
140
        jb      .scan_dsdt_cont
120
        lea     esi, [esi+7]
141
        lea     esi, [esi+7]
121
        xor     ecx, ecx
142
        xor     ecx, ecx
122
        cmp     byte [esi], 0 ; 0 means zero byte, 0Ah xx means byte xx
143
        cmp     byte [esi], 0 ; 0 means zero byte, 0Ah xx means byte xx
123
        jz      @f
144
        jz      @f
124
        cmp     byte [esi], 0xA
145
        cmp     byte [esi], 0xA
125
        jnz     no_acpi_power_off
146
        jnz     no_acpi_power_off
126
        inc     esi
147
        inc     esi
127
        mov     cl, [esi]
148
        mov     cl, [esi]
128
@@:
149
@@:
129
        inc     esi
150
        inc     esi
130
        cmp     dl, 2
151
        cmp     dl, 2
131
        jb      @f
152
        jb      @f
132
        cmp     byte [esi], 0
153
        cmp     byte [esi], 0
133
        jz      @f
154
        jz      @f
134
        cmp     byte [esi], 0xA
155
        cmp     byte [esi], 0xA
135
        jnz     no_acpi_power_off
156
        jnz     no_acpi_power_off
136
        inc     esi
157
        inc     esi
137
        mov     ch, [esi]
158
        mov     ch, [esi]
138
@@:
159
@@:
139
        jmp     do_acpi_power_off
160
        jmp     do_acpi_power_off
140
.scan_dsdt_cont:
161
.scan_dsdt_cont:
141
        inc     esi
162
        inc     esi
142
        dec     eax
163
        dec     eax
143
        jnz     .scan_dsdt
164
        jnz     .scan_dsdt
144
        jmp     no_acpi_power_off
165
        jmp     no_acpi_power_off
145
do_acpi_power_off:
166
do_acpi_power_off:
146
        mov     edx, [ebx+48]
167
        mov     edx, [ebx+48]
147
        test    edx, edx
168
        test    edx, edx
148
        jz      .nosmi
169
        jz      .nosmi
149
        mov     al, [ebx+52]
170
        mov     al, [ebx+52]
150
        out     dx, al
171
        out     dx, al
151
        mov     edx, [ebx+64]
172
        mov     edx, [ebx+64]
152
@@:
173
@@:
153
        in      ax, dx
174
        in      ax, dx
154
        test    al, 1
175
        test    al, 1
155
        jz      @b
176
        jz      @b
156
.nosmi:
177
.nosmi:
157
        and     cx, 0x0707
178
        and     cx, 0x0707
158
        shl     cx, 2
179
        shl     cx, 2
159
        or      cx, 0x2020
180
        or      cx, 0x2020
160
        mov     edx, [ebx+64]
181
        mov     edx, [ebx+64]
161
        in      ax, dx
182
        in      ax, dx
162
        and     ax, 203h
183
        and     ax, 203h
163
        or      ah, cl
184
        or      ah, cl
164
        out     dx, ax
185
        out     dx, ax
165
        mov     edx, [ebx+68]
186
        mov     edx, [ebx+68]
166
        test    edx, edx
187
        test    edx, edx
167
        jz      @f
188
        jz      @f
168
        in      ax, dx
189
        in      ax, dx
169
        and     ax, 203h
190
        and     ax, 203h
170
        or      ah, ch
191
        or      ah, ch
171
        out     dx, ax
192
        out     dx, ax
172
@@:
193
@@:
173
        jmp     $
194
        jmp     $
174
 
195
 
175
no_acpi_power_off:
196
no_acpi_power_off:
-
 
197
        cmp     byte[BOOT_LO.shutdown_type], SYSTEM_REBOOT
-
 
198
        jnz     no_acpi_reboot
-
 
199
        ; try to reboot via ACPI fixed features
-
 
200
        mov     ebx, [acpi_fadt_base-OS_BASE]
-
 
201
        cmp     dword[ebx], 'FACP'
-
 
202
        jne     no_acpi_power_off
-
 
203
        test    dword[ebx+0x70], 1 SHL 10    ; RESET_REG_SUP
-
 
204
        jz      no_acpi_reboot
-
 
205
        cmp     [ebx+0x74+GAS.asid], ASID.SYSTEM_IO
-
 
206
        jnz     no_acpi_reboot
-
 
207
        cmp     [ebx+0x74+GAS.bit_width], 8
-
 
208
        jnz     no_acpi_reboot
-
 
209
        cmp     [ebx+0x74+GAS.bit_offset], 0
-
 
210
        jnz     no_acpi_reboot
-
 
211
        cmp     [ebx+0x74+GAS.access_size], ACCESS_SIZE.BYTE
-
 
212
        ja      no_acpi_reboot
-
 
213
        cmp     [ebx+0x74+GAS.address.hi], 0
-
 
214
        jnz     no_acpi_reboot
-
 
215
        mov     edx, [ebx+0x74+GAS.address.lo]
-
 
216
        movzx   eax, byte[ebx+0x80]
-
 
217
        out     dx, al
-
 
218
        jmp     $
-
 
219
        ; unreachable
-
 
220
no_acpi_reboot:
176
        jmp     0x50000
221
        jmp     0x50000
177
 
222
 
178
align 4
223
align 4
179
restart_code_start:
224
restart_code_start:
180
org 0x50000
225
org 0x50000
181
 
226
 
182
        cmp     byte [BOOT_LO.shutdown_type], SYSTEM_RESTART
227
        cmp     byte [BOOT_LO.shutdown_type], SYSTEM_RESTART
183
        jne     @F
228
        jne     @F
184
 
229
 
185
        mov     esi, _CLEAN_ZONE-OS_BASE
230
        mov     esi, _CLEAN_ZONE-OS_BASE
186
        mov     edi, 0x10000
231
        mov     edi, 0x10000
187
        mov     ecx, 0x31000/4
232
        mov     ecx, 0x31000/4
188
        cld
233
        cld
189
        rep movsd
234
        rep movsd
190
@@:
235
@@:
191
 
236
 
192
        xor     ebx, ebx
237
        xor     ebx, ebx
193
        xor     edx, edx
238
        xor     edx, edx
194
        xor     ecx, ecx
239
        xor     ecx, ecx
195
        xor     esi, esi
240
        xor     esi, esi
196
        xor     edi, edi
241
        xor     edi, edi
197
        xor     ebp, ebp
242
        xor     ebp, ebp
198
        lidt    [.idt]
243
        lidt    [.idt]
199
        lgdt    [.gdt]
244
        lgdt    [.gdt]
200
        jmp     8:@f
245
        jmp     8:@f
201
align 8
246
align 8
202
.gdt:
247
.gdt:
203
; selector 0 - not used
248
; selector 0 - not used
204
        dw      23
249
        dw      23
205
        dd      .gdt
250
        dd      .gdt
206
        dw      0
251
        dw      0
207
; selector 8 - code from 5000:0000 to 1000:FFFF
252
; selector 8 - code from 5000:0000 to 1000:FFFF
208
        dw      0FFFFh
253
        dw      0FFFFh
209
        dw      0
254
        dw      0
210
        db      5
255
        db      5
211
        db      10011011b
256
        db      10011011b
212
        db      00000000b
257
        db      00000000b
213
        db      0
258
        db      0
214
; selector 10h - data from 1000:0000 to 1000:FFFF
259
; selector 10h - data from 1000:0000 to 1000:FFFF
215
        dw      0FFFFh
260
        dw      0FFFFh
216
        dw      0
261
        dw      0
217
        db      1
262
        db      1
218
        db      10010011b
263
        db      10010011b
219
        db      00000000b
264
        db      00000000b
220
        db      0
265
        db      0
221
.idt:
266
.idt:
222
        dw 256*4
267
        dw 256*4
223
        dd 0
268
        dd 0
224
org $ - 0x50000
269
org $ - 0x50000
225
use16
270
use16
226
@@:
271
@@:
227
        mov     ax, 10h
272
        mov     ax, 10h
228
        mov     ds, ax
273
        mov     ds, ax
229
        mov     es, ax
274
        mov     es, ax
230
        mov     fs, ax
275
        mov     fs, ax
231
        mov     gs, ax
276
        mov     gs, ax
232
        mov     ss, ax
277
        mov     ss, ax
233
 
278
 
234
        mov     eax, cr0
279
        mov     eax, cr0
235
        and     eax, not 80000001h
280
        and     eax, not 80000001h
236
        mov     cr0, eax
281
        mov     cr0, eax
237
        jmp     0x5000:.real_mode
282
        jmp     0x5000:.real_mode
238
 
283
 
239
align 4
284
align 4
240
.real_mode:
285
.real_mode:
241
 
286
 
242
; setup stack
287
; setup stack
243
 
288
 
244
        mov     ax, (TMP_STACK_TOP and 0xF0000) shr 4
289
        mov     ax, (TMP_STACK_TOP and 0xF0000) shr 4
245
        mov     ss, ax
290
        mov     ss, ax
246
        mov     esp, TMP_STACK_TOP and 0xFFFF
291
        mov     esp, TMP_STACK_TOP and 0xFFFF
247
 
292
 
248
;remap IRQs
293
;remap IRQs
249
        mov     al, 0x11
294
        mov     al, 0x11
250
        out     0x20, al
295
        out     0x20, al
251
        out     0xA0, al
296
        out     0xA0, al
252
 
297
 
253
        mov     al, 0x08
298
        mov     al, 0x08
254
        out     0x21, al
299
        out     0x21, al
255
        mov     al, 0x70
300
        mov     al, 0x70
256
        out     0xA1, al
301
        out     0xA1, al
257
 
302
 
258
        mov     al, 0x04
303
        mov     al, 0x04
259
        out     0x21, al
304
        out     0x21, al
260
        mov     al, 0x02
305
        mov     al, 0x02
261
        out     0xA1, al
306
        out     0xA1, al
262
 
307
 
263
        mov     al, 0x01
308
        mov     al, 0x01
264
        out     0x21, al
309
        out     0x21, al
265
        out     0xA1, al
310
        out     0xA1, al
266
 
311
 
267
        mov     al, 0xB8
312
        mov     al, 0xB8
268
        out     0x21, al
313
        out     0x21, al
269
        mov     al, 0xBD
314
        mov     al, 0xBD
270
        out     0xA1, al
315
        out     0xA1, al
271
 
316
 
272
        mov     al, 00110100b
317
        mov     al, 00110100b
273
        out     43h, al
318
        out     43h, al
274
        mov     al, 0xFF
319
        mov     al, 0xFF
275
        out     40h, al
320
        out     40h, al
276
        out     40h, al
321
        out     40h, al
277
 
322
 
278
        xor     ax, ax
323
        xor     ax, ax
279
        mov     ds, ax
324
        mov     ds, ax
280
        mov     al, [BOOT_LO.shutdown_type]
325
        mov     al, [BOOT_LO.shutdown_type]
281
        cmp     al, SYSTEM_RESTART
326
        cmp     al, SYSTEM_RESTART
282
        je      .restart
327
        je      .restart
283
 
328
 
284
        cmp     al, SYSTEM_SHUTDOWN
329
        cmp     al, SYSTEM_SHUTDOWN
285
        je      .APM_PowerOff
330
        je      .APM_PowerOff
286
 
331
 
287
        mov     word[0x0472], 0x1234
332
        mov     word[0x0472], 0x1234
288
        jmp     0xF000:0xFFF0
333
        jmp     0xF000:0xFFF0
289
 
334
 
290
.APM_PowerOff:
335
.APM_PowerOff:
291
        mov     ax, 5304h
336
        mov     ax, 5304h
292
        xor     bx, bx
337
        xor     bx, bx
293
        int     15h
338
        int     15h
294
;!!!!!!!!!!!!!!!!!!!!!!!!
339
;!!!!!!!!!!!!!!!!!!!!!!!!
295
        mov     ax, 0x5300
340
        mov     ax, 0x5300
296
        xor     bx, bx
341
        xor     bx, bx
297
        int     0x15
342
        int     0x15
298
        push    ax
343
        push    ax
299
 
344
 
300
        mov     ax, 0x5301
345
        mov     ax, 0x5301
301
        xor     bx, bx
346
        xor     bx, bx
302
        int     0x15
347
        int     0x15
303
 
348
 
304
        mov     ax, 0x5308
349
        mov     ax, 0x5308
305
        mov     bx, 1
350
        mov     bx, 1
306
        mov     cx, bx
351
        mov     cx, bx
307
        int     0x15
352
        int     0x15
308
 
353
 
309
        mov     ax, 0x530E
354
        mov     ax, 0x530E
310
        xor     bx, bx
355
        xor     bx, bx
311
        pop     cx
356
        pop     cx
312
        int     0x15
357
        int     0x15
313
 
358
 
314
        mov     ax, 0x530D
359
        mov     ax, 0x530D
315
        mov     bx, 1
360
        mov     bx, 1
316
        mov     cx, bx
361
        mov     cx, bx
317
        int     0x15
362
        int     0x15
318
 
363
 
319
        mov     ax, 0x530F
364
        mov     ax, 0x530F
320
        mov     bx, 1
365
        mov     bx, 1
321
        mov     cx, bx
366
        mov     cx, bx
322
        int     0x15
367
        int     0x15
323
 
368
 
324
        mov     ax, 0x5307
369
        mov     ax, 0x5307
325
        mov     bx, 1
370
        mov     bx, 1
326
        mov     cx, 3
371
        mov     cx, 3
327
        int     0x15
372
        int     0x15
328
;!!!!!!!!!!!!!!!!!!!!!!!!
373
;!!!!!!!!!!!!!!!!!!!!!!!!
329
        jmp     $
374
        jmp     $
330
 
375
 
331
.restart:
376
.restart:
332
 
377
 
333
; (hint by Black_mirror)
378
; (hint by Black_mirror)
334
; We must read data from keyboard port,
379
; We must read data from keyboard port,
335
; because there may be situation when previous keyboard interrupt is lost
380
; because there may be situation when previous keyboard interrupt is lost
336
; (due to return to real mode and IRQ reprogramming)
381
; (due to return to real mode and IRQ reprogramming)
337
; and next interrupt will not be generated (as keyboard waits for handling)
382
; and next interrupt will not be generated (as keyboard waits for handling)
338
 
383
 
339
        mov     cx, 16
384
        mov     cx, 16
340
@@:
385
@@:
341
        in      al, 0x64
386
        in      al, 0x64
342
        test    al, 1
387
        test    al, 1
343
        jz      @F
388
        jz      @F
344
        in      al, 0x60
389
        in      al, 0x60
345
        loop    @B
390
        loop    @B
346
@@:
391
@@:
347
 
392
 
348
; bootloader interface
393
; bootloader interface
349
        push    0x1000
394
        push    0x1000
350
        pop     ds
395
        pop     ds
351
        push    0
396
        push    0
352
        pop     es
397
        pop     es
353
        mov     si, [es:BOOT_LO.kernel_restart]
398
        mov     si, [es:BOOT_LO.kernel_restart]
354
        mov     ax, 'KL'
399
        mov     ax, 'KL'
355
        jmp     0x1000:0000
400
        jmp     0x1000:0000
356
 
401
 
357
align 4
402
align 4
358
org restart_code_start + $
403
org restart_code_start + $
359
restart_code_end:
404
restart_code_end:
360
 
405
 
361
org $+OS_BASE
406
org $+OS_BASE
362
use32
407
use32