cr3 in context
This commit is contained in:
parent
85fef883d6
commit
1298e38ed8
3 changed files with 25 additions and 11 deletions
|
@ -224,7 +224,7 @@ impl ActivePageTable {
|
|||
use x86::controlregs;
|
||||
|
||||
{
|
||||
let backup = Frame::containing_address(PhysicalAddress::new(unsafe { controlregs::cr3() } as usize));
|
||||
let backup = Frame::containing_address(PhysicalAddress::new(unsafe { controlregs::cr3() as usize }));
|
||||
|
||||
// map temporary_page to current p4 table
|
||||
let p4_table = temporary_page.map_table_frame(backup.clone(), PRESENT | WRITABLE | NO_EXECUTE, self);
|
||||
|
@ -243,6 +243,11 @@ impl ActivePageTable {
|
|||
|
||||
temporary_page.unmap(self);
|
||||
}
|
||||
|
||||
pub unsafe fn address(&self) -> usize {
|
||||
use x86::controlregs;
|
||||
controlregs::cr3() as usize
|
||||
}
|
||||
}
|
||||
|
||||
pub struct InactivePageTable {
|
||||
|
@ -262,6 +267,10 @@ impl InactivePageTable {
|
|||
|
||||
InactivePageTable { p4_frame: frame }
|
||||
}
|
||||
|
||||
pub unsafe fn address(&self) -> usize {
|
||||
self.p4_frame.start_address().get()
|
||||
}
|
||||
}
|
||||
|
||||
/// A physical address.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue