Patchwork [11/14] Allocate malloc region with prom_claim_chunk_top

login
register
mail settings
Submitter Anton Blanchard
Date July 9, 2010, 5:03 a.m.
Message ID <20100709050342.351252117@samba.org>
Download mbox | patch
Permalink /patch/58334/
State Changes Requested
Headers show

Comments

Anton Blanchard - July 9, 2010, 5:03 a.m.
We want the kernel and initrd to be as low as possible in the
address space. Allocate the temporary malloc region at the top
of the address space.

Signed-off-by: Anton Blanchard <anton@samba.org>
---

Patch

Index: yaboot/Makefile
===================================================================
--- yaboot.orig/Makefile	2010-07-08 17:03:10.000000000 +1000
+++ yaboot/Makefile	2010-07-08 17:04:17.000000000 +1000
@@ -17,8 +17,7 @@  GETROOT = fakeroot
 
 # Load the bootstrap at 2Mb
 TEXTADDR	= 0x200000
-# Malloc block at 3Mb -> 4Mb
-MALLOCADDR	= 0x300000
+# Malloc block of 1MB
 MALLOCSIZE	= 0x100000
 # Load kernel and ramdisk at real-base.  If there is overlap, will retry until find open space
 KERNELADDR	= 0x00C00000
Index: yaboot/second/yaboot.c
===================================================================
--- yaboot.orig/second/yaboot.c	2010-07-08 17:03:57.000000000 +1000
+++ yaboot/second/yaboot.c	2010-07-08 17:03:59.000000000 +1000
@@ -185,10 +185,10 @@  yaboot_start (unsigned long r3, unsigned
      prom_claim_chunk(0, 128 * 1024 * 1024, 0);
 
      /* Allocate some memory for malloc'ator */
-     malloc_base = prom_claim_chunk((void *)MALLOCADDR, MALLOCSIZE, 0);
+     malloc_base = prom_claim_chunk_top(MALLOCSIZE, 0);
      if (malloc_base == (void *)-1) {
-	  prom_printf("Can't claim malloc buffer (%d bytes at 0x%08x)\n",
-		      MALLOCSIZE, MALLOCADDR);
+	  prom_printf("Can't claim malloc buffer of %d bytes\n",
+		      MALLOCSIZE);
 	  return -1;
      }
      malloc_init(malloc_base, MALLOCSIZE);