grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM U-Boot heap updates
@ 2013-05-02 17:34 Leif Lindholm
  2013-05-03 12:17 ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 1 reply; 2+ messages in thread
From: Leif Lindholm @ 2013-05-02 17:34 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 234 bytes --]

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.

[-- Attachment #2: arm-uboot-heap-updates.patch --]
[-- Type: text/x-diff, Size: 2182 bytes --]

=== 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.
  * <modules>:
  *              Loadable modules, post relocation.
+ * <heap>:
  * <stack>:     
- * <heap>:
  */
 	
 	.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 */


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ARM U-Boot heap updates
  2013-05-02 17:34 [PATCH] ARM U-Boot heap updates Leif Lindholm
@ 2013-05-03 12:17 ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 0 replies; 2+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2013-05-03 12:17 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 464 bytes --]

On 02.05.2013 19:34, Leif Lindholm wrote:

> 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.
> 

Why not use the order:
<core><stack><modules><heap>
This would allow setting the size of heap in function of available RAM,
rather than hardcodding its size.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-05-03 12:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-02 17:34 [PATCH] ARM U-Boot heap updates Leif Lindholm
2013-05-03 12:17 ` Vladimir 'φ-coder/phcoder' Serbinenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).