nx_xor_arena.nx
buildroot/runtime/nx_xor_arena.nx
about
nx_xor_arena.nx -- demo of the arena-based architecture-neutral
library pattern that resolves F5 (cross-architecture library +
orchestrator collision) per docs/NISHI_LANG_FRICTION_CATALOG.md.
Why this exists: F5 demonstrated that crypto libraries
importing `nx_syscalls.nx` for sys_mmap become RV64-pinned,
preventing composition with x86_64 socket smokes. The
CANONICAL RESOLUTION is the arena pattern shipped in
`nx_arena_types.nx` (zero-syscall, caller-owned buffers per
cardinal user-owns-every-bit). This module is a tiny working
proof: a library that does real work (XOR two buffers,
allocate the output via arena) WITHOUT importing any syscall
file. The orchestrator provides the arena's backing buffer
using whichever architecture's syscall layer matches the
target.
What this proves:
- Library is architecture-neutral (no syscall import).
- Library composes cleanly with x86_64 socket code in one
compilation unit (see bench/nx_arena_x86_64_compose_smoke.nx).
- Library equally composes with RV64 + qemu (caller swaps
the syscall layer for the arena backing buffer; library
code is unchanged).
The crypto-stack refactor to follow this pattern (nx_x25519 +
nx_chacha20 + nx_poly1305 + nx_sha256 etc. taking *NxArena
instead of calling sys_mmap directly) is a 5-10 turn arc.
This module documents the target pattern + provides a proof-
of-correctness for the cross-architecture compose so the
refactor has a concrete checkpoint to validate against.
nx_capability_claims:
needs: [arena_alloc, pointer_arithmetic]
provides: [xor_buf_arena]
safety: [no_syscall, no_floating_point, target_agnostic,
bit_equal_reproducible]
verdict: [no_silent_failure (arena oom returns null)]
license: ORIGINAL
kind: racing_crew_specialist
dependencies 1 imports · 0 importers
imports: nx_arena_types.nx
imported by: nobody (leaf or entry point)
structs
| none |
consts
| none |
functions
| 54 | func xor_buf_arena(a: *NxArena, x: *u8, y: *u8, n: i64) -> *u8 calls 1: nx_arena_alloc |