code wiki / _hdl_build / nx_emu_x86_boot_test.nx
nx_emu_x86_boot_test.nx
buildroot/runtime/_hdl_build/nx_emu_x86_boot_test.nx
about
nx_emu_x86_boot_test.nx -- the x86 analog of the rv64 boot: author a tiny x86-64 "boot stub" that
WRITES a serial line then exits, and run it on the sovereign x86 interpreter (now write-capable).
Proves x86 machine code EXECUTES + OUTPUTS on Nishi's own x86 model (no qemu).
HONEST SCOPE: this is instruction-level x86 (the emu does register-direct + write/exit). A real
bootable x86 USB (real-mode->protected->long-mode, IDT/paging/devices, a bootloader, USB) is a
LARGE arc beyond this; the mature full-system boot path is rv64 (nx_boot_run_sov). This rung just
closes "x86 can output", the first step. No hardware writes (Rule 26). expect_exit: 0 license_tier: ORIGINAL
dependencies 1 imports · 0 importers
imports: nx_emu_x86.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
| none |
functions
| 10 | func bx_put_b(code: *u8, o: i64, byte: i64) -> i64 { code[o] = (byte & 0xff) as u8; return o+1 } called by 1: main |
| 11 | func bx_put_i32(code: *u8, o: i64, v: i64) -> i64 { code[o]=(v & 0xff) as u8; code[o+1]=((v>>8) & 0xff) as u8; code[o+2]=((v>>16) & 0xff) as u8; code[o+3]=((v>>24) & 0xff) as u8; return o+4 } called by 1: main |
| 12 | func bx_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 1: main |
| 13 | func bx_num(v: i64) -> i64 { let b: *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 as u8;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{b[i]=t[k-1-i];i=i+1} sys_write(1,b,k); return 0 } called by 1: main |
| 15 | func main() -> i64 |