Skip to content

Commit 4b525bb

Browse files
committed
add Cr2::read_raw
1 parent bb82677 commit 4b525bb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/registers/control.rs

Lines changed: 7 additions & 1 deletion
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.
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)