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@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 */