code wiki / (root) / nx_static_probe.nx

nx_static_probe.nx source

↩ module page · 23 lines · 467 B

1// nx_static_probe.nx -- isolate PE static-persistence. A cross-call static 2// counter bumped 4 times; exit code = its value. WSL (real ELF) must exit 4. 3// If the Windows PE exits 1, statics reset every call (the transfer-perf root). 4// 5// expect_exit: 4 6 7import "nx_syscalls.nx" 8 9static G_N: i64 10 11func bump() -> i64 { 12 G_N = G_N + 1 13 return G_N 14} 15 16func main() -> i64 { 17 bump() 18 bump() 19 bump() 20 let v: i64 = bump() 21 sys_exit(v) 22 return v 23}