1
0
Fork 0
mirror of https://github.com/hermitcore/libhermit.git synced 2025-03-09 00:00:03 +01:00

reset registers to kill any stale realmode selectors

This commit is contained in:
Stefan Lankes 2015-09-02 14:44:45 +02:00
parent 1f2e2ac657
commit 5958eeff36

View file

@ -77,7 +77,7 @@ boot_pdpt:
times 510 DQ 0 ; PAGE_MAP_ENTRIES - 2
DQ boot_pml4 + 0x203 ; PG_PRESENT | PG_RW | PG_SELF (self-reference)
boot_pgd:
DQ boot_pgt + 0x3 ; PG_PRESENT | PG_RW
DQ boot_pgt + 0x3 ; PG_PRESENT | PG_RW
times 510 DQ 0 ; PAGE_MAP_ENTRIES - 2
DQ boot_pml4 + 0x203 ; PG_PRESENT | PG_RW | PG_SELF (self-reference)
boot_pgt:
@ -86,6 +86,14 @@ boot_pgt:
SECTION .text
align 4
start64:
; reset registers to kill any stale realmode selectors
xor eax, eax
mov ds, eax
mov ss, eax
mov es, eax
mov fs, eax
mov gs, eax
mov eax, DWORD [cpu_online]
cmp eax, 0
jne Lno_pml4_init
@ -485,7 +493,7 @@ common_stub:
push r15
; push fs and gs registers
global Lpatch1
Lpatch1:
Lpatch1:
jmp short Lrdfsgs2 ; we patch later this jump to enable rdfsbase/rdgsbase
rdfsbase rax
rdgsbase rdx