code wiki / _hdl_build / nx_drv_bind.nx

nx_drv_bind.nx

buildroot/runtime/_hdl_build/nx_drv_bind.nx

14136 B279 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic drv
docsdependenciesstructsconstsfunctions

about

nx_drv_bind.nx -- AUTONOMOUS DRIVER BRING-UP (X-DRV-W2), the driver registry binder. Composes X-DRV-W0 (HWMAP probe) + X-DRV-W1 (driver-protocol-from-spec emit) into a hands-off loop that brings up ANY iron with NO per-device code: PROBE -- read the device manifest (emu_devmap.tsv = the emu's MMIO bus probe output, the analog of hwmap.tsv for PCI): each row = (base, DeviceID). LOOK UP -- for each device, find its DeviceID in driver_registry.tsv -> a driver SPEC (an X-DRV-W1 op-list). Unknown DeviceID -> UNBOUND (honest: no driver for that iron, never a false bind). EMIT -- run nx_drv_proto_emit <spec> <probed-base> <out> : the SAME spec is BOUND to the address the probe found (the base override) -> bring up the device wherever it is. RUN -- run the emitted driver on the SOVEREIGN rv64 emu; if the serial contains the driver's golden + a clean halt, the device is BOUND + WORKING. A NEW device class = a NEW registry row + a NEW op-list spec; THIS organ and the emitter never change. Evidence -> knowledge/status/driver_bind.log. argv[1]=devmap path (default emu_devmap.tsv), argv[2]=registry path (default driver_registry.tsv) -- scratch lanes for the gate's adversarial manifests. Sovereign (fork/dup3/execve/wait4), no gcc/.sh. license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_drv_bind.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main nb_p sys_write sys_openat_append sys_mmap nb_read sys_openat_rd sys_read sys_close nb_fp sys_write ↻ sys_close ↻ sys_exit nb_field_start nb_parse_num nb_n nb_fn sys_mmap ↻ sys_write ↻ nb_fn ↻ nb_itoa sys_mmap ↻ nb_run sys_fork sys_openat_wr sys_dup3 sys_mmap ↻ sys_execve sys_exit ↻ sys_wait4 nb_has sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real

structs

none

consts

21const NB_MAGIC_65536: i64 = 65536
22const NB_MAGIC_2048: i64 = 2048
24const NB_EMIT_ELF: *u8 = "_offc/nx_drv_proto_emit.elf"
25const NB_SOV_ELF: *u8 = "_offc/nx_boot_run_sov.elf"
26const NB_MAXDEV: i64 = 64
27const NB_MAXREG: i64 = 64

functions

29func nb_p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main calls 1: sys_write
30func nb_fp(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 calls 1: sys_write
31func nb_fn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m}; 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 2: nb_nmain calls 2: sys_mmapsys_write
32func nb_n(v: i64) -> i64 { nb_fn(1, v); return 0 }
called by 1: main calls 1: nb_fn
35func nb_itoa(v: i64, out: *u8) -> i64
called by 1: main calls 1: sys_mmap
47func nb_read(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
58func nb_parse_num(buf: *u8, p: i64, le: i64, endp: *i64) -> i64
called by 1: main
89func nb_field_start(buf: *u8, ls: i64, le: i64, idx: i64) -> i64
called by 1: main
105func nb_run(prog: *u8, a1: *u8, a2: *u8, a3: *u8, outpath: *u8) -> i64
130func nb_has(buf: *u8, n: i64, pat: *u8, pl: i64) -> i64
called by 1: main
142func main(argc: i64, argv: *i64) -> i64