code wiki / _hdl_build / nx_virtio_scan_emit.nx
nx_virtio_scan_emit.nx
buildroot/runtime/_hdl_build/nx_virtio_scan_emit.nx
about
nx_virtio_scan_emit.nx -- emit a REAL RV64 guest (via nx_rv64_asm) that scans the 8 virtio-mmio slots on QEMU's
virt machine, reads each slot's MagicValue + DeviceID from live MMIO, and prints "<slot>:<deviceid>" over the
NS16550 UART, then halts via the SiFive finisher. Booted in qemu-system-riscv64 with real virtio devices attached,
this proves LIVE hardware discovery (device IDs read from actual QEMU virtio hardware) + validates the assembler.
Writes knowledge/hw/virtio_scan.bin. expect_exit:0 license_tier: ORIGINAL
dependencies 1 imports · 0 importers
imports: nx_rv64_asm.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
| 7 | const K_MAGIC_65536: i64 = 65536 |
functions
| 9 | func vs_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 10 | func vs_pn(v: i64) -> i64 { let b: *u8=sys_mmap(28); var x: i64=v; if x==0{b[0]=48;sys_write(1,b,1);return 0} var d: i64=0; var y: i64=x; while y>0{d=d+1;y=y/10} var i: i64=d-1; y=x; while i>=0{b[i]=(48+(y%10)) as u8;y=y/10;i=i-1} sys_write(1,b,d); return 0 } called by 1: main |
| 11 | func vs_hx(v: i64) -> i64 { vs_puts("0x" as *u8); let b: *u8=sys_mmap(16); var i: i64=7; var k: i64=0; while i>=0 { let nib: i64=(v>>(i*4))&15; if nib<10 { b[k]=(48+nib) as u8 } else { b[k]=(87+nib) as u8 } k=k+1; i=i-1 } sys_write(1,b,8); return 0 } |
| 13 | func main() -> i64 |