Next: , Up: Internals


D.1 The memory map of various components

GRUB consists of two distinct components, called stages, which are loaded at different times in the boot process. Because they run mutual-exclusively, sometimes a memory area overlaps with another memory area. And, even in one stage, a single memory area can be used for various purposes, because their usages are mutually exclusive.

Here is the memory map of the various components:

0 to 4K-1
BIOS and real mode interrupts
0x07BE to 0x07FF
Partition table passed to another boot loader
down from 8K-1
Real mode stack
0x2000 to ?
The optional Stage 1.5 is loaded here
0x2000 to 0x7FFF
Command-line buffer for Multiboot kernels and modules
0x7C00 to 0x7DFF
Stage 1 is loaded here by BIOS or another boot loader
0x7F00 to 0x7F42
LBA drive parameters
0x8000 to ?
Stage2 is loaded here
The end of Stage 2 to 416K-1
Heap, in particular used for the menu
down from 416K-1
Protected mode stack
416K to 448K-1
Filesystem buffer
448K to 479.5K-1
Raw device buffer
479.5K to 480K-1
512-byte scratch area
480K to 512K-1
Buffers for various functions, such as password, command-line, cut and paste, and completion.
The last 1K of lower memory
Disk swapping code and data

See the file stage2/shared.h, for more information.