code wiki / _hdl_build / _gpu_dxg_context_gate.nx
_gpu_dxg_context_gate.nx
buildroot/runtime/_hdl_build/_gpu_dxg_context_gate.nx
about
_gpu_dxg_context_gate.nx -- SOVEREIGN-GPU ladder R4a (create a GPU CONTEXT on the 5080 WDDM device).
R3 made a real WDDM device. The command-submission arc (R4) begins with a CONTEXT -- the queue GPU
work is submitted on. The WSL2 paravirt path exposes LX_DXCREATECONTEXTVIRTUAL (nr=0x04), NOT plain
CREATECONTEXT (nr=0x03 -> -ENOTTY on this kernel, recon-confirmed). This rung opens the context only;
allocations (R4b) + command buffer/submit/fence (R4c) follow.
ABI (recon-pinned LIVE, _gpu_dxg_r4_recon: no uapi header -> size-swept, only _IOC_SIZE=40 recognized;
OUT context handle located by write-back scan):
LX_DXCREATECONTEXTVIRTUAL = _IOWR(0x47, 0x04, 40) = 0xC0284704
struct d3dkmt_createcontextvirtual (40B): device @0 (in); node_ordinal @4; engine_affinity @8;
client_hint @12; priv_drv_data @16 (u64 ptr, NULL ok); priv_drv_data_size @24; **context @32 (OUT)**.
GREEN iff (author=organ, from REAL device returns):
A) device-create chain ok (enum/discrete/open-adapter/create-device all ret==0);
B) CREATECONTEXTVIRTUAL #1 ret==0 AND context1 != 0 (written into a pre-zeroed slot @32);
C) CREATECONTEXTVIRTUAL #2 ret==0 AND context2 != 0 AND context2 != context1 (per-call allocation);
D) TAMPER: T1 bogus device(0xdeadbeef) -> ret!=0 AND no context written; T2 wrong _IOC_SIZE(32) -> -ENOTTY;
T3 on a non-dxg fd -> -ENOTTY.
(Context handles share the per-process namespace with devices -> we never test cross-namespace numeric
inequality; only write-back + per-call distinctness + tamper.) fd close releases all handles.
Marker -> knowledge/status/gpu_dxg.log (DXGCTXGATE). raw syscalls only. NO-WAVE: context-create only, ZERO throughput.
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
| 26 | const ENUM2_CODE: i64 = 0xC0104714 |
| 27 | const QAI_CODE: i64 = 0xC0184709 |
| 28 | const OAFL_CODE: i64 = 0xC00C4701 |
| 29 | const CDEV_CODE: i64 = 0xC0404702 // LX_DXCREATEDEVICE (R3) |
| 30 | const CCV_CODE: i64 = 0xC0284704 // LX_DXCREATECONTEXTVIRTUAL (_IOWR(0x47,0x04,40), recon-pinned) |
| 31 | const CCV_BADSZ: i64 = 0xC0204704 // wrong _IOC_SIZE=32 -> -ENOTTY tamper |
| 32 | const CTX_OFF: i64 = 32 // OUT context-handle offset within the 40B struct |
functions
| 34 | 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 } |
| 35 | func 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 } |
| 36 | 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 } |
| 37 | 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 } |
| 38 | func 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 } |
| 39 | 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) } |
| 41 | func query_type(fd: i64, handle: i64, qtype: i64, psize: i64, outv: *i64) -> i64 |
| 49 | func open_from_luid(fd: i64, luid_lo: i64, luid_hi: i64, outh: *i64) -> i64 |
| 54 | func create_device(fd: i64, adapter: i64, outd: *i64) -> i64 |
| 60 | func create_context(fd: i64, code: i64, device: i64, outc: *i64) -> i64 |
| 67 | func main() -> i64 |