[OpenBIOS] [commit] r996 - trunk/openbios-devel/libopenbios

repository service svn at openbios.org
Thu Dec 30 14:56:29 CET 2010


Author: mcayland
Date: Thu Dec 30 14:56:28 2010
New Revision: 996
URL: http://tracker.coreboot.org/trac/openbios/changeset/996

Log:
Change OFMEM to allocate memory from the top of RAM downwards.

At the moment OFMEM allocates memory from the bottom of RAM upwards, however many loaders/kernels initialise themselves in lower
memory areas which can cause them to be overwritten by subsequent memory allocations. Mimic the existing SPARC32 behaviour by
allocating physical and virtual memory from the top of RAM downwards.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at siriusit.co.uk>

Modified:
   trunk/openbios-devel/libopenbios/ofmem_common.c

Modified: trunk/openbios-devel/libopenbios/ofmem_common.c
==============================================================================
--- trunk/openbios-devel/libopenbios/ofmem_common.c	Thu Dec 30 14:56:24 2010	(r995)
+++ trunk/openbios-devel/libopenbios/ofmem_common.c	Thu Dec 30 14:56:28 2010	(r996)
@@ -511,7 +511,7 @@
                 " align=" FMT_ucellx "\n",
                 phys, size, align);
 
-	return ofmem_claim_phys_( phys, size, align, 0, ofmem_arch_get_phys_top(), 0 );
+	return ofmem_claim_phys_( phys, size, align, 0, ofmem_arch_get_phys_top(), 1 );
 }
 
 static ucell ofmem_claim_virt_( ucell virt, ucell size, ucell align,
@@ -544,7 +544,7 @@
 
 	/* printk("+ ofmem_claim virt %08lx %lx %ld\n", virt, size, align ); */
 	return ofmem_claim_virt_( virt, size, align,
-			get_ram_size(), ofmem_arch_get_virt_top(), 0 );
+			get_ram_size(), ofmem_arch_get_virt_top(), 1 );
 }
 
 /* if align != 0, phys is ignored. Returns -1 on error */



More information about the OpenBIOS mailing list