Volume 3: Virtual Memory, Paging, Merlin-II Physical Map & Garbage Collection
This volume specifies the Ivory 32-bit virtual memory architecture, the proven XL1200 Merlin-II physical address map, the Page Hash Table (PHT) and hardware BAR hash box, the 13 hardware memory cycle types (Table 13), generational/ephemeral GC barriers, and emulator Map Cache / IvoryDcache coherence.
All addresses, bitfields, and cycle rules match ivory_hw.h and emu/src/{mem.c,cpu_decode.c,cpu_zen4_avx512.c}.
Primary Reference Sources (local-only when present):
genera-original/sys.sct/i-sys/{sysdef.lisp,sysdf1.lisp}— PHT0/PHT1 layouts, zones, 13 memory cycles, oldspace registers.genera-original/sys.sct/i-sys/{io-register-definitions.lisp,console.lisp,wired-screen.lisp,merlin-scsi-hardware.lisp,vme-defs.lisp,i-clocks.lisp}— Proven Merlin-II and I/O Board 0 physical addresses.I_Machine/I-Machine_Architecture_Specification.pdf— Pages 85–89 (Virtual Memory, Table 13, Hardware BAR Hash Box).
1. Virtual Address Geometry & Zone Partitions
Ivory's 32-bit VMA addresses 4 GigaWords (\(2^{32}\) 40-bit words), subdivided cleanly by powers of two:
| Unit | Size (Words) | VMA Bits | Role |
|---|---|---|---|
| Page | 256 (\(2^8\)) | <7:0> offset, <31:8> 24-bit VPN | PHT mapping, dirty/write-protect, and IvoryDcache unit |
| Quantum | 65,536 (\(2^{16}\), 256 pp) | <31:16> | Genera area allocation quantum |
| Ephemeral Half-Level | 2,097,152 (\(2^{21}\)) | Zone 0 <24:21> | 32 ephemeral GC half-levels inside Zone 0 |
| Zone | 134,217,728 (\(2^{27}\), 128 MW) | <31:27> (0..31) | Top-level GC and wired-window partition |
Virtual Translation Paths
- Zone 0 (
0x00000000–0x07FFFFFF) — Ephemeral Space: PHT-translated; governed by%REGISTER-EPHEMERAL-OLDSPACE(#o16) and PHT1ephemeral_reference. - Zones 1..30 (
0x08000000–0xF7FFFFFF) — Dynamic & Static Virtual Space: PHT-translated through the on-chip Map Cache; governed by%REGISTER-ZONE-OLDSPACE(#o17). - Zone 31 (
0xF8000000–0xFFFFFFFF,#o37000000000–#o37777777777) — WiredVMA=PMAWindow:- Bypasses the PHT; hardware strips the top 5 bits:
PMA = VMA & 0x07FFFFFF(128 MW window). - Top 128 KW (
0x07FE0000–0x07FFFFFF) is reserved for the wired Boot Comm Area (+0x00..+0x3F), Boot PROM (+0x40..+0xFFFF), and I-Bus window (0x07FF0000..0x07FFFFFF), capping directly-wired Zone 31 RAM at 127.875 MW (0x00000000–0x07FDFFFF). - Physical memory above 128 MW (up to 4 GW via 24-bit
PHT1.ppn) is accessed through PHT virtual mappings in Zones 1..30.
- Bypasses the PHT; hardware strips the top 5 bits:
DTP-PHYSICAL-ADDRESS(#o40) — Unmapped 32-Bit Physical Bypass:- Memory operations whose address word carries tag
DTP_PHYSICAL_ADDRESSbypass both the PHT and the 27-bit Zone 31 mask, issuing the full 32-bit PMA directly onto the Merlin-II physical bus. All Merlin-II motherboard and I/O Board 0 peripherals reside here.
- Memory operations whose address word carries tag
2. Proven XL1200 Merlin-II Physical Memory Map (ivory_hw.h)
2.1 Zone 31 Accessible Physical Space (0x00000000–0x07FFFFFF)
| Physical Address (PMA) | Size | Subsystem |
|---|---|---|
0x00000000–0x007FFFFF | 8 MW | Standard XL1200 Main DRAM (IVORY_MERLIN_MAX_CONTIG_RAM_WORDS; emulator configurable up to 127.875 MW in Zone 31 / 4 GW via PHT) |
0x00040000 | 4 KW | Wired Trap Vector Base (VMA 0xF8040000), followed by FEP Comm (0x00041000), Syscom (0x00041100), NIL (0x00041200), T (0x00041208) |
0x07FE0000–0x07FE003F | 64 W | Wired Boot Comm Area (VMA 0xFFFE0000: *BOOT-EMB-COMMUNICATION-AREA*, *BOOT-SPY-PC* at +0x04, halt vector +0x10..+0x12, Main Board ID ROM +0x20..+0x3F) |
0x07FE0040–0x07FEFFFF | 64 KW | Physical Boot PROM window (Reset Vector 0x07FE0040 / #o777400100) |
2.2 DTP-PHYSICAL-ADDRESS Motherboard & I/O Board 0 Map (0x08000000–0x8FF8000F)
| Physical Address (PMA) | Constant (ivory_hw.h) | Hardware Device |
|---|---|---|
0x08000000–0x08000003 | MERLIN_TIMER_BASE_PMA | Intel 82C54 Programmable Interval Timer (3 counters + control) |
0x09000000–0x090007FF | MERLIN_NVRAM_BASE_PMA | SGS-Thomson MK48T02 2 KB Battery-Backed NVRAM + TOD Clock (0x090007F8..0x090007FF) |
0x0A000000 | MERLIN_LEDS_PMA | Merlin-II Diagnostic LEDs |
0x0A000004 | MERLIN_CACHE_CTRL_PMA | Merlin-II On-Board Memory Cache Control (<1:0> mode, <2> diag, <3> clear tags) |
0x0A000008 | MERLIN_VME_TIMEOUT_PMA | Merlin-II VME Timeout / ECO Register |
0x0A00000C | MERLIN_IRQ_REG_PMA | Merlin-II 32-Bit Interrupt Status Register (MerlinInterruptControlReg) |
0x40000000–0x4000FFFF | MERLIN_IO_BOARD0_BASE_PMA | I/O Board 0 64 KW DMA SRAM (Serial DMA 0x40004200 + #o7000 W; SCSI I/O buffer 0x40005000 + #o20000 W) |
0x44014000 | MERLIN_ESDI_CABLE_STATUS_PMA | ESDI cable status |
0x44014800 | MERLIN_SERIAL_CTRL_PMA | Serial subsystem control register |
0x44015000 | MERLIN_SCSI_CTRL_PMA | SCSI subsystem control register |
0x44016000–0x4401601F | MERLIN_IO0_ID_ROM_BASE_PMA | Primary I/O Board 0 32-byte ID ROM (48-bit Ethernet MAC) & Intel 82586 Ethernet Control in bits <7:5> (<7> inhibit reset, <6> CA pulse, <5> inhibit loopback) |
0x44017000 / 0x44017100 | MERLIN_DUSCC_{WRITE,READ}_PMA | Signetics SCN68562 Dual Universal Serial Communications Controller (Console KB/Mouse + Serial) |
0x44017200 / 0x44017300 | MERLIN_DMAC_{WRITE,READ}_PMA | Intel 8237A Serial DMA Controller |
0x44017800 / 0x44017900 | MERLIN_SCSI_POLL_{WRITE,READ}_PMA | Western Digital WD33C93A SCSI Controller (address/data ports) |
0x4401A000..0x4401B800 | MERLIN_SCSI_{START_WRAP,OVERRUN,TRIGGER,DMA_COUNTER}_PMA | WD33C93A DMA wrap, overrun, trigger, and transfer counter registers |
0x44020000–0x4402003F | MERLIN_ESDI_DP8466_BASE_PMA | National Semiconductor DP8466 ESDI Disk Controller |
0x44024000 | MERLIN_VIDEO_VPOS_PMA | Console video vertical beam position |
0x4402C000 | MERLIN_VIDEO_CTRL_PMA | Console Video & Audio Control (<4:0>) |
0x4402D000 / 0x4402D001 | MERLIN_VIDEO_8158_{DATA,CTRL}_PMA | Brooktree/8158 Console Video Timing Controller |
0x48000000–0x4807FFFF | MERLIN_VRAM_BASE_PMA | 512 KW Monochrome Console Framebuffer (1152×896, 1 bpp) |
0x50000000 | MERLIN_IO_BOARD1_BASE_PMA | I/O Board 1 (unpopulated on standard XL1200 -> IVORY_TRAP_MEMORY_BUS_ERROR #o5124) |
0x80000000, 0x88000000, 0x8FF80000 | MERLIN_VME_CTL0, MERLIN_VIC068, MERLIN_VME_CTL1 | VMEbus control windows & Cypress VIC068 VMEbus Interface Controller |
3. Page Hash Table (PHT), Hardware Hash Box & Cache Coherence
The PHT is an open-addressed hash table in wired memory (PHT-BASE #o1007, PHT-MASK #o1010) composed of 8-word buckets (4 entries × 2 words: PHT0, PHT1).
3.1 IvoryPhtEntry Bit Layout (sysdef.lisp:1312-1344)
PHT0(Word 0):<3:0>age,<5:4>spare,<6>pending,<7>fault_request(traps#o5121),<31:8>24-bitvpn(0xFFFFFF= empty),<37:32>DTP_FIXNUM,<38>end_collision_chain(%%PHT0-CHAIN),<39>CDR<1>.
PHT1(Word 1):<3:0>ephemeral_reference,<4>transport_trap,<5>cache_inhibit,<6>write_protect(traps#o5122on write),<7>modified,<31:8>24-bitppn,<37:32>DTP_FIXNUM,<39:38>CDR code.
3.2 Grouped Bit-Run ivory_pht_hash() & Collision Rehash
Reading %REGISTER-PHT-HASH-0..3 (#o007, #o207, #o407, #o607) returns the 26-bit bucket-aligned offset (bits <2:0> = 0):
h<7:3> = rev(vma<12:8>) ^ vma<31:27>
h<8> = vma<13> ^ vma<20>
h<10:9> = vma<15:14> ^ {vma<21>, vma<22>}
h<14:11> = vma<19:16> ^ rev(vma<26:23>)
h<19:15> = rev(vma<12:8>) ^ vma<20:16>
h<22:20> = vma<15:13> ^ vma<27:25>
h<25:23> = vma<23:21> ^ rev(vma<31:29>)
- Scalar implementation (
ivory_hw.h): Computes 32-bit SWAR bit-reversal once and combines the 7 grouped bit-runs with masks/shifts and XORs. - AVX-512 implementation (
cpu_zen4_avx512.c): Computes the identical 26-bit hash in 4 instructions viavpshufbitqmb(AVX-512 BITALG), andivory_pht_probe_bucket_avx512()matches all 4PHT0entries of a 64-byte bucket in a singleZMMregister. - Collision rehash:
ivory_pht_rehash_next(state) = (state * 17U) + 1U. If a lookup misses andend_collision_chain == 1, hardware raisesIVORY_TRAP_PAGE_NOT_RESIDENT(#o5120).
3.3 Map Cache & Emulator IvoryDcache Coherence
Software manages the hardware Map Cache via LOAD-MAP-0..3 (#o033..#o633), LOAD-MATCHING-MAP-0..3 (#o052..#o652), INVALIDATE-MAP-0..3 (#o032..#o632), and MAP-CACHE-CONTROL (#o026).
- Any Map Cache mutation bumps
mem->map_epoch, invalidating the CPU's 64-entry L0 I-cache immediately. - Every RAM write calls
ivory_mem_note_ram_write_pma(), marking the 256-word page dirty and invalidating its physical PPN in the 256-pageIvoryDcache(ivory_dcache_invalidate_ppn) in O(1) time. See Paging System and Emulator Core & Acceleration for details.
4. The 13 Hardware Memory Cycle Types (Table 13)
Ivory encodes memory-forwarding, trap, and GC transport rules directly in hardware across 13 distinct cycle types (IvoryMemoryCycleType in ivory_hw.h, sysdef.lisp:1620-1634):
| Code | Cycle Name | Follows HFWD | Follows EFWD/1FWD | Follows EVCP | MFWD Action | GC_FWD Action | DTP_NULL Action | GC Transport |
|---|---|---|---|---|---|---|---|---|
0 | DATA_READ | Yes | Yes | Yes | Monitor trap (#o5112) | Transport (#o5106) | MEMORY_DATA_ERROR (0x0047) | Yes |
1 | DATA_WRITE | Yes | Yes | Yes | Monitor trap (#o5112) | Transport (#o5106) | Overwrites (preserves CDR) | Write barrier |
2 | BIND_READ | Yes | Yes | No | Monitor trap (#o5112) | Transport (#o5106) | Allowed | Yes |
3 | BIND_WRITE | Yes | Yes | No | Monitor trap (#o5112) | Transport (#o5106) | Overwrites (preserves CDR) | Write barrier |
4 | BIND_READ_NO_MONITOR | Yes | Yes | No | Follows | Transport (#o5106) | Allowed | Yes |
5 | BIND_WRITE_NO_MONITOR | Yes | Yes | No | Follows | Transport (#o5106) | Overwrites (preserves CDR) | Write barrier |
6 | HEADER_READ | Yes | No | No | Traps | Transport (#o5106) | Traps | No |
7 | STRUCTURE_OFFSET | Yes | No | No | Traps | Transport (#o5106) | Allowed | No |
8 | SCAVENGE | No | No | No | No | Transport (#o5106) | Allowed | Yes |
9 | CDR_READ | Yes | EFWD only | No | No | Transport (#o5106) | Allowed (returns CDR) | No |
10 | GC_COPY | No | No | No | No | Transport (#o5106) | Allowed | No |
11 | RAW_READ | No | No | No | No | No | Allowed | No |
12 | RAW_TRANSLATE | — | — | — | — | — | Address translation only | No |
CLOS / Unbound Variable Note: Reading
DTP_NULL(#o00) on aDATA_READcycle triggersIVORY_TRAP_ERROR(#o5100) with Rev 4 microstateIVORY_REV4_USTATE_MEMORY_DATA_ERROR(0x0047,vma_valid = 1), which Genera's trap handler translates intoSYS:UNBOUND-VARIABLEorCLOS:SLOT-UNBOUND.
5. Hardware Garbage Collection Barriers
Ivory accelerates Genera's generational (Ephemeral) and Dynamic copying garbage collectors with two zero-overhead hardware barriers:
- Read Barrier (Oldspace Transport Trap,
#o5106):- On
DATA_READ,BIND_READ*, andSCAVENGEcycles, if the loaded word is a pointer type (K_POINTER_DTP_MASK) whose target VMA falls in either:- Zone 0 with its ephemeral half-level bit (
(vma >> 21) & 31) set in%REGISTER-EPHEMERAL-OLDSPACE(#o16), or - Zones 1..30 with its zone bit (
vma >> 27) set in%REGISTER-ZONE-OLDSPACE(#o17), hardware immediately raisesIVORY_TRAP_TRANSPORT(#o5106) so the collector evacuates the object to newspace, leaves aDTP_GC_FORWARD(#o45) heart, and snaps the pointer before restarting the instruction.
- Zone 0 with its ephemeral half-level bit (
- On
- Write Barrier (Ephemeral Reference Tracking):
- On
DATA_WRITE/BIND_WRITE*cycles storing a Zone 0 ephemeral pointer into an older page, hardware updatesPHT1.ephemeral_reference(<3:0>) or triggersPHT1.transport_trap(<4>) so minor ephemeral collections only scan dirty inter-generational pages rather than the entire heap.
- On
- VTC / Cypress VIC068A —
cypress_VIC068A_VAC068A_users_guide.pdf(mirror) - Intel 8237A —
intel_8237A_dmac.pdf - Intel 82586 —
intel_82586_lan_coprocessor.pdf(mirror) - Intel 82586 —
intel_82586_reference_manual_1983.pdf(mirror) - Intel 82C54 —
intel_82C54_pit.pdf - National DP8466 / DP8466A —
national_1988_mass_storage_DP8466.pdf(mirror) - National DP8466A (AN-0500) —
national_DP8466A_AN0500_esdi_1987.pdf(mirror) - Signetics SCN68562 / SCN26562 —
signetics_1991_IC019_data_comm_SCN68562.pdf(mirror) - Mostek MK48T02 / ST M48T02 —
st_M48T02_MK48T02_timekeeper.pdf - Western Digital WD33C93A —
wd_WD33C93A_datasheet_and_appnotes_1990.pdf(mirror) - Western Digital WD33C93A —
wd_WD33C93A_scsi_datasheet.pdf(mirror)