mirror of
https://github.com/genodelabs/genode.git
synced 2025-03-23 12:35:41 +00:00
hw_x86_64: Model cr2 register in CPU state
Make the cr2 control register accessible in the Cpu class. The register is needed to retrieve the linear address that caused a page fault.
This commit is contained in:
parent
466ad3aed4
commit
d553d38ecf
@ -64,6 +64,23 @@ class Genode::Cpu
|
||||
static constexpr addr_t exception_entry = 0x0; /* XXX */
|
||||
static constexpr addr_t mtc_size = 1 << 13;
|
||||
|
||||
/**
|
||||
* Control register 2: Page-fault linear address
|
||||
*
|
||||
* See Intel SDM Vol. 3A, section 2.5.
|
||||
*/
|
||||
struct Cr2 : Register<64>
|
||||
{
|
||||
struct Addr : Bitfield<0, 63> { };
|
||||
|
||||
static access_t read()
|
||||
{
|
||||
access_t v;
|
||||
asm volatile ("mov %%cr2, %0" : "=r" (v) :: );
|
||||
return v;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Control register 3: Page-Directory base register
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user