1
0
mirror of https://github.com/taigrr/gopher-os synced 2025-01-18 04:43:13 -08:00
gopher-os/kernel/cpu/cpu_amd64.s
Achilleas Anagnostopoulos c5aa5fe05f Add method for reading the CR2 register value
This will allow us to figure out the virtual address that caused a page-
or general protection fault.
2017-06-21 21:36:59 +01:00

34 lines
482 B
ArmAsm

#include "textflag.h"
TEXT ·EnableInterrupts(SB),NOSPLIT,$0
STI
RET
TEXT ·DisableInterrupts(SB),NOSPLIT,$0
CLI
RET
TEXT ·Halt(SB),NOSPLIT,$0
CLI
HLT
RET
TEXT ·FlushTLBEntry(SB),NOSPLIT,$0
INVLPG virtAddr+0(FP)
RET
TEXT ·SwitchPDT(SB),NOSPLIT,$0
// loading CR3 also triggers a TLB flush
MOVQ pdtPhysAddr+0(FP), CR3
RET
TEXT ·ActivePDT(SB),NOSPLIT,$0
MOVQ CR3, AX
MOVQ AX, ret+0(FP)
RET
TEXT ·ReadCR2(SB),NOSPLIT,$0
MOVQ CR2, AX
MOVQ AX, ret+0(FP)
RET