code wiki / _hdl_build / nx_fw_robust_gate.nx

nx_fw_robust_gate.nx

buildroot/runtime/_hdl_build/nx_fw_robust_gate.nx

7505 B126 linesdepth 7pulls 9 transitivereach 0 importersview sourcekind gate/prooftopic fw
docsdependenciesstructsconstsfunctions

about

nx_fw_robust_gate.nx -- proves S-class never-brick holds in SUBOPTIMAL conditions. Fault-injects a crash at EVERY interruption point of the A/B + factory + atomic-commit flash and asserts rf_select() still returns a BOOTABLE image -- i.e. the device is never bricked no matter where power is lost; plus a teeth neg-control proving rf_select is honest when truly hopeless: T0 clean-commit : a clean flash commits the inactive bank -> FW_OK + selectable + active flipped F1 powerloss-mid-write : crash while writing the inactive bank -> HELD, active retained + selectable F2 powerloss-pre-commit: crash after verify, before the selector flip-> old bank selected + selectable F3 powerloss-at-commit : crash at/after the atomic selector flip -> new bank selected + selectable F4 double-fault : BOTH banks dead (e.g. bad flash + crash) -> immutable FACTORY + selectable F5 selector-lost : the selector itself is corrupt/missing -> default bank + selectable N1 truly-hopeless (teeth): banks AND factory all gone -> rf_select == null (NOT selectable) GREEN only if T0,F1,F2,F3,F4,F5 are selectable AND N1 is not. Evidence -> knowledge/status/fw_robust_gate.log. Sovereign: imports the robust-flash organ (-> nx_fw_safeflash -> nx_sha256) + nx_framed_append + nx_syscalls. license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_fw_robust_flash.nx nx_framed_append.nx nx_syscalls.nx nx_fw_robust_gate.nx

imports: nx_fw_robust_flash.nxnx_framed_append.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_now_realtime_sec sys_mmap sys_clock_gettime_real rg_len sys_mmap ↻ fw_path fw_cat fw_catn sys_mmap ↻ fw_make sys_mmap ↻ fw_wr_u32 sha256_digest sys_mmap ↻ sha256_init sys_mmap ↻ sha256_k sha256_update sha256_compress_ni_blocks blk_set_byte sha256_compress sha256_compress_ni blk_word blk_byte sha256_final blk_set_byte ↻ sha256_compress ↻ fw_write_bytes sys_openat_wr sys_write sys_close rf_write_sel_atomic fw_is_sandbox sys_mmap ↻ rf_tmp fw_cat ↻ fw_write_bytes ↻ sys_renameat rf_safe_flash

structs

none

consts

22const RG_LOG: *u8 = "knowledge/status/fw_robust_gate.log"
23const RG_FAC: *u8 = "FACTORY-immutable-recovery-anchor"
24const RG_GOOD: *u8 = "NISHI-fw-current-good-image"
25const RG_NEW: *u8 = "NISHI-fw-new-candidate-image"

functions

27func rg_len(s: *u8) -> i64 { var i: i64 = 0; while s[i] != 0 as u8 { i = i + 1 } return i }
called by 1: main
30func rg_garbage(path: *u8) -> i64
called by 1: main calls 2: sys_mmapfw_write_bytes
36func rg_row(name: *u8, pass: i64) -> i64
called by 1: main calls 2: sys_mmapfa_appendz
49func main() -> i64