# Memory management and exceptions Source: Gekko UM (IBM, v1.2, 2000; facts only) chapters 4 and 5; the PEM (Motorola MPCFPE32B rev 2) chapters 6 and 7 for the architecture. All DOC unless tagged. ## Memory management - **The 750's MMU, unchanged in kind** (UM 5.1): effective addresses translate by block address translation (BATs) first, then by segment registers (16 SRs) and the hashed page table (SDR1) with a hardware table walk; real addressing when MSR[IR]/MSR[DR] are clear. - **BATs: four instruction and four data pairs** (UM 5.1; the 750CL adds four more of each behind HID4[SBE], 750CL UM table 2-8: a Broadway question for the Wii Phase 0, not a Gekko one). - **TLBs:** separate ITLB and DTLB, each 128 entries, two-way set-associative (64 x 2), LRU replacement (UM 5.1, table 5-1). `tlbie` invalidates both ways of the indexed set in both TLBs; `tlbia` is not implemented and is an illegal instruction (UM chapter 5); `tlbsync` as the PEM says. - **Why the TLB is modelled and not only the page table.** A TLB entry can outlive a page table change until `tlbie`; software that relies on the hardware walk sees the stale translation, so the specification keeps the TLB's entries and their LRU bit. GameCube titles mostly run with BATs only (HYPOTHESIS: the Dolphin OS sets BATs for cached and uncached views of RAM and the hardware registers; a few titles use the page table for virtual memory over ARAM: HYPOTHESIS, the board's census of title behaviour cannot see this, only a run can). - **The board's address views**, which the BATs produce (YAGCD 4.1; DOC, community): 0x80000000 cached and 0xC0000000 uncached views of the 24 MB of RAM at physical 0, the hardware registers at physical 0x0C000000 (seen at 0xCC000000), the EFB at physical 0x08000000 (0xC8000000), and the IPL's reset-time mapping at 0xFFF00000. The core does not know these: they are BAT contents plus the board's physical map. ## Exceptions (UM table 4-1 and 4.5) | Vector offset | Exception | Notes for the specification | | --- | --- | --- | | 0x0100 | system reset | hard and soft reset; the prefix from MSR[IP] (0xFFF00000 at power-on) | | 0x0200 | machine check | MCP pin, bus errors (TEA), and the Gekko's HID2 DMA and `dcbz_l` errors (SRR1[10] set) | | 0x0300 | DSI | data storage; also a floating-point access to a direct-store segment (UM 4.5.6 note) | | 0x0400 | ISI | instruction storage | | 0x0500 | external interrupt | the INT pin, driven by Flipper's PI interrupt controller (board) | | 0x0600 | alignment | the 750's rules plus `dcbz_l` and the quantized-type rule (paired-singles.md, U10) | | 0x0700 | program | illegal (full SPR decode; extensions while disabled), privileged, trap, floating-point enabled | | 0x0800 | floating-point unavailable | MSR[FP] = 0, including every paired-single and quantized instruction | | 0x0900 | decrementer | DEC counts at bus/4 | | 0x0C00 | system call | | | 0x0D00 | trace | MSR[SE]/MSR[BE] | | 0x0E00 | floating-point assist | "not implemented in Gekko" (UM 4.5.12): never raised | | 0x0F00 | performance monitor | | | 0x1300 | instruction address breakpoint | IABR | | 0x1700 | thermal management | THRM1-3; the GameCube's use of it is unknown and probably nil (HYPOTHESIS) | - **Precise.** All instruction-caused exceptions are precise; the imprecise floating-point modes are implemented as precise (UM 1.7.2: "enabled floating-point exceptions are always precise"). Asynchronous exceptions (external, decrementer, performance monitor, thermal) are taken at instruction boundaries, at the next completion point. - **The exact instruction at which an external interrupt is taken** depends on what the out-of-order core has completed when the pin is sampled: unknowable from the manual (U14). The specification defines it as "after the instruction that completes at the time the pin's level reaches the core", with completion time from the timing model (timing.md): an emulator choice, tagged HYPOTHESIS, and part of the observable contract that a test ROM could check on hardware. - Machine check: MSR[ME] = 0 turns a machine check into a checkstop (the PEM). On the GameCube a checkstop freezes the console; the specification stops the machine and reports it. ## Reset state The UM gives the reset values (UM table 4-8, "Settings Caused by Hard Reset", p. 4-14; to be transcribed at rung 2). At power-on HID2 = 0 (paired singles, quantized loads, locked cache and write-gather pipe all off; UM 9.2.1, 9.4.2), MSR[IP] = 1 so vectors are at 0xFFF00000, and the first fetch is at 0xFFF00100, which the board maps to the IPL (Copetti, "Boot process"; YAGCD 4.1). The IPL is Nintendo's and is never traced or read here; the board's skip-IPL path (gamecube-python's ipl.md) sets the state the IPL would leave.