code wiki / _hdl_build / nx_kernel_adoption.nx

nx_kernel_adoption.nx

buildroot/runtime/_hdl_build/nx_kernel_adoption.nx

14040 B264 linesdepth 6pulls 18 transitivereach 0 importersview sourcekind tooltopic kernel
docsdependenciesstructsconstsfunctions

about

nx_kernel_adoption.nx -- THE SECOND AXIS: does the feature actually RUN in the live boot? WHY (a measured ruler defect, debt idx 2071): nx_kernel_census computes PRESENT with re_has() substring probes over the CONCATENATED gate logs. A feature proven ONCE by a standalone fixture binary therefore scores IDENTICALLY to a feature wired into the image the pinned BOOTSOV actually boots. Measured 2026-07-31: the census read 382 permil BEFORE and 382 permil AFTER the live boot went from a 72-byte banner exercising ZERO features to a 1480-byte kernel exercising ELEVEN of its eighteen -- the ruler scored the adoption gap as exactly zero movement. A RULER THAT CANNOT DISTINGUISH PROVEN-IN-ISOLATION FROM WIRED-AT-THE-CHOKEPOINT WILL ALWAYS SCORE THE ADOPTION GAP AS ZERO, and this census is the instrument meant to catch it. WHAT THIS DOES: boots the LIVE image in-process (the artifact itself, not a log ABOUT it), captures the serial transcript, and scores every incumbent feature on TWO axes -- evidence : re_has() over the gate logs (what the census already measured) live : its marker appears in the transcript (what the census could not see) Headline = MIN(evidence, live), never the mean and never the max, per the min-not-mean law. ADOPTION GAP = features with evidence but NOT live -- the number the census could not report. Data-driven: the feature->marker table is knowledge/registry/kernel_live_markers.tsv, never hardcoded; a feature with no row there is NOT live, which is the honest default. Self-validating: a positive control must be live, a synthetic marker must NOT be. license_tier: ORIGINAL Shared boot-and-capture: this organ, the gate and the census must agree byte-for-byte on what booting the image means, or the rulers can disagree about the same artifact.

dependencies 2 imports · 0 importers

nx_bootcap.nx nx_research_extract.nx nx_kernel_adoption.nx

imports: nx_bootcap.nxnx_research_extract.nx

imported by: nobody (leaf or entry point)

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

main sys_read_file sys_openat_rd sys_lseek sys_mmap sys_read sys_close ka_w ka_boot bootcap_run nx_rv64im_rf_init nx_rv64im_csr_init nx_clint_init nx_uart_init nx_virtio_init nx_virtio_reset_storage nx_virtio_init_net nx_virtio_reset_storage ↻ nx_nvme_init nx_nvme_reset_storage nx_nndev_init nx_nndev_reset nx_mmu_init nx_mmu_reset nx_rv64im_sim_init nx_rv64im_sim_attach_virti nx_rv64im_sim_attach_virti nx_rv64im_sim_attach_nvme nx_rv64im_sim_attach_nndev nx_rv64im_sim_attach_mmu nx_rv64im_sim_run nx_rv64im_sim_step nx_clint_tick nx_clint_update_mtip nx_rv64im_csr_tick_mcycle nx_clint_mtip_get nx_rv64im_csr_read nx_csr_addr_to_slot nx_rv64im_sim_take_trap nx_rv64im_csr_read ↻

structs

none

consts

26const KA_MAGIC_2000000: i64 = 2000000
27const KA_MAGIC_80000: i64 = 80000
28const KA_MAGIC_40000: i64 = 40000
29const KA_MAGIC_300000: i64 = 300000
31const KA_REF: *u8 = "knowledge/registry/kernel_incumbent_ref.tsv"
32const KA_MARKERS: *u8 = "knowledge/registry/kernel_live_markers.tsv"
33const KA_OUT: *u8 = "knowledge/registry/kernel_adoption.tsv"
34const KA_LOG: *u8 = "knowledge/status/kernel_adoption.log"
35const KA_BIN: *u8 = "runtime/_hdl_build/_boot_nishi_virt.bin"
36const KA_BIN_ALT: *u8 = "_boot_nishi_virt.bin"
37const KA_MAXF: i64 = 256
39const KA_E0: *u8 = "knowledge/status/boot_stub.log"
40const KA_E1: *u8 = "knowledge/status/trap_syscall.log"
41const KA_E2: *u8 = "knowledge/status/virtio_blk.log"
42const KA_E3: *u8 = "knowledge/status/virtio_net.log"
43const KA_E4: *u8 = "knowledge/status/hwmap.log"
44const KA_E5: *u8 = "knowledge/status/timer_irq.log"
45const KA_E6: *u8 = "knowledge/status/sched.log"
46const KA_E7: *u8 = "knowledge/status/memalloc.log"
47const KA_E8: *u8 = "knowledge/status/coopsched.log"
48const KA_E9: *u8 = "knowledge/status/driver_spec.log"
49const KA_E10: *u8 = "knowledge/status/driver_bind.log"
50const KA_E11: *u8 = "knowledge/status/nndev.log"
51const KA_E12: *u8 = "knowledge/status/mmu.log"
52const KA_E13: *u8 = "knowledge/status/priv.log"
54const KA_MEM_BASE: i64 = 0x80000000
55const KA_MEM_SIZE: i64 = 65536
56const KA_TX_CAP: i64 = 4096
57const KA_MAX_STEPS: i64 = 100000

functions

59func ka_w(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 }
called by 1: main
60func ka_n(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m; sys_write(fd,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(fd,bb,k); return 0 }
called by 1: main
62func ka_read_into(path: *u8, buf: *u8, off: i64, cap: i64) -> i64
called by 1: main calls 1: sys_read
75func ka_scan_to(buf: *u8, n: i64, start: i64, delim: i64) -> i64
called by 1: main
81func ka_streq(a: *u8, b: *u8) -> i64
called by 1: main
87func ka_app(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { dst[off+i] = s[i]; i = i + 1 } return off + i }
called by 1: main
91func ka_boot(img: *u8, ilen: i64, tx_buf: *u8) -> i64
called by 1: main calls 1: bootcap_run
99func main(argc: i64, argv: *i64) -> i64