code wiki / _hdl_build / nx_gpu_dxg_probe.nx
nx_gpu_dxg_probe.nx
buildroot/runtime/_hdl_build/nx_gpu_dxg_probe.nx
about
nx_gpu_dxg_probe.nx -- SOVEREIGN-GPU foundation organ (R0): reach the REAL RTX 5080 through
its actual device interface, /dev/dxg (the WSL dxgkrnl GPU-paravirt thunk), with RAW syscalls
ONLY. NO libvulkan / libcuda / libdxcore / libd3d12 / libc -- the emitted elf links NOTHING.
Every byte here is open(2) / ioctl(2) / close(2) / write(2) directly via __syscall.
This is the productionized form of the recon _dxg_enum_probe: a reusable probe FUNCTION
(dxg_enumadapters) that the gate (_gpu_dxg_gate.nx) calls, plus a standalone main() so the
organ can be run on its own. It performs the MINIMAL real call -- LX_DXENUMADAPTERS2 -- and
reads back the REAL adapter count + adapter[0] handle + LUID from the 5080.
ABI (pinned from WSL2-Linux-Kernel linux-msft-wsl-6.6.y, include/uapi/misc/d3dkmthk.h;
CONFIRMED live: the kernel accepted exactly 0xC0104714 and returned ret=0, num_adapters=2):
#define LX_DXENUMADAPTERS2 _IOWR(0x47, 0x14, struct d3dkmt_enumadapters2)
= (dir _IOWR=3 <<30) | (size 16 <<16) | (magic 0x47 <<8) | (nr 0x14) = 0xC0104714
struct d3dkmt_enumadapters2 { __u32 num_adapters; __u32 reserved; __u64 *adapters; } // 16B
struct d3dkmt_adapterinfo { d3dkmthandle handle(4); winluid luid(8); u32 num_sources;
u32 present_move_regions_preferred; } // 20B
PROTOCOL: set num_adapters = capacity, adapters = ptr to an array of d3dkmt_adapterinfo; the
kernel writes the REAL count back into num_adapters and fills the array.
NO-FALSE-GREEN: the gate also issues a TAMPER (magic-0x99 ioctl) which the real device rejects
with a real errno (-ENOTTY=-25) != the real ret=0; that distinguishes a real device response
from a no-op. (The gate owns the verdict; this organ exposes the raw mechanism + a result
struct it can inspect.)
SCOPE (NO-WAVE): this rung proves ONLY "Nishi reaches the real RTX 5080 sovereignly via the
/dev/dxg last-mile". It claims NO throughput / speedup / exceed -- that is R7 (a real cuBLAS
head-to-head, many rungs up). Do NOT read a perf number out of this.
license_tier: ORIGINAL
dependencies 1 imports · 1 importers
imports: nx_syscalls.nx
imported by: _gpu_dxg_gate.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 31 | const DXG_MAGIC_4096: i64 = 4096 |
| 34 | const DXG_LX_DXENUMADAPTERS2: i64 = 0xC0104714 |
| 36 | const DXG_TAMPER_MAGIC: i64 = 0x99000000 |
| 46 | const DXR_FD: i64 = 0 |
| 47 | const DXR_IOCTL_RET: i64 = 8 |
| 48 | const DXR_NUM_ADAPTERS: i64 = 16 |
| 49 | const DXR_HANDLE0: i64 = 24 |
| 50 | const DXR_LUID_A: i64 = 32 |
| 51 | const DXR_LUID_B: i64 = 40 |
| 52 | const DXR_TAMPER_RET: i64 = 48 |
functions
| 54 | func dxr_set(res: *u8, off: i64, v: i64) -> i64 { let p: *i64 = (res as i64 + off) as *i64; p[0] = v; return 0 } called by 1: dxg_enumadapters |
| 55 | func dxr_get(res: *u8, off: i64) -> i64 { let p: *i64 = (res as i64 + off) as *i64; return p[0] } |
| 61 | func dxg_enumadapters(path: *u8, res: *u8) -> i64 |
| 102 | func gp_p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 103 | func gp_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 } |
| 104 | func gp_x(v: i64) -> i64 { gp_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 } |
| 106 | func main() -> i64 |