code wiki / _hdl_build / nx_drv_bind.nx
nx_drv_bind.nx
buildroot/runtime/_hdl_build/nx_drv_bind.nx
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
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
structs
| none |
consts
| 21 | const NB_MAGIC_65536: i64 = 65536 |
| 22 | const NB_MAGIC_2048: i64 = 2048 |
| 24 | const NB_EMIT_ELF: *u8 = "_offc/nx_drv_proto_emit.elf" |
| 25 | const NB_SOV_ELF: *u8 = "_offc/nx_boot_run_sov.elf" |
| 26 | const NB_MAXDEV: i64 = 64 |
| 27 | const NB_MAXREG: i64 = 64 |
functions
| 29 | func 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 } |
| 30 | func 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 } |
| 31 | func 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 } |
| 32 | func nb_n(v: i64) -> i64 { nb_fn(1, v); return 0 } |
| 35 | func nb_itoa(v: i64, out: *u8) -> i64 |
| 47 | func nb_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 58 | func nb_parse_num(buf: *u8, p: i64, le: i64, endp: *i64) -> i64 called by 1: main |
| 89 | func nb_field_start(buf: *u8, ls: i64, le: i64, idx: i64) -> i64 called by 1: main |
| 105 | func nb_run(prog: *u8, a1: *u8, a2: *u8, a3: *u8, outpath: *u8) -> i64 |
| 130 | func nb_has(buf: *u8, n: i64, pat: *u8, pl: i64) -> i64 called by 1: main |
| 142 | func main(argc: i64, argv: *i64) -> i64 |