code wiki / _hdl_build / nx_virtio_scan_emit.nx

nx_virtio_scan_emit.nx

buildroot/runtime/_hdl_build/nx_virtio_scan_emit.nx

3183 B30 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

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

nx_rv64_asm.nx nx_virtio_scan_emit.nx

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

main vs_puts rvasm_assemble_str rvasm_assemble sys_mmap ra_isws ra_encode sys_mmap ↻ ra_afterword ra_isws ↻ ra_word_is ra_isws ↻ ra_reg ra_skipsep ra_isws ↻ ra_num ra_isdig ra_imm ra_skipsep ↻ ra_ishex ra_isdig ↻ ra_hexval ra_isdig ↻ ra_u ra_imm12 ra_i ra_sh6 ra_r ra_past ra_s ra_label_target ra_skipsep ↻ ra_afterword ↻ ra_find_label ra_b ra_j ra_put vs_pn vs_hx vs_puts ↻

structs

none

consts

7const K_MAGIC_65536: i64 = 65536

functions

9func 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 }
called by 2: vs_hxmain
10func 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
11func 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 }
called by 1: main calls 1: vs_puts
13func main() -> i64