code wiki / _hdl_build / nx_nishios_net.nx
nx_nishios_net.nx
buildroot/runtime/_hdl_build/nx_nishios_net.nx
about
nx_nishios_net.nx -- BROWSER-ON-ALL-OS arc, rung N3: the Nishi browser FETCHES over a NishiOS NIC.
N1 rendered a disk page on NishiOS; N2 navigated by click; N4 wrote the window with executed x86. The
remaining NishiOS gap is the network. This rung builds the hardware-up NIC path: a MODELED network
interface (TX/RX descriptor registers + a doorbell) lives in the x86 RAM; the kernel driver programs
the TX descriptor and RINGS THE DOORBELL via EXECUTED x86 STORE instructions on the sovereign mini-emu;
the emu intercepts the doorbell store and runs the device, which reads the request out of the TX buffer
and delivers an HTTP 200 into the RX buffer. Crucially the response body is DERIVED FROM the request
(it echoes the requested path), so a hardcoded constant response cannot pass -- the liar-kill. The
browser then parses the HTTP headers and lays out the fetched body into the NishiOS desktop.
KAT: T1 booted off the persisted image; T2 LONG mode + banner; T3 the executed x86 rang the doorbell
(device fired exactly once); T4 the device delivered (RX_STATUS==1) AND the x86 read that status back
(scratch==1); T5 the response is a real HTTP 200; T6 the body is CONTENT-DERIVED (contains the exact
requested path, and a decoy path is absent -- not a constant); T7 the browser laid out the fetched
body (ok, boxes); T8 the browser rendered it into the desktop (h1 bar pixels); T9 BMP exported at the
exact expected size. NEG/liar-kill: T10 a driver that programs the descriptor but NEVER rings the
doorbell gets NO delivery (RX_STATUS stays 0 -- delivery is caused by the executed doorbell store, not
a constant); T11 a 0-sector-load sibling image never reaches long mode.
HONEST SEAM (stated, not hidden): the boot chain + the doorbell store execute as real x86 on the
sovereign emu; the device's peer is a HERMETIC loopback (it answers from the request) so the gate is
deterministic -- bridging the NIC's TX to the live sovereign TLS/HTTP stack for the REAL internet is
the named next rung (nx_nishios_net_wire). What this rung proves: the NIC descriptor/doorbell driver
path is real + executed, and the browser renders whatever the device delivers.
NEVER-BRICK (Rule 26): writes FILE artifacts only; models INT 13h *reads* + a loopback NIC; no /dev.
expect_exit: 0 license_tier: ORIGINAL
dependencies 2 imports · 0 importers
imports: nx_browser_render.nxnx_fb.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
| 30 | const NB_MAGIC_200000: i64 = 200000 |
| 31 | const NB_MAGIC_32767: i64 = 32767 |
| 32 | const NB_MAGIC_65536: i64 = 65536 |
| 33 | const NB_MAGIC_100000: i64 = 100000 |
| 110 | const NB_IMG_SZ: i64 = 1024 |
| 189 | const NB_W: i64 = 640 |
| 190 | const NB_H: i64 = 480 |
| 191 | const NB_BW: i64 = 620 |
| 192 | const NB_BH: i64 = 426 |
| 193 | const NB_OX: i64 = 10 |
| 194 | const NB_OY: i64 = 38 |
| 198 | const NN_NICREG: i64 = 0x2000 |
| 199 | const NN_TXOFF: i64 = 0x3000 |
| 200 | const NN_RXOFF: i64 = 0x5000 |
| 201 | const NN_MEMSZ: i64 = 0x10000 |
| 202 | const NN_DOORBELL: i64 = 0x2008 // NN_NICREG + 8 |
functions
| 35 | func nb_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 |
| 36 | func nb_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 |
| 37 | func nb_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 38 | func nb_contains(hay: *u8, hn: i64, ndl: *u8, nn: i64) -> i64 called by 1: main |
| 44 | func nb_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: nb_emu_boot_disk |
| 47 | func nb_emu_boot_disk(mem: *u8, disk: *u8, entry: i64, console: *u8, clen: *i64, st: *i64) -> i64 |
| 111 | func nb_movrax(img: *u8, base: i64, o: i64, b0: i64, b1: i64, b2: i64, b3: i64) -> i64 called by 1: nb_build_image |
| 116 | func nb_build_image(img: *u8) -> i64 |
| 155 | func nb_boot_image(img: *u8, console: *u8, clen: *i64, st: *i64, loaded: *i64) -> i64 |
| 167 | func nb_str(fb: *u8, W: i64, H: i64, x: i64, y: i64, s: *u8, r: i64, g: i64, b: i64) -> i64 |
| 181 | func nb_write_file(path: *u8, data: *u8, n: i64) -> i64 |
| 204 | func nn_rd32(mem: *u8, off: i64) -> i64 { return (mem[off] as i64)|((mem[off+1] as i64)<<8)|((mem[off+2] as i64)<<16)|((mem[off+3] as i64)<<24) } |
| 205 | func nn_wr32(mem: *u8, off: i64, v: i64) -> i64 { mem[off]=(v&0xFF) as u8; mem[off+1]=((v>>8)&0xFF) as u8; mem[off+2]=((v>>16)&0xFF) as u8; mem[off+3]=((v>>24)&0xFF) as u8; return 0 } |
| 206 | func nn_appz(mem: *u8, p: i64, s: *u8) -> i64 { var q: i64=p; var i: i64=0; while s[i]!=(0 as u8) { mem[q]=s[i]; q=q+1; i=i+1 } return q } |
| 210 | func nn_device(mem: *u8) -> i64 |
| 239 | func nn_run(mem: *u8, memsz: i64, entry: i64, fired: *i64) -> i64 |
| 273 | func nn_movabs(code: *u8, p: i64, v: i64) -> i64 called by 1: nn_author |
| 279 | func nn_movrdx(code: *u8, p: i64, v: i64) -> i64 called by 1: nn_author |
| 284 | func nn_store(code: *u8, p: i64) -> i64 { code[p]=0x89 as u8; code[p+1]=0x10 as u8; return p+2 } called by 1: nn_author |
| 285 | func nn_load(code: *u8, p: i64) -> i64 { code[p]=0x8B as u8; code[p+1]=0x10 as u8; return p+2 } called by 1: nn_author |
| 289 | func nn_author(code: *u8, txlen: i64, ring: i64) -> i64 |
| 301 | func nn_draw_desktop(desk: *u8, page: *Page, url: *u8, ulen: i64) -> i64 |
| 333 | func main() -> i64 |