Simplest possible long-mode entry
This commit is contained in:
parent
eb637d0bbb
commit
dd7636e906
@ -53,4 +53,33 @@ mov esp, offset BootStack
|
||||
call check_cpuid
|
||||
call check_longmode
|
||||
|
||||
mov eax, cr4
|
||||
or eax, 1<<5
|
||||
mov cr4, eax
|
||||
|
||||
mov eax, offset BootP4
|
||||
mov cr3, eax
|
||||
|
||||
mov ecx, 0x0C0000080
|
||||
rdmsr
|
||||
or eax, 1<<8
|
||||
wrmsr
|
||||
|
||||
mov eax, cr0
|
||||
or eax, 1<<31
|
||||
mov cr0, eax
|
||||
|
||||
lgdt [BootGDTp]
|
||||
|
||||
mov eax, 0x10
|
||||
mov ss, eax
|
||||
mov ds, eax
|
||||
mov es, eax
|
||||
|
||||
.extern long_mode_start
|
||||
jmp 0x8:long_mode_start
|
||||
|
||||
.code64
|
||||
long_mode_start:
|
||||
|
||||
jmp $
|
||||
|
33
src/kernel/boot/boot_pagedir.S
Normal file
33
src/kernel/boot/boot_pagedir.S
Normal file
@ -0,0 +1,33 @@
|
||||
.intel_syntax noprefix
|
||||
|
||||
.section .data
|
||||
.align 0x1000
|
||||
.global BootP4
|
||||
BootP4:
|
||||
.quad offset BootP3 + 0x3
|
||||
.rept 511
|
||||
.quad 0x0
|
||||
.endr
|
||||
BootP3:
|
||||
.quad offset BootP2 + 0x3
|
||||
.rept 511
|
||||
.quad 0x0
|
||||
.endr
|
||||
BootP2:
|
||||
.set i, 0
|
||||
.rept 512
|
||||
.quad (i << 21 ) + 0x83
|
||||
.set i, (i+1)
|
||||
.endr
|
||||
|
||||
.section .rodata
|
||||
.align 0x1000
|
||||
.global BootGDT
|
||||
.global BootGDTp
|
||||
BootGDT:
|
||||
.quad 0
|
||||
.quad ((1<<47) + (1<<44) + (1<<41) + (1<<43) + (1<<53))
|
||||
.quad ((1<<47) + (1<<44) + (1<<41))
|
||||
BootGDTp:
|
||||
.short 3*8-1
|
||||
.quad offset BootGDT
|
Loading…
x
Reference in New Issue
Block a user