grub-dev: Stack and heap size
8 Stack and heap size
*********************
On emu stack and heap are just normal host OS stack and heap. Stack is
typically 8 MiB although it's OS-dependent.
On i386-pc, i386-coreboot, i386-qemu and i386-multiboot the stack is
60KiB. All available space between 1MiB and 4GiB marks is part of heap.
On *-xen stack is 4MiB. If compiled for x86-64 with GCC 4.4 or later
adressable space is unlimited. When compiled for x86-64 with older GCC
version adressable space is limited to 2GiB. When compiling for i386
adressable space is limited to 4GiB. All adressable pages except the
ones for stack, GRUB binary, special pages and page table are in the
heap.
On *-efi GRUB uses same stack as EFI. If compiled for x86-64 with GCC
4.4 or later adressable space is unlimited. When compiled for x86-64
with older GCC version adressable space is limited to 2GiB. For all
other platforms adressable space is limited to 4GiB. GRUB allocates
pages from EFI for its heap, at most 1.6 GiB.
On i386-ieee1275 and powerpc-ieee1275 GRUB uses same stack as
IEEE1275. It allocates at most 32MiB for its heap.
On sparc64-ieee1275 stack is 256KiB and heap is 2MiB.
On mips(el)-qemu_mips and mipsel-loongson stack is 2MiB (everything
below GRUB image) and everything above GRUB image (from 2MiB + kernel
size) until 256MiB is part of heap.
On mips-arc stack is 2MiB (everything below GRUB image) and
everything above GRUB image(from 2MiB + kernel size) until 128MiB is
part of heap.
On mipsel-arc stack is 2MiB (everything below GRUB image which is not
part of ARC) and everything above GRUB image (from 7MiB + kernel size)
until 256MiB is part of heap.
On arm-uboot stack is 256KiB and heap is 2MiB.
In short:
Platform Stack Heap
--------------------------------------------------------------------
emu 8 MiB ?
i386-pc 60 KiB < 4 GiB
i386-coreboot60 KiB < 4 GiB
i386-multiboot60 KiB < 4 GiB
i386-qemu 60 KiB < 4 GiB
*-efi ? < 1.6 GiB
i386-ieee1275? < 32 MiB
powerpc-ieee1275? < 32 MiB
sparc64-ieee1275256KiB 2 MiB
arm-uboot 256KiB 2 MiB
mips(el)-qemu_mips2MiB 253 MiB
mipsel-loongson2MiB 253 MiB
mips-arc 2MiB 125 MiB
mipsel-arc 2MiB 248 MiB
x86_64-xen 4MiB unlimited
(GCC >=
4.4)
x86_64-xen 4MiB < 2GiB
(GCC <
4.4)
i386-xen 4MiB < 4GiB