Yet Another Gamecube Documentation

4  Memory Map


4.1  Overview

start end size description
0x00000000 0x017fffff 24MB Physical address of the RAM
0x80000000 0x817fffff 24MB Logical address of the RAM, cached
0xC0000000 0xC17fffff 24MB Logical address of the RAM, not cached
0xc8000000   2MB Embedded Framebuffer (EFB)
0xCC000000     Hardware registers
0xCC000000     CP - Command Processor
0xCC001000     PE - Pixel Engine
0xCC002000     VI - Video Interface
0xCC003000     PI - Processor Interface (Interrupt Interface)
0xCC004000     MI - Memory Interface
0xCC005000     AI - Audio Interface
0xCC006000     DI - DVD Interface
0xCC006400     SI - Serial Interface
0xCC006800     EXI - External Interface
0xCC006C00     Streaming Interface
0xCC008000     GX FIFO (Graphic display lists)
0xe0000000 0xe0003fff 16k L2 Cache
0xfff00000   1MB IPL (mapped here at bootup)


4.2  RAM usage

Variables that are marked as B are changed by bootrom or IPL. Variables marked as A are changed lately in apploader when a game is booting. Variables, which are marked as O are changed after an OSInit call. Remember that the IPL also has a hard-linked Dolphin OS inside, so those variables that are marked as O are also changed in the IPL.

4.2.1  Dolphin-OS globals

In PowerPC architectures the lower 256 bytes of main memory are reserved for internal OS use. This map describes all known OS low memory variables. Dolphin OS accesses low memory as 0x80000000 + offset (cached).   Boot Info  DVD Disc ID  
start size   description
0x80000000 0x04 B Gamecode
0x80000004 0x02 B Company
0x80000006 0x01 B Disk ID
0x80000007 0x01 B Version
0x80000008 0x01 B Streaming
0 audio streaming off
1 audio streaming on
0x80000009 0x01 B StreamBufSize
0x8000000a 0x0f   padding zeros  system Info  
start size   description
0x8000001c   A DVD magic word
0xc2339f3d Nintendo Game Disc
0x80000020 4 A Magic word (how did the console boot?)
value description
0x0D15EA5E normal boot
0xE5207C22 booted from jtag
0x80000024 4 A Version (usually set to 1 by apploader)
0x80000028 4 B physical Memory Size
0x01800000 24MB on retail console
0x8000002C 4 B Console type
value Description
0x00000001 Retail1
0x00000002 HW2 production board
0x00000003 The latest production board
0x00000004 Reserved
0x1XXXXXXX Devkits
0x10000000 MAC emulator
0x10000001 PC Emulator
0x10000002 'Arthur'
0x10000003 'Minnow'
0x10000004 1st Devkit HW
0x10000005 2nd Devkit HW
0x10000006 latest Devkit HW
0x10000007 Reserved
0x20000005 HW2 TDEV system
0x20000006 The latest TDEV system
0x20000007 Reserved
0x80000030 4 O ArenaLo (==0x00000000)
0x80000034 4 O ArenaHi (==0x817fe8c0)
0x80000038 4   FST Location in ram (==0x817fe8c0)
0x8000003C 4   FST Max Length (==0x00000024)   Debugger info

start size   description
0x80000040 4 A flag for "debugger present" (used by __OSIsDebuggerPresent)
0x80000044 4 A Debugger Exception mask Bitmap, set to 0 at sdk lib start
0x80000048 4 A Exception hook destination (physical address)
0x8000004c 4 A Temp for LR, Return from exception address (to return from hook)
0x80000050 16   padding zeros   Debugger Hook

.>80000060  38 a0 00 40  li r5,0x40
.>80000064  7c 68 02 a6  mflr r3
.>80000068  90 65 00 0c  stw r3,0x0c(r5)
.>8000006c  80 65 00 08  lwz r3,0x08(r5)
.>80000070  64 63 80 00  oris r3,r3,0x8000
.>80000074  7c 68 03 a6  mtlr r3
.>80000078  38 60 00 30  li r3,0x30
.>8000007c  7c 60 01 24  mtmsr r3
.>80000080  4e 80 00 20  blr
jump (lr)   Dolphin OS Globals

start end size   description
0x80000084 0x800000bf     padding zeros
0x800000c0   4 O Current OS context (physical address)
0x800000C4   4 O Previous OS interrupt mask
0x800000C8   4 O current OS interrupt mask
0x800000CC       TV Mode
value description
0 ntsc
1 pal
2 debug
3 debug pal
4 mpal
5 pal 60
0x800000d0     B ARAM size (internal+expansion) in bytes. set by ARAM driver, usually 16mb.
0x800000D4     O current OS Context (logical address)
0x800000D8     O default OS thread (logical address)
0x800000Dc     O active Thread queue, head thread (logical address)
0x800000e0     O active Thread queue, tail thread (logical address)
0x800000e4     O Current OS thread
0x800000e8     A Debug monitor size (in bytes)
0x800000ec     A Debug monitor location (usually at the top of main memory)
0x800000F0     A Console Simulated Memory Size, 0x01800000 (usually same as physical memory size)
0x800000F4     A DVD BI2 location in main memory (size of BI2 is 0x2000 bytes)
0x800000F8       Bus Clock Speed, 162 MHz (=0x09a7ec80, 162000000)
0x800000FC       CPU Clock Speed, 486 MHz (=0x1cf7c580, 486000000)


4.2.2  Exception Handlers

start end size description
0x80000100     System Reset Interrupt
0x80000200     Machine Check Interrupt
0x80000300     DSI Interrupt
0x80000400     ISI Interrupt
0x80000500     External Interrupt
0x80000600     Alignment Interrupt
0x80000700     Program Interrupt
0x80000800     FP unavailable Interrupt
0x80000900     Decrementer Interrupt
0x80000C00     System Call Interrupt
0x80000d00     Trace Interrupt
0x80000f00     Performance Monitor Interrupt
0x80001300     IABR Interrupt
0x80001400     reserved
0x80001700     Thermal Interrupt
0x80001800 0x80002fff   unused/reserved (*)

(*) note: psoload v2 uses this area to stay resident in memory, it is unused by Dolphin-OS

4.2.3  Dolphin-OS globals

start end size   Description
0x80003000       exception handler vectors (from sdk libs & ipl)
0x8000303c   4   padding/unused
0x80003040       external interrupt handler vectors (from sdk libs & ipl)
0x800030a4       padding/unused
0x800030c0   4   ?
0x800030c4   4   ?
0x800030c8   4   First Module Header Pointer in Module Queue
0x800030cc   4   Last Module Header Pointer in Module Queue
0x800030d0   4   Module String Table Pointer
0x800030d4   4 A DOL size (total size of text/data sections), in bytes (*1)
0x800030d8   4 B OS system time (set, when console is powered up)
0x800030dc   4   ?
0x800030E0   4   ? (6=production pads ?)
0x800030e4   2   ?
0x800030e6   1   ?
0x800030e7   1   ?
0x800030e8   1 O set by OsInit() (debugger stuff?)
0x800030e9   1 O set by OsInit() (debugger stuff?)
0x800030ea   2   ?
0x800030ec   4   ?
0x800030F0   2   ?
0x800030F2   1   Boot status
value description
0 first boot
1 already booted
0x800030F3   1   ?
0x800030F4   4   ?
0x800030F8   4   ?
0x800030Fc   4   ?

(*1) If FST on DVD is placed after DOL, then BB2 FSTLength is added to this value.

4.2.4  User Memory   user program area

start end size description
0x80003100     Start of code (usually)
0x80003140     Entry point (early SDK v1.0 applications)
0x81200000     Load Address of the Apploader
0x81300000     Load Address of Bootrom/IPL

note: of course the entrypoint of an application can be anything, those listed here are just some typical examples. Retail game start dol-files are usually located below the apploader.   stack area

start end size description
    Bottom of Stack
      Top of Stack   heap area

start end size   description
?     O ArenaLo - Bottom of Heap
0x817fe8c0     O ArenaHi - Top of Heap

note: the address of ArenaHi is not a constant, but should be set to the bottom of the FST which is read from the DVD so its size depends on the application. the value given here is just an example.   'high memory'  
start end size   description
0x817fe8c0   24 O FST (used by Dolphin-OS)
0x817fffff       Memory Top