nx_hwmodel_research_fetch.nx source
↩ module page · 47 lines · 3772 B
1// nx_hwmodel_research_fetch.nx -- bank the HARDWARE-MODEL field for NishiOS rung 7 (the 3 hardware-gated OS gaps,
2// advanced in PURE SIMULATION per the fpga-boot-sim precedent, never-brick by construction). Three axes: (1) x86-64
3// PAGING (the real MMU structures the MMU model must match), (2) GPU command submission (PCIe BAR/MMIO/ring/doorbell/
4// fence -- the real path the GPU-ring model must match), (3) FIRMWARE BRICK MECHANISMS to AVOID (SPI flash, UEFI,
5// CMOS/NVRAM -- so the never-brick guard REFUSES exactly the persistent-write paths that brick). Sovereign TLS;
6// idempotent. expect_exit:0 ORIGINAL
7import "nx_research_engine.nx"
8const K_MAGIC_8388608: i64 = 8388608
9
10func F(u: *u8, o: *u8, store: *TrustStore, out: *u8, cap: i64) -> i64 { return rf_fetch_bank(u, o, store, out, cap) }
11
12func main() -> i64 {
13 let store: *TrustStore = rf_init()
14 if (store as i64) == 0 { rf_puts("hwmodel: trust store load failed\n" as *u8); return 1 }
15 rf_puts("CA roots="); rf_putn(trust_store_count(store)); rf_puts(" -- HARDWARE-MODEL field (paging/GPU-MMIO/brick-safety) -> Library\n" as *u8)
16 let cap: i64 = K_MAGIC_8388608
17 let out: *u8 = sys_mmap(cap)
18 var ok: i64 = 0
19
20 rf_section("x86-64 PAGING -- the real MMU structures the model must match (4-level, CR3, TLB, faults)" as *u8)
21 ok = ok + F("https://en.wikipedia.org/wiki/X86-64" as *u8, "hw_x8664" as *u8, store, out, cap)
22 ok = ok + F("https://en.wikipedia.org/wiki/Page_table" as *u8, "hw_pagetable" as *u8, store, out, cap)
23 ok = ok + F("https://en.wikipedia.org/wiki/Virtual_memory" as *u8, "hw_virtmem" as *u8, store, out, cap)
24 ok = ok + F("https://en.wikipedia.org/wiki/Memory_management_unit" as *u8, "hw_mmu" as *u8, store, out, cap)
25 ok = ok + F("https://en.wikipedia.org/wiki/Translation_lookaside_buffer" as *u8, "hw_tlb" as *u8, store, out, cap)
26 ok = ok + F("https://en.wikipedia.org/wiki/Page_fault" as *u8, "hw_pagefault" as *u8, store, out, cap)
27 ok = ok + F("https://en.wikipedia.org/wiki/Control_register" as *u8, "hw_cr3" as *u8, store, out, cap)
28
29 rf_section("GPU COMMAND SUBMISSION -- PCIe BAR / MMIO / ring / doorbell / fence (the real submit path)" as *u8)
30 ok = ok + F("https://en.wikipedia.org/wiki/PCI_configuration_space" as *u8, "hw_pciconfig" as *u8, store, out, cap)
31 ok = ok + F("https://en.wikipedia.org/wiki/Memory-mapped_I/O" as *u8, "hw_mmio" as *u8, store, out, cap)
32 ok = ok + F("https://en.wikipedia.org/wiki/PCI_Express" as *u8, "hw_pcie" as *u8, store, out, cap)
33 ok = ok + F("https://en.wikipedia.org/wiki/Direct_memory_access" as *u8, "hw_dma" as *u8, store, out, cap)
34 ok = ok + F("https://en.wikipedia.org/wiki/Command_buffer" as *u8, "hw_cmdbuffer" as *u8, store, out, cap)
35 ok = ok + F("https://en.wikipedia.org/wiki/Circular_buffer" as *u8, "hw_ringbuffer" as *u8, store, out, cap)
36
37 rf_section("FIRMWARE BRICK MECHANISMS to AVOID -- the persistent-write paths the never-brick guard REFUSES" as *u8)
38 ok = ok + F("https://en.wikipedia.org/wiki/UEFI" as *u8, "hw_uefi" as *u8, store, out, cap)
39 ok = ok + F("https://en.wikipedia.org/wiki/BIOS" as *u8, "hw_bios2" as *u8, store, out, cap)
40 ok = ok + F("https://en.wikipedia.org/wiki/Flash_memory" as *u8, "hw_flash" as *u8, store, out, cap)
41 ok = ok + F("https://en.wikipedia.org/wiki/Serial_Peripheral_Interface" as *u8, "hw_spi" as *u8, store, out, cap)
42 ok = ok + F("https://en.wikipedia.org/wiki/Nonvolatile_BIOS_memory" as *u8, "hw_nvram" as *u8, store, out, cap)
43 ok = ok + F("https://en.wikipedia.org/wiki/Firmware" as *u8, "hw_firmware" as *u8, store, out, cap)
44
45 rf_puts("HARDWARE-MODEL FIELD BANKED: "); rf_putn(ok); rf_puts(" / 19 -- paging + GPU-MMIO + firmware-brick-safety RESEARCHED\n" as *u8)
46 return 0
47}