code wiki / _hdl_build / _gpu_dxg_mapva_gate.nx
_gpu_dxg_mapva_gate.nx
buildroot/runtime/_hdl_build/_gpu_dxg_mapva_gate.nx
about
_gpu_dxg_mapva_gate.nx -- SOVEREIGN-GPU ladder R4e (map a real allocation to a GPU VIRTUAL ADDRESS on the 5080).
The keystone uniting R4c (paging queue + fence page) and R4d (allocation): LX_DXMAPGPUVIRTUALADDRESS assigns
the allocation a GPU virtual address (synchronously) and pages it in ASYNC -> completion is signaled when the
paging queue's monitored fence reaches the returned paging_fence_value. We WAIT by polling the kernel-mapped
fence page (R4c) -> proves the GPU actually completed the mapping.
ABI (header-derived, natural-aligned, recon-confirmed live): LX_DXMAPGPUVIRTUALADDRESS = 0xC068470C (size 104).
d3dddi_mapgpuvirtualaddress: paging_queue@0; base_address@8(=0 auto); minimum_address@16; maximum_address@24;
allocation@32; offset_in_pages@40; size_in_pages@48; protection@56 (write=bit0); driver_protection@64;
virtual_address@88 (OUT); paging_fence_value@96 (OUT). ret=259 = STATUS_PENDING (accepted, async).
GREEN iff (author=organ, from REAL device returns):
A) chain ok (device + paging queue [capture fence_cpu_va] + EXISTINGHEAP allocation);
B) MAP #1 ret==STATUS_PENDING(259) AND gpu_va != 0 AND paging_fence_value > fence-before;
C) the paging fence ADVANCES to paging_fence_value (poll the kernel fence page) = GPU completed the map;
D) MAP #2 ret pending AND gpu_va2 != 0 AND gpu_va2 != gpu_va1 (distinct real VAs) AND its fence also completes;
E) TAMPER: T1 bogus paging_queue(0xdeadbeef) -> negative errno; T2 bogus allocation -> negative; T3 non-dxg fd -> -ENOTTY.
Marker -> knowledge/status/gpu_dxg.log (DXGMAPGATE). raw syscalls only. NO-WAVE: assigns + pages-in a GPU VA
(real memory addressing); NO compute/throughput (that is R7). ZERO speedup claimed.
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
| 24 | const ENUM2_CODE: i64 = 0xC0104714 |
| 25 | const QAI_CODE: i64 = 0xC0184709 |
| 26 | const OAFL_CODE: i64 = 0xC00C4701 |
| 27 | const CDEV_CODE: i64 = 0xC0404702 |
| 28 | const CPQ_CODE: i64 = 0xC0204707 |
| 29 | const CALLOC_CODE: i64 = 0xC0484706 |
| 30 | const MAPVA_CODE: i64 = 0xC068470C |
| 31 | const STATUS_PENDING: i64 = 259 |
functions
| 33 | 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 } |
| 34 | 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 } |
| 35 | 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 } |
| 36 | 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 } |
| 37 | 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 } |
| 38 | func fn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;fp(fd,"-" as *u8)}; 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(fd,bb,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) } |
| 40 | func rd64(buf: *u8, off: i64) -> i64 { let q: *i64 = (buf as i64 + off) as *i64; return q[0] } |
| 41 | func setu32(buf: *u8, off: i64, val: i64) -> i64 { let w: *u8 = (buf as i64 + off) as *u8; w[0]=(val&0xff) as u8; w[1]=((val>>8)&0xff) as u8; w[2]=((val>>16)&0xff) as u8; w[3]=((val>>24)&0xff) as u8; return 0 } |
| 42 | func setu64(buf: *u8, off: i64, val: i64) -> i64 { let q: *i64 = (buf as i64 + off) as *i64; q[0]=val; return 0 } |
| 44 | func query_type(fd: i64, handle: i64, qtype: i64, psize: i64, outv: *i64) -> i64 |
| 52 | func open_from_luid(fd: i64, luid_lo: i64, luid_hi: i64, outh: *i64) -> i64 |
| 57 | func create_device(fd: i64, adapter: i64, outd: *i64) -> i64 |
| 62 | func create_pq(fd: i64, device: i64, outpq: *i64, outfva: *i64) -> i64 |
| 67 | func alloc_eh(fd: i64, device: i64, sysmem: *u8, outh: *i64) -> i64 |
| 78 | func map_va(fd: i64, pq: i64, alloc: i64, outva: *i64, outf: *i64) -> i64 |
| 86 | func wait_fence(fence_va: i64, target: i64) -> i64 called by 1: main |
| 93 | func main() -> i64 |