mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 16:27:36 +00:00
Kernel: Set an appropriate GDT for 64-bit mode
This commit is contained in:
parent
d84abe51f5
commit
4c555684b7
1 changed files with 19 additions and 3 deletions
|
@ -87,6 +87,16 @@ the 9 page tables each contain 512 pte's that map individual 4KB pages
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
gdt64:
|
||||||
|
.quad 0
|
||||||
|
gdt64code:
|
||||||
|
.quad (1<<43) | (1<<44) | (1<<47) | (1<<53) /* executable, code segment, present, 64-bit */
|
||||||
|
gdt64ptr:
|
||||||
|
.short . - gdt64 - 1
|
||||||
|
.quad gdt64
|
||||||
|
|
||||||
|
.set code64_sel, gdt64code - gdt64
|
||||||
|
|
||||||
start:
|
start:
|
||||||
cli
|
cli
|
||||||
cld
|
cld
|
||||||
|
@ -250,8 +260,13 @@ start:
|
||||||
addl $0xc0000000, %ebx
|
addl $0xc0000000, %ebx
|
||||||
movl %ebx, multiboot_info_ptr
|
movl %ebx, multiboot_info_ptr
|
||||||
|
|
||||||
|
lgdt gdt64ptr
|
||||||
|
ljmpl $code64_sel, $1f
|
||||||
|
|
||||||
|
.code64
|
||||||
|
1:
|
||||||
call init
|
call init
|
||||||
add $4, %esp
|
add $4, %rsp
|
||||||
|
|
||||||
cli
|
cli
|
||||||
loop:
|
loop:
|
||||||
|
@ -319,7 +334,8 @@ apic_ap_start32:
|
||||||
movl $0x80000001, %eax
|
movl $0x80000001, %eax
|
||||||
cpuid
|
cpuid
|
||||||
testl $0x100000, %edx
|
testl $0x100000, %edx
|
||||||
je (1f - apic_ap_start + 0x8000)
|
// TODO: Uncomment this
|
||||||
|
//je (1f - apic_ap_start + 0x8000)
|
||||||
/* turn on IA32_EFER.NXE */
|
/* turn on IA32_EFER.NXE */
|
||||||
movl $0xc0000080, %ecx
|
movl $0xc0000080, %ecx
|
||||||
rdmsr
|
rdmsr
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue