Skip to content

Commit 5014113

Browse files
authored
Merge pull request #334 from Freax13/cr2-read-raw
add `Cr2::read_raw`
2 parents bb82677 + 38537d1 commit 5014113

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/registers/control.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,12 @@ mod x86_64 {
253253
/// Read the current page fault linear address from the CR2 register.
254254
#[inline]
255255
pub fn read() -> VirtAddr {
256+
VirtAddr::new(Self::read_raw())
257+
}
258+
259+
/// Read the current page fault linear address from the CR2 register as a raw `u64`.
260+
#[inline]
261+
pub fn read_raw() -> u64 {
256262
let value: u64;
257263

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

267-
VirtAddr::new(value)
273+
value
268274
}
269275
}
270276

0 commit comments

Comments
 (0)