nx_panic_fire_test.nx source
↩ module page · 28 lines · 702 B
1// nx_panic_fire_test.nx -- exercise nx_panic_ctx's fail path.
2//
3// Expected exit: 200 (NX_PANIC_EXIT). The panic should dump a
4// full post-mortem (FATAL log + ctx header + hex dump of 16 bytes)
5// before exiting.
6
7import "syscalls.nx"
8import "nx_panic.nx"
9
10func main() -> i64 {
11 let buf: *u8 = sys_mmap(16)
12 buf[0] = 0x4E
13 buf[1] = 0x49
14 buf[2] = 0x53
15 buf[3] = 0x48
16 buf[4] = 0x49
17 buf[5] = 0x2D
18 buf[6] = 0x43
19 buf[7] = 0x52
20 buf[8] = 0x41
21 buf[9] = 0x53
22 buf[10] = 0x48
23 buf[11] = 0x00
24 nx_panic_ctx("test" as *u8, "intentional fatal" as *u8,
25 "demo-buffer" as *u8, buf, 12)
26 // unreachable
27 return 0
28}