code wiki / _hdl_build / _gpu_dxg_r1_recon3.nx
_gpu_dxg_r1_recon3.nx
buildroot/runtime/_hdl_build/_gpu_dxg_r1_recon3.nx
about
_gpu_dxg_r1_recon3.nx -- R1 recon pass 3. Pass 2 proved QueryAdapterInfo(nr=0x09) returns
-EINVAL for EVERY type/size AND for a bogus handle -- i.e. the ENUM handle (0x40000000) is NOT a
queryable adapter handle in WSL dxgkrnl. The fix (per WSL2 dxgkrnl): get a real per-process
adapter handle via LX_DXOPENADAPTERFROMLUID, then QueryAdapterInfo on THAT handle.
struct d3dkmt_openadapterfromluid { winluid adapter_luid(8); d3dkmthandle adapter_handle(4 OUT); }
= 12 bytes -> code = _IOWR(0x47, nr, 12) = (3<<30)|(12<<16)|(0x47<<8)|nr = 0xC00C4700|nr.
We sweep nr to find the accepted one (ret==0), read the OUT handle, then QueryAdapterInfo type=8.
Also try LX_DXCLOSEADAPTER cleanup is omitted (recon).
AUTHOR=ORGAN / NO-WAVE / raw syscalls only. 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
| 13 | const DXG_LX_DXENUMADAPTERS2: i64 = 0xC0104714 |
| 14 | const QAI_CODE: i64 = 0xC0184709 // QueryAdapterInfo, 24-byte struct, pinned live |
functions
| 16 | 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 } |
| 17 | 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 } |
| 18 | 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 } |
| 20 | func print_utf16(base: *u8, off: i64) -> i64 |
| 31 | func query(fd: i64, handle: i64, qtype: i64, priv: *u8, psize: i64) -> i64 |
| 43 | func open_from_luid(fd: i64, nr: i64, structsz: i64, la: i64, lb: i64, out_h: *i64, out_ret: *i64) -> i64 |
| 57 | func main() -> i64 |