diff options
Diffstat (limited to 'bins/boom/src')
| -rw-r--r-- | bins/boom/src/main.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/bins/boom/src/main.rs b/bins/boom/src/main.rs new file mode 100644 index 0000000..0c3201b --- /dev/null +++ b/bins/boom/src/main.rs | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | //! boom — crash-containment probe (ADR 0006 Phase 2 gate). | ||
| 2 | //! | ||
| 3 | //! Deliberately faults on an unmapped address. The kernel must kill only | ||
| 4 | //! this task; the shell survives and `jobs` shows the corpse. | ||
| 5 | |||
| 6 | #![no_std] | ||
| 7 | #![no_main] | ||
| 8 | |||
| 9 | #[panic_handler] | ||
| 10 | fn panic(_info: &core::panic::PanicInfo) -> ! { | ||
| 11 | loop { | ||
| 12 | core::hint::spin_loop(); | ||
| 13 | } | ||
| 14 | } | ||
| 15 | |||
| 16 | /// The image entry point — the loader jumps here with the ABI arguments. | ||
| 17 | #[unsafe(no_mangle)] | ||
| 18 | pub extern "C" fn efi_main( | ||
| 19 | _exports: &'static rsapi::Exports, | ||
| 20 | _argc: usize, | ||
| 21 | _argv: *const rsapi::Arg, | ||
| 22 | ) -> i32 { | ||
| 23 | // Canonical-but-unmapped address (below 2^47, above any RAM/MMIO): | ||
| 24 | // the page walk terminates at a not-present entry → #PF with | ||
| 25 | // CR2 = address. Same trick as the built-in `fault` command. | ||
| 26 | unsafe { | ||
| 27 | let p = 0x4000_0000_0000usize as *mut u64; | ||
| 28 | p.write_volatile(0xDEAD_BEEF); | ||
| 29 | } | ||
| 30 | 0 | ||
| 31 | } | ||
