code wiki / _hdl_build / nx_nishios_net_wire.nx
nx_nishios_net_wire.nx
buildroot/runtime/_hdl_build/nx_nishios_net_wire.nx
about
nx_nishios_net_wire.nx -- BROWSER-ON-ALL-OS arc, rung N3-WIRE: NishiOS on the REAL INTERNET.
N3 (nx_nishios_net) proved the NIC driver path -- descriptor programming + doorbell by EXECUTED x86
store -- against a hermetic loopback peer. This rung replaces the loopback with the WIRE BRIDGE:
the NIC device backend terminates on the LIVE sovereign network stack (own DNS -> TCP -> TLS 1.3 ->
HTTP via nx_https_get + the Mozilla trust store), the standard user-net/slirp architecture (guest NIC
TX -> host network stack). The kernel driver (executed x86) rings the doorbell; the device parses the
request URL out of the TX buffer, fetches it over the REAL internet, and delivers the raw wire bytes
into the RX buffer; the browser parses HTTP (status/content-length/chunked -- the same idiom as
nx_browser load_page) and renders the REAL page into the NishiOS desktop. Target = example.com (the
stack's proven smallest live host; body carries "Example Domain").
KAT: T1 booted off the persisted image; T2 LONG mode + banner; T3 doorbell fired exactly once by the
executed x86; T4 device delivered (RX_STATUS==1) AND the driver read it back (scratch==1); T5 the wire
returned real bytes (nx_https_get rc>0); T6 browser-side HTTP parse says 200; T7 the body contains
"Example Domain" = content from the REAL internet; T8 the browser laid it out; T9 rendered into the
desktop (h1 bar); T10 BMP exported at the exact expected size. NEG/liar-kill: T11 no doorbell -> no
delivery; T12 THE WIRE LIAR-KILL -- the SAME bridge pointed at a guaranteed-nonexistent RFC-2606
.invalid host FAILS (wire rc<=0, RX_STATUS==2) and the executed driver observes the error
(scratch==2): a fabricated/hardcoded response could not distinguish the two hosts, so a pass here
proves the bytes really come from the network; T13 a 0-sector-load image never reaches long mode.
HONEST SEAM (stated): the boot chain + the doorbell store execute as real x86; the device backend is
host-side NishiLang (exactly like slirp is host-side C for QEMU user networking). A guest-side TCP/IP
stack driven instruction-by-instruction is the far deeper rung. LIVE-NETWORK CAVEAT: T5-T9 depend on
real connectivity to example.com; on an offline host the gate goes honestly RED (no fake green).
NEVER-BRICK (Rule 26): writes FILE artifacts only; models INT 13h *reads*; network is client-side
egress via the proven sovereign stack; no /dev writes, no firmware.
expect_exit: 0 license_tier: ORIGINAL
dependencies 6 imports · 0 importers
imports: nx_browser_render.nxnx_fb.nxnx_x509_trust_store.nxnx_trust_store_load_from_certdata.nxnx_https_get.nxnx_http_response_parse.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
| 36 | const NW_MAGIC_200000: i64 = 200000 |
| 37 | const NW_MAGIC_32767: i64 = 32767 |
| 38 | const NW_MAGIC_65536: i64 = 65536 |
| 39 | const NW_MAGIC_4096: i64 = 4096 |
| 40 | const NW_MAGIC_4094: i64 = 4094 |
| 41 | const NW_MAGIC_100000: i64 = 100000 |
| 42 | const NW_MAGIC_4194304: i64 = 4194304 |
| 43 | const NW_MAGIC_262144: i64 = 262144 |
| 120 | const NW_IMG_SZ: i64 = 1024 |
| 199 | const NW_W: i64 = 640 |
| 200 | const NW_H: i64 = 480 |
| 201 | const NW_BW: i64 = 620 |
| 202 | const NW_BH: i64 = 426 |
| 203 | const NW_OX: i64 = 10 |
| 204 | const NW_OY: i64 = 38 |
| 208 | const NW_NICREG: i64 = 0x2000 |
| 209 | const NW_TXOFF: i64 = 0x3000 |
| 210 | const NW_RXOFF: i64 = 0x5000 |
| 211 | const NW_MEMSZ: i64 = 0x10000 |
| 212 | const NW_DOORBELL: i64 = 0x2008 |
| 213 | const NW_RXCAP: i64 = 40000 |
functions
| 45 | func nw_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 |
| 46 | func nw_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 |
| 47 | func nw_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 48 | func nw_contains(hay: *u8, hn: i64, ndl: *u8, nn: i64) -> i64 |
| 54 | func nw_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: nw_emu_boot_disk |
| 57 | func nw_emu_boot_disk(mem: *u8, disk: *u8, entry: i64, console: *u8, clen: *i64, st: *i64) -> i64 |
| 121 | func nw_movrax(img: *u8, base: i64, o: i64, b0: i64, b1: i64, b2: i64, b3: i64) -> i64 called by 1: nw_build_image |
| 126 | func nw_build_image(img: *u8) -> i64 |
| 165 | func nw_boot_image(img: *u8, console: *u8, clen: *i64, st: *i64, loaded: *i64) -> i64 |
| 177 | func nw_str(fb: *u8, W: i64, H: i64, x: i64, y: i64, s: *u8, r: i64, g: i64, b: i64) -> i64 |
| 191 | func nw_write_file(path: *u8, data: *u8, n: i64) -> i64 |
| 215 | func nw_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) } |
| 216 | func nw_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 } |
| 217 | func nw_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 } called by 1: main |
| 222 | func nw_device_wire(mem: *u8, ctx: *i64) -> i64 |
| 258 | func nw_run(mem: *u8, memsz: i64, entry: i64, fired: *i64, ctx: *i64) -> i64 |
| 292 | func nw_movabs(code: *u8, p: i64, v: i64) -> i64 called by 1: nw_author |
| 298 | func nw_movrdx(code: *u8, p: i64, v: i64) -> i64 called by 1: nw_author |
| 303 | func nw_store(code: *u8, p: i64) -> i64 { code[p]=0x89 as u8; code[p+1]=0x10 as u8; return p+2 } called by 1: nw_author |
| 304 | func nw_load(code: *u8, p: i64) -> i64 { code[p]=0x8B as u8; code[p+1]=0x10 as u8; return p+2 } called by 1: nw_author |
| 308 | func nw_author(code: *u8, txlen: i64, ring: i64) -> i64 |
| 320 | func nw_draw_desktop(desk: *u8, page: *Page, url: *u8, ulen: i64) -> i64 |
| 352 | func main() -> i64 |