mirror of
https://github.com/taigrr/gopher-os
synced 2025-01-18 04:43:13 -08:00
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.
This commit is contained in:
parent
9adde8f5c1
commit
c5aa5fe05f
@ -18,3 +18,6 @@ func SwitchPDT(pdtPhysAddr uintptr)
|
||||
|
||||
// ActivePDT returns the physical address of the currently active page table.
|
||||
func ActivePDT() uintptr
|
||||
|
||||
// ReadCR2 returns the value stored in the CR2 register.
|
||||
func ReadCR2() uint64
|
||||
|
@ -27,3 +27,7 @@ TEXT ·ActivePDT(SB),NOSPLIT,$0
|
||||
MOVQ AX, ret+0(FP)
|
||||
RET
|
||||
|
||||
TEXT ·ReadCR2(SB),NOSPLIT,$0
|
||||
MOVQ CR2, AX
|
||||
MOVQ AX, ret+0(FP)
|
||||
RET
|
||||
|
Loading…
x
Reference in New Issue
Block a user