Skip to content

Commit

Permalink
add Cr2::read_raw
Browse files Browse the repository at this point in the history
  • Loading branch information
Freax13 committed Jan 16, 2022
1 parent bb82677 commit 4b525bb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/registers/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,12 @@ mod x86_64 {
/// Read the current page fault linear address from the CR2 register.
#[inline]
pub fn read() -> VirtAddr {
VirtAddr::new(Self::read_raw())
}

/// Read the current page fault linear address from the CR2 register.
#[inline]
pub fn read_raw() -> u64 {
let value: u64;

#[cfg(feature = "inline_asm")]
Expand All @@ -264,7 +270,7 @@ mod x86_64 {
value = crate::asm::x86_64_asm_read_cr2();
}

VirtAddr::new(value)
value
}
}

Expand Down

0 comments on commit 4b525bb

Please sign in to comment.