code wiki / _hdl_build / nx_nishios_net_wire.nx

nx_nishios_net_wire.nx

buildroot/runtime/_hdl_build/nx_nishios_net_wire.nx

29742 B511 linesdepth 21pulls 156 transitivereach 0 importersview sourcekind tooltopic nishios
docsdependenciesstructsconstsfunctions

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

nx_browser_render.nx nx_fb.nx nx_x509_trust_store.nx nx_trust_store_load_from_certdata. nx_https_get.nx nx_http_response_parse.nx nx_nishios_net_wire.nx

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

main nw_puts nx_trust_store_load_from_c sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close nx_nss_certdata_parse sys_mmap ↻ _pat_class_cert _pat_value_octal _pat_end _find_newline _starts_with _parse_octal_line sys_mmap ↻ _is_space _decode_octal_escape _is_octal trust_store_alloc sys_mmap ↻ nx_x509_trust_store_load sys_mmap ↻ x509_parse sys_mmap ↻ asn1_cursor_init asn1_expect_tag sys_mmap ↻ asn1_read_tlv_header asn1_read_tag asn1_read_length asn1_read_length ↻ x509_read_tlv sys_mmap ↻ asn1_expect_tag ↻ x509_read_alg_id sys_mmap ↻

structs

none

consts

36const NW_MAGIC_200000: i64 = 200000
37const NW_MAGIC_32767: i64 = 32767
38const NW_MAGIC_65536: i64 = 65536
39const NW_MAGIC_4096: i64 = 4096
40const NW_MAGIC_4094: i64 = 4094
41const NW_MAGIC_100000: i64 = 100000
42const NW_MAGIC_4194304: i64 = 4194304
43const NW_MAGIC_262144: i64 = 262144
120const NW_IMG_SZ: i64 = 1024
199const NW_W: i64 = 640
200const NW_H: i64 = 480
201const NW_BW: i64 = 620
202const NW_BH: i64 = 426
203const NW_OX: i64 = 10
204const NW_OY: i64 = 38
208const NW_NICREG: i64 = 0x2000
209const NW_TXOFF: i64 = 0x3000
210const NW_RXOFF: i64 = 0x5000
211const NW_MEMSZ: i64 = 0x10000
212const NW_DOORBELL: i64 = 0x2008
213const NW_RXCAP: i64 = 40000

functions

45func 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
46func 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
47func nw_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
48func nw_contains(hay: *u8, hn: i64, ndl: *u8, nn: i64) -> i64
54func 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
57func nw_emu_boot_disk(mem: *u8, disk: *u8, entry: i64, console: *u8, clen: *i64, st: *i64) -> i64
called by 1: nw_boot_image calls 1: nw_mode
121func nw_movrax(img: *u8, base: i64, o: i64, b0: i64, b1: i64, b2: i64, b3: i64) -> i64
called by 1: nw_build_image
126func nw_build_image(img: *u8) -> i64
called by 1: main calls 1: nw_movrax
165func nw_boot_image(img: *u8, console: *u8, clen: *i64, st: *i64, loaded: *i64) -> i64
called by 1: main calls 1: nw_emu_boot_disk
177func nw_str(fb: *u8, W: i64, H: i64, x: i64, y: i64, s: *u8, r: i64, g: i64, b: i64) -> i64
191func nw_write_file(path: *u8, data: *u8, n: i64) -> i64
called by 1: main calls 1: sys_openat_wr
215func 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) }
216func 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 }
217func 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
222func nw_device_wire(mem: *u8, ctx: *i64) -> i64
called by 1: nw_run calls 3: nw_rd32nx_https_getnw_wr32
258func nw_run(mem: *u8, memsz: i64, entry: i64, fired: *i64, ctx: *i64) -> i64
called by 1: main calls 3: nw_wr32nw_device_wirenw_rd32
292func nw_movabs(code: *u8, p: i64, v: i64) -> i64
called by 1: nw_author
298func nw_movrdx(code: *u8, p: i64, v: i64) -> i64
called by 1: nw_author
303func 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
304func 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
308func nw_author(code: *u8, txlen: i64, ring: i64) -> i64
320func nw_draw_desktop(desk: *u8, page: *Page, url: *u8, ulen: i64) -> i64
352func main() -> i64