=== modified file 'grub-core/kern/arm/uboot/startup.S' --- grub-core/kern/arm/uboot/startup.S 2013-04-28 22:14:05 +0000 +++ grub-core/kern/arm/uboot/startup.S 2013-04-28 23:46:37 +0000 @@ -43,8 +43,8 @@ * Any part of the module blob that extends beyond _end. * : * Loadable modules, post relocation. + * : * : - * : */ .text @@ -85,10 +85,12 @@ subs r2, #4 @ remaining -= 4 bne 1b @ while remaining != 0 - @ Set up a new stack, beyond the end of copied modules. + @ Set up a new stack, beyond the end of heap. + ldr r2, =GRUB_KERNEL_MACHINE_HEAP_SIZE ldr r3, =GRUB_KERNEL_MACHINE_STACK_SIZE - add r3, r1, r3 @ Place stack beyond end of modules - and sp, r3, #~0x7 @ Ensure 8-byte alignment + add r3, r3, r2 + add r3, r1, r3 @ Place stack beyond end of heap + bic sp, r3, #0x7 @ Ensure 8-byte alignment @ Since we _are_ the C run-time, we need to manually zero the BSS @ region before continuing === modified file 'grub-core/kern/uboot/hw.c' --- grub-core/kern/uboot/hw.c 2013-04-28 22:14:05 +0000 +++ grub-core/kern/uboot/hw.c 2013-04-28 23:59:16 +0000 @@ -33,15 +33,14 @@ * grub_uboot_probe_memory(): * Queries U-Boot for available memory regions. * - * Sets up heap near the image in memory and sets up "start_of_ram". + * Sets up heap beyond the modules area in memory and sets up "start_of_ram". */ void grub_uboot_mm_init (void) { struct sys_info *si = grub_uboot_get_sys_info (); - grub_mm_init_region ((void *) (grub_modules_get_end () - + GRUB_KERNEL_MACHINE_STACK_SIZE), + grub_mm_init_region ((void *) grub_modules_get_end (), GRUB_KERNEL_MACHINE_HEAP_SIZE); if (si && (si->mr_no != 0)) === modified file 'include/grub/arm/uboot/kernel.h' --- include/grub/arm/uboot/kernel.h 2013-04-07 00:41:07 +0000 +++ include/grub/arm/uboot/kernel.h 2013-04-28 23:41:37 +0000 @@ -27,6 +27,6 @@ #endif /* ! ASM_FILE */ #define GRUB_KERNEL_MACHINE_STACK_SIZE 0x40000 -#define GRUB_KERNEL_MACHINE_HEAP_SIZE (grub_size_t) (2 * 1024 * 1024) +#define GRUB_KERNEL_MACHINE_HEAP_SIZE (8 * 1024 * 1024) #endif /* ! GRUB_KERNEL_MACHINE_HEADER */