diff options
| author | Tianhao Wang <shrik3@mailbox.org> | 2024-06-05 08:07:38 +0200 |
|---|---|---|
| committer | Tianhao Wang <shrik3@mailbox.org> | 2024-06-11 15:17:13 +0200 |
| commit | 4384c6fdfb48399fc7b82f4f5c14055fc57f7948 (patch) | |
| tree | d4cc83cab9505a910870d1cca6eeb41ab79795b7 | |
| parent | 606d964887fd08803a4781a95d48dc5461a9eec5 (diff) | |
chore: add page fault test code
Signed-off-by: Tianhao Wang <shrik3@mailbox.org>
| -rw-r--r-- | src/lib.rs | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -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()); +} |
