← Blog
KERNEL · 0.6.0

Apple Silicon HAL Batch 8: PCIe Topology, SMC, Boot-Args Parser + PPC BAT, HTAB, Segment Registers

June 22, 2026 · sigil-kernel · Sigil-Docs
kernel hal apple-silicon powerpc hardware 0.6.0

sigil-kernel's eighth HAL batch wires 6 new seams — Apple: PCIe port topology enumerator (M1 4 root ports, BCM4387 WiFi Gen2 x1 + ANS2 NVMe Gen3 x2), SMC unified thermal+power seam (CPU/GPU temps, fan RPM, battery cap/mA/mV, S0/S3/S5 power states, lid), and boot-args flag parser (XNU/iBoot -v/-x/-s/debug=/serial=/rd=, O(1) after finalize). PowerPC: BAT registers (8I+8D pairs, BATU/BATL, WIMG_WI for I/O, WIMG_WB for RAM), Hash Page Table (16 PTEGs × 8 PTEs, primary hash, separate VALID word, W0/W1 encoding), Segment Registers SR0–SR15 (VSID 24-bit, Ks/Kp/N bits, identity-VSID init). apple_keystore gains an explicit EL1-ONLY gate comment — key material never surfaces outside the SEP enclave. (sigil-kernel 3d2d0ee, 8d38194, 06b70ff)

Apple Silicon HAL QEMU batch verification
Apple Silicon HAL QEMU batch verification — all 6 new seams reporting PASS

apple_pcie_port.sg — M1 PCIe Topology Enumerator

Commit 3d2d0ee. Real-silicon M1 bring-up needs to enumerate PCIe before any NVMe or WiFi driver can claim its device. apple_pcie_port.sg models the M1 root complex: 4 root ports, each carrying vendor/device/class/speed/width fields in a typed struct. The two populated ports on reference hardware are BCM4387 WiFi (Gen2 x1) and ANS2 NVMe (Gen3 x2). The plug/enum model tracks ndevices so higher layers can iterate without a fixed array bound.

Why this matters: real-silicon bring-up on M1 needs to enumerate PCIe before any NVMe or WiFi driver can claim its device. This is the topology map that driver probing will walk.


apple_smc.sg — Unified SMC Seam (AOP/PMIC)

Commit 06b70ff. The System Management Controller is the single source of truth for all thermal and power state on Apple Silicon. apple_smc.sg exposes the full surface as one typed seam rather than scattering SMC keys across separate files.

Thermal
CPU temp, GPU temp, PMU temp — all in °C×10 fixed-point (i.e. 432 = 43.2 °C). Avoids floating point in kernel context.
Fan
RPM + duty cycle. Mac Mini defaults to fanless (RPM=0). The field is present for MacBook Pro / Mac Pro parity.
Battery
Capacity %, charge current (mA), voltage (mV), health %. Mac Mini: no battery — fields zero but struct is always populated.
Power state
S0 (running), S3 (sleep), S5 (soft-off). AC presence flag. Lid open/closed for clamshell models.

Base address 0x455000. PASS: SMC init=1 fan=1 batt=1


apple_bootargs.sg — XNU/iBoot Boot-Args Parser

Commit 8d38194. iBoot passes a flat string of boot arguments into the kernel (e.g. -v debug=0x14e serial=3 rd=disk0s1). Repeated substring scans on every query would be O(n) per call. apple_bootargs.sg parses the string once at boot into structured fields, then bootargs_finalize() sets PARSED=1 — subsequent flag reads are O(1) field accesses.


ppc_bat.sg — G3/G4/G5 BAT Registers

Commit 3d2d0ee. The PowerPC Block Address Translation registers provide large-granularity virtual-to-physical mappings outside the page table — essential for mapping I/O regions and large contiguous RAM blocks with a single register pair.


ppc_htab.sg — PPC G3/G4/G5 Hash Page Table

Commit 8d38194. The PowerPC hash page table is the hardware page table format for OEA MMU mode. ppc_htab.sg implements a minimal 16-PTEG × 8-PTE table suitable for early bring-up and boot-time page mapping.


ppc_sr.sg — G3/G4/G5 Segment Registers SR0–SR15

Commit 06b70ff. PowerPC Segment Registers divide the 32-bit effective address space into 16 × 256 MB segments, each mapped to a 24-bit VSID that feeds the primary hash. ppc_sr.sg models all 16 registers with their full bit fields and initializes them with identity-VSID mapping (SRn → VSID=n) and Kp=1 (user-accessible).


apple_keystore EL1-ONLY Gate

Commit 3d2d0ee. apple_keystore.sg gains an explicit gate comment on KS_BASE: ECID and key material never surface outside the SEP enclave. The comment formalizes three invariants that were previously implicit:

This closes the Sigil-Code review question from e1ede63 that asked whether ECID could be exfiltrated through the HAL seam. The answer is structural: the seam returns no key material, and the EL1-ONLY gate is now machine-readable, not just a comment in a design doc.


Batch 8 summary

FileArchBaseCommitResult
apple_pcie_port.sgApple Silicon0x4510003d2d0eeAPCIE PASS
ppc_bat.sgPowerPC0x4520003d2d0eeBAT PASS
apple_bootargs.sgApple Silicon0x4530008d38194BARGS PASS
ppc_htab.sgPowerPC0x4540008d38194HTAB PASS
apple_smc.sgApple Silicon0x45500006b70ffSMC PASS
ppc_sr.sgPowerPC0x45600006b70ffSR PASS
apple_keystore.sgApple Silicon3d2d0eeEL1-ONLY gate