include/layout.h — Memory layout

Firmware memory layout: the MIPS virtual addresses fixed by the host and hardware contract, the layout of the two host allocations (code and data objects) and the firmware’s private words in the boot-data page. The wired TLB layout is per BVNC (src/bvnc/<bvnc>/bvnc.h).

Shared by C, assembly, the linker script and the packer (tools/mkfw.py parses the FW_* and FWL_* defines from this file, one per line).

FW_HEAP_BASE

Start of the firmware heap window (host-mapped through the MIPS page table).

FW_HEAP_SIZE

Size of the heap window.

FW_VA_MASK

Mask that turns a host firmware address into a heap pointer.

FW_SYSINIT_VA

Address of the host’s sysinit structure.

FW_OSINIT_VA

Address of the host’s osinit structure.

FW_PT_VA

Where the host’s MIPS page table is mapped (four pages, wired).

FW_STACK_VA

Where the firmware stack is mapped (two pages, wired).

FW_REGS_VA

GPU register bank (core banks), 1 MiB identity pages, wired.

FW_BCAST_VA

XPU broadcast register bank, wired.

FW_BOOT_CODE_VA

Reset vector and boot code (KSEG1).

FW_BOOT_DATA_VA

Boot-data page (KSEG1, uncached): host boot data and the firmware’s private words.

FW_EXC_VA

Exception page (EBase, KSEG0).

FWL_CODE_BASE

Code object: heap offset 0.

FWL_CODE_SIZE

Main code and read-only data.

FWL_BOOT_OFFSET

Boot page inside the code object.

FWL_EXC_OFFSET

Exception page inside the code object.

FWL_CODE_ALLOC

Size of the code object.

FWL_DATA_BASE

Data object, in the host’s reserved 1 MiB of the heap.

FWL_DATA_SIZE

Private data and .bss.

FWL_BOOTDATA_OFFSET

Boot-data page inside the data object.

FWL_STACK_OFFSET

Stack inside the data object.

FWL_STACK_SIZE

Stack size.

FWL_DATA_ALLOC

Size of the data object.

FW_STACK_HEAP_VA

Heap address of the stack pages (backing FW_STACK_VA).

BD_PUBLIC_SIZE

Size of the public boot-data header written by the host.

BD_PRIV

Start of the firmware’s private area in the boot-data page.

BD_BARRIER

Uncached write-barrier word.

BD_TLB_NEXT

Next dynamic TLB slot.

BD_FAULT_HI

Remap high word of the host fault page.

BD_FAULT_COUNT

Number of refills sent to the fault page.

BD_LAST_BADVADDR

BadVAddr of the last fault.

BD_LAST_CAUSE

Cause of the last fatal exception.

BD_LAST_EPC

EPC of the last fatal exception.

BD_IN_EXCEPTION

Set while the general exception handler runs (stops nested faults).

BD_BOOT_STAGE

Boot progress marker.

BD_REFILL_COUNT

Number of TLB refills.

BD_SAVE

Save area of the TLB refill handler (8 words).

BD_EXC_REGS

Register dump of a fatal exception (32 words).

BD_NMI_SHARED

Start of the NMI shared area.

BD_NMI_SYNC

ROGUE_MIPSFW_NMI_SYNC_FLAG_OFFSET (word 0).

BD_NMI_STATE

struct rogue_mips_state (ROGUE_MIPSFW_NMI_STATE_OFFSET, word 1).

BD_NMI_TLB

rogue_mips_state.tlb[].

BD_NMI_REMAP

rogue_mips_state.remap[].

NMI_ERROR_STATE_SET

ROGUE_MIPSFW_NMI_ERROR_STATE_SET: written to error_state.

BD_NMI_SAVE

Register save area of the NMI handler and the state dump (16 words, firmware-private).