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 --- openbios-devel/libopenbios/ofmem_common.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/openbios-devel/libopenbios/ofmem_common.c b/openbios-devel/libopenbios/ofmem_common.c index a7a0edf..63a0783 100644 --- a/openbios-devel/libopenbios/ofmem_common.c +++ b/openbios-devel/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 */