code wiki / _hdl_build / nx_emu_x86_boot_kernel_test.nx

nx_emu_x86_boot_kernel_test.nx

buildroot/runtime/_hdl_build/nx_emu_x86_boot_kernel_test.nx

6269 B101 linesdepth 4pulls 4 transitivereach 0 importersview sourcekind gate/prooftopic emu
docsdependenciesstructsconstsfunctions

about

nx_emu_x86_boot_kernel_test.nx -- x86 full-system ladder R8: an x86 KERNEL BOOTS END-TO-END. A UNIFIED emu (R1-R4 decode + R5-2 CR0/mode machinery + R7 UART-over-OUT) runs an authored x86 "kernel" that: prints a banner over the 16550 UART (out dx,al @ 0x3F8), sets CR0.PE to ENTER PROTECTED MODE, prints again, and exits. The emu collects the serial output and tracks the mode. This is the x86 twin of the rv64 NishiOS boot (which emitted "NISHI"). KAT: serial == "NISHIOS:PROTECTED" AND the cpu reached protected mode. HONEST SCOPE: integrates decode+mode+UART; folding the R6 page-walk into the emu's mem access + a real multi-stage kernel + R9 bootloader/USB image + R10 hardware remain. No hardware writes (Rule 26). expect_exit: 0 license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_emu_x86_k.nx nx_emu_x86_boot_kernel_test.nx

imports: nx_emu_x86_k.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main bk_puts bk_b bk_i32 bk_emit_str bk_b ↻ bk_i32 ↻ emu_x86_boot bk_mode k_i32 bk_num bk_beq

structs

none

consts

none

functions

12func bk_b(c: *u8, o: i64, b: i64) -> i64 { c[o]=(b & 0xff) as u8; return o+1 }
called by 2: bk_emit_strmain
13func bk_i32(c: *u8, o: i64, v: i64) -> i64 { c[o]=(v&0xff) as u8; c[o+1]=((v>>8)&0xff) as u8; c[o+2]=((v>>16)&0xff) as u8; c[o+3]=((v>>24)&0xff) as u8; return o+4 }
called by 2: bk_emit_strmain
14func bk_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
15func bk_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
16func bk_beq(a: *u8, b: *u8, n: i64) -> i64 { var i: i64=0; while i<n { if a[i]!=b[i] { return 0 } i=i+1 } return 1 }
called by 1: main
17func bk_mode(cr0: i64, efer: i64) -> i64 { let pe: i64=cr0&1; let pg: i64=(cr0>>31)&1; let lme: i64=(efer>>8)&1; if pe==0 { return 0 } if pg==1 { if lme==1 { return 2 } } return 1 }
called by 1: emu_x86_boot
20func bk_emit_str(c: *u8, o: i64, s: *u8) -> i64
called by 1: main calls 2: bk_bbk_i32
31func emu_x86_boot(code: *u8, len: i64, mem: *u8, uart: *u8, ulen: *i64, st: *i64) -> i64
called by 1: main calls 2: bk_modek_i32
65func main() -> i64