code wiki / _hdl_build / _gpu_dxg_r3_recon.nx
_gpu_dxg_r3_recon.nx
buildroot/runtime/_hdl_build/_gpu_dxg_r3_recon.nx
about
_gpu_dxg_r3_recon.nx -- SOVEREIGN-GPU ladder R3 RECON (create a WDDM device on the RTX 5080).
R2 opened a per-adapter kernel handle from the discrete LUID via LX_DXOPENADAPTERFROMLUID. R3 feeds
that adapter handle to LX_DXCREATEDEVICE (_IOWR(0x47,0x02,...)) to obtain a real WDDM DEVICE handle --
the object that GPU command submission (R4+) hangs off of.
The WSL2 kernel ships no uapi header, so this RECON discovers the ABI live (rule: trust runtime):
(1) SIZE: _IOC_SIZE is encoded in the ioctl code. dxgkrnl dispatches on _IOC_NR=0x02 but rejects a
wrong _IOC_SIZE (-EINVAL) vs an unknown nr (-ENOTTY). So we sweep candidate sizes for nr=0x02
with the real adapter handle at offset 0 and watch for ret==0 -> that size is the real sizeof.
(2) DEVICE-HANDLE OFFSET: on the successful call, dxgkrnl writes the OUT device handle back into the
struct. dxgkrnl hands out handles in the 0x4000xxxx space (R0/R2 adapter handles were
0x40000000/0x80/0xc0), so we scan the returned buffer for a fresh 0x4000xxxx value != the adapter
handle -> that 4-byte slot is `device`. Prints size + offset + value so the gate can pin them.
raw syscalls only (no libvulkan/cuda/dxcore/libc). Writes NOTHING to the status log. 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
| 18 | const ENUM2_CODE: i64 = 0xC0104714 // LX_DXENUMADAPTERS2 |
| 19 | const QAI_CODE: i64 = 0xC0184709 // LX_DXQUERYADAPTERINFO (ADAPTERTYPE) |
| 20 | const OAFL_CODE: i64 = 0xC00C4701 // LX_DXOPENADAPTERFROMLUID |
functions
| 22 | func p(s: *u8) -> i64 { var nn: i64=0; while s[nn]!=(0 as u8){nn=nn+1} sys_write(1,s,nn); return 0 } |
| 23 | func 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 } |
| 24 | func 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 } |
| 27 | func iowr(nr: i64, size: i64) -> i64 { return (3 << 30) | ((size & 0x3fff) << 16) | (0x47 << 8) | (nr & 0xff) } called by 1: main |
| 29 | func query_type(fd: i64, handle: i64, qtype: i64, psize: i64, outv: *i64) -> i64 |
| 39 | func open_from_luid(fd: i64, luid_lo: i64, luid_hi: i64, outh: *i64) -> i64 |
| 47 | func rd32(buf: *u8, off: i64) -> i64 { return (buf[off] as i64)|((buf[off+1] as i64)<<8)|((buf[off+2] as i64)<<16)|((buf[off+3] as i64)<<24) } called by 1: main |
| 49 | func main() -> i64 |