blob: 73bb9d37bf59a94f5a72dd4136cea70930910dcf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;; Miguel's FoolOS Helper Functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; switch_to_pm - actual switch from 16bit real to 32bit protected
; init_pm - sets up some regs and calls boot_32_pm
;
[bits 16]
switch_to_pm:
cli ;switch off interrupts!
lgdt [gdt_descriptor] ;load descriptor table!
lldt [gdt_descriptor] ;load descriptor table! (local)
;switch on 32-bit protected mode
mov eax, cr0
or eax,0x1
mov cr0, eax
jmp CODE_SEG:init_pm
[bits 32]
init_pm:
mov ax, DATA_SEG
mov ds, ax
mov ss, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ebp, 0x90000
mov esp, ebp
call boot_32_pm ;continue booting in 32-bit protected mode
|