Received: from list by lists.gnu.org with archive (Exim 4.71) id 1UXxOt-0002mt-Ov for mharc-grub-devel@gnu.org; Thu, 02 May 2013 13:34:35 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57999) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXxOp-0002k9-8X for grub-devel@gnu.org; Thu, 02 May 2013 13:34:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UXxOi-0002H7-6h for grub-devel@gnu.org; Thu, 02 May 2013 13:34:31 -0400 Received: from mail-ea0-x22a.google.com ([2a00:1450:4013:c01::22a]:56866) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXxOi-0002Gp-0C for grub-devel@gnu.org; Thu, 02 May 2013 13:34:24 -0400 Received: by mail-ea0-f170.google.com with SMTP id z7so389363eaf.1 for ; Thu, 02 May 2013 10:34:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:date:from:to:subject:message-id:mime-version :content-type:content-disposition:user-agent:x-gm-message-state; bh=MesapuV7TvIy+CfwCepIzTxr+qQtsJTiT2KFgLBd0tY=; b=Jd+7XP9gzCQlK0oUykVDja30pnT/Ry0Je9nnRWaQchJkXf2D42M7K/w0iO5/0D83Ea cOObk17LDhtQ0UCx61DbutVvDckjk5OGaUQTHhgQ8Yg2PAN7+gWL68fu2DSSTLoaM5G8 vifaEeSNcuApXnHdS+a1V0UvYkggwBc7OXmlip3tDkJsTqbZa583B7Il1hRYXYIEQNP/ lSjnXC+5xQGTqHawxJjyAz7KkbN6dC7zu18KbBUbax5s311e9iSgcru5+9Hzrn87Yija cSfRxS6FHo0AH5iprQILCcHJWKDcYg5k+R/NjhqZd13cb3FI0bWzvQTPWE1D3AqUrqcp k3rA== X-Received: by 10.14.38.198 with SMTP id a46mr22077716eeb.11.1367516062770; Thu, 02 May 2013 10:34:22 -0700 (PDT) Received: from rocoto.smurfnet.nu ([2001:4b98:dc0:41:216:3eff:fea7:75f3]) by mx.google.com with ESMTPSA id bk42sm11073620eeb.3.2013.05.02.10.34.21 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 02 May 2013 10:34:22 -0700 (PDT) Date: Thu, 2 May 2013 17:34:54 +0000 From: Leif Lindholm To: grub-devel@gnu.org Subject: [PATCH] ARM U-Boot heap updates Message-ID: <20130502173454.GD28516@rocoto.smurfnet.nu> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="CblX+4bnyfN0pR09" Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-Gm-Message-State: ALoCoQn2Iaoh9teL1rB/a5Tu2JfpB2ld8XNq24pBxeoLOe8MgDxs+/47BI/cPGVh4Z51POhyEW31 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c01::22a X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 May 2013 17:34:34 -0000 --CblX+4bnyfN0pR09 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Again, patch is against http://bzr.savannah.gnu.org/r/grub/branches/arm - Increases heap size to 8MB. - Moves heap from after the stack in memory to before the stack, in order to be able to grow into the modules region post load. --CblX+4bnyfN0pR09 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="arm-uboot-heap-updates.patch" === 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 */ --CblX+4bnyfN0pR09--