code wiki / _hdl_build / _gpu_deploy_pcienum.nx

_gpu_deploy_pcienum.nx

buildroot/runtime/_hdl_build/_gpu_deploy_pcienum.nx

7450 B96 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic gpu
docsdependenciesstructsconstsfunctions

about

_gpu_deploy_pcienum.nx -- BARE-METAL DEPLOYMENT KIT rung BM-DEPLOY-1: REAL PCI enumeration via /proc/bus/pci/devices. The deployment kit's pci-find -- the SAME identify logic as BM-GPU-2 but fed by the REAL guest PCI bus (procfs), not a model. /proc/bus/pci/devices is a flat hex table: field0=bus<<8|devfn, field1=vendor<<16|device, field2=irq, field3=BAR0(resource start), ... On native Linux booting the box this finds the real NVIDIA 0x10DE 5080; in this WSL guest the GPU is paravirt (Microsoft 0x1414 bound to dxgkrnl), so the real NVIDIA is correctly ABSENT here. GREEN iff: (A) real procfs parsed, >=2 devices enumerated; (B) the Microsoft GPU-PV device (vendor 0x1414) is found = real entries parsed correctly; (C) NVIDIA (0x10DE) correctly ABSENT on this paravirt guest (the WSL truth, no false-positive on virtio 0x1AF4); (D) POSITIVE CONTROL: the SAME find logic on a synthetic 0x10DE line returns PRESENT (= the kit WILL identify the 5080 on native Linux). Marker -> knowledge/status/gpu_baremetal.log (BMDEPLOYPCI). license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx _gpu_deploy_pcienum.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 p sys_write sys_openat_rd sys_exit sys_mmap sys_read sys_close n sys_mmap ↻ sys_write ↻ parse_pci hexval x p ↻ sys_mmap ↻ sys_write ↻ sys_openat_append fp sys_write ↻ fx sys_mmap ↻ fp ↻ sys_write ↻

structs

none

consts

none

functions

15func p(s: *u8) -> i64 { var nn: i64=0; while s[nn]!=(0 as u8){nn=nn+1} sys_write(1,s,nn); return 0 }
called by 2: xmain calls 1: sys_write
16func fp(fd: i64, s: *u8) -> i64 { var nn: i64=0; while s[nn]!=(0 as u8){nn=nn+1} sys_write(fd,s,nn); return 0 }
called by 2: fxmain calls 1: sys_write
17func n(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" 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(1,bb,k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
18func x(v: i64) -> i64 { p("0x" as *u8); let bb:*u8=sys_mmap(20); var k:i64=0; var m:i64=v; if m==0{bb[0]=48;k=1}; while m>0{ let d:i64=m&15; if d<10{bb[k]=(48+d) as u8}else{bb[k]=(87+d) as u8}; m=(m>>4); k=k+1 } var i:i64=0; let o:*u8=sys_mmap(20); while i<k{o[i]=bb[k-1-i];i=i+1} sys_write(1,o,k); return 0 }
called by 1: main calls 3: psys_mmapsys_write
19func fx(fd: i64, v: i64) -> i64 { let bb:*u8=sys_mmap(20); var k:i64=0; var m:i64=v; if m==0{bb[0]=48;k=1}; while m>0{ let d:i64=m&15; if d<10{bb[k]=(48+d) as u8}else{bb[k]=(87+d) as u8}; m=(m>>4); k=k+1 } let o:*u8=sys_mmap(20); var i:i64=0; while i<k{o[i]=bb[k-1-i];i=i+1} fp(fd,"0x" as *u8); sys_write(fd,o,k); return 0 }
called by 1: main calls 3: sys_mmapfpsys_write
20func hexval(c: i64) -> i64 { if c>=48 { if c<=57 { return c-48 } } if c>=97 { if c<=102 { return c-87 } } if c>=65 { if c<=70 { return c-55 } } return 0 - 1 }
called by 1: parse_pci
24func parse_pci(buf: *u8, len: i64, out: *i64) -> i64
called by 1: main calls 1: hexval
56func main() -> i64