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:
Reto Buerki 2015-03-12 09:20:30 +01:00 committed by Christian Helmuth
parent 466ad3aed4
commit d553d38ecf
1 changed files with 17 additions and 0 deletions

View File

@ -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
*