code wiki / (root) / nx_smoke_alloc_call.nx

nx_smoke_alloc_call.nx source

↩ module page · 27 lines · 662 B

1// smoke_alloc_call.nx -- nested sys_mmap inside a called function. 2 3// nx_safety_envelope: 4// intended_use: AUTO_APPLIED -- primitive-specific tuning queued 5// sil_target: SIL1 6// evidence: [bulk_applied_2026-05-16, see-file-comment-for-detail] 7// verdict: NOT_YET_EVALUATED 8 9import "nx_syscalls.nx" 10 11struct Box { 12 val: i64, 13} 14 15func make_box(v: i64) -> *Box { 16 let raw: *u8 = sys_mmap(16) 17 let b: *Box = raw as *Box 18 b.val = v 19 return b 20} 21 22func main() -> i64 { 23 let b1: *Box = make_box(20) 24 let b2: *Box = make_box(22) 25 let s: i64 = b1.val + b2.val 26 return __syscall(93, s, 0, 0, 0, 0, 0) 27}