From da61112722c98a8551b8395b1baf494930d716fb Mon Sep 17 00:00:00 2001 From: mcayland Date: Thu, 30 Dec 2010 13:56:28 +0000 Subject: [PATCH] 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 git-svn-id: svn://openbios.org/openbios/trunk/openbios-devel@996 f158a5a8-5612-0410-a976-696ce0be7e32 --- libopenbios/ofmem_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libopenbios/ofmem_common.c b/libopenbios/ofmem_common.c index e93b938..34caa2f 100644 --- a/libopenbios/ofmem_common.c +++ b/libopenbios/ofmem_common.c @@ -511,7 +511,7 @@ phys_addr_t ofmem_claim_phys( phys_addr_t phys, ucell size, ucell align ) " 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 @@ ucell ofmem_claim_virt( ucell virt, ucell size, ucell align ) /* 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 */ -- 2.11.4.GIT