aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTianhao Wang <shrik3@mailbox.org>2024-06-05 08:07:38 +0200
committerTianhao Wang <shrik3@mailbox.org>2024-06-11 15:17:13 +0200
commit4384c6fdfb48399fc7b82f4f5c14055fc57f7948 (patch)
treed4cc83cab9505a910870d1cca6eeb41ab79795b7
parent606d964887fd08803a4781a95d48dc5461a9eec5 (diff)
chore: add page fault test code
Signed-off-by: Tianhao Wang <shrik3@mailbox.org>
-rw-r--r--src/lib.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index e711688..fb68168 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,6 +1,5 @@
#![allow(dead_code)]
#![allow(unused_imports)]
-#![allow(unexpected_cfgs)]
#![no_std]
#![no_main]
#![feature(const_option)]
@@ -66,3 +65,11 @@ pub extern "C" fn _entry() -> ! {
}
}
}
+
+pub unsafe fn _test_pf() {
+ // try a page fault
+ use core::arch::asm;
+ use core::slice;
+ let name_buf = slice::from_raw_parts_mut(0xffffffffffff0000 as *mut u64, 10);
+ asm!("mov [rdi], rax", in("rdi") name_buf.as_mut_ptr());
+}