mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
ppc: Move malloc zone
ofmem was fixed at 0x05400000, followed by the malloc zone. The latter was bounded by the stack (now client stack), relative to the top of RAM. An increase of RAM would therefore only enlarge the malloc zone. Move the malloc zone below the client stack, with a fixed size of 2 MiB. The size is derived from the memory map depicted in ofmem.c; having a fixed size leaves room for memory claim'ed by clients and by OpenBIOS. v2: * Through the preceding patch the malloc zone goes below the client stack rather than below the stack. Adjust and prettify the illustration. Cc: Alexander Graf <agraf@suse.de> Signed-off-by: Andreas Färber <andreas.faerber@web.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com> git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@905 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
committed by
Blue Swirl
parent
c469e237e6
commit
076573e064
@@ -47,11 +47,9 @@ extern void setup_mmu( unsigned long code_base );
|
||||
#define FREE_BASE 0x00004000
|
||||
#define OF_CODE_START 0xfff00000UL
|
||||
#define IO_BASE 0x80000000
|
||||
#define OFMEM ((ofmem_t*)0x05400000)
|
||||
|
||||
#define OF_MALLOC_BASE ((char*)OFMEM + ((sizeof(ofmem_t) + 3) & ~3))
|
||||
|
||||
#define HASH_SIZE (2 << 15)
|
||||
#define OFMEM_SIZE (2 * 1024 * 1024)
|
||||
|
||||
#define SEGR_USER BIT(2)
|
||||
#define SEGR_BASE 0x0400
|
||||
@@ -86,7 +84,7 @@ get_rom_base( void )
|
||||
unsigned long
|
||||
get_ram_top( void )
|
||||
{
|
||||
return get_hash_base() - (32 + 64 + 64) * 1024;
|
||||
return get_hash_base() - (32 + 64 + 64) * 1024 - OFMEM_SIZE;
|
||||
}
|
||||
|
||||
unsigned long
|
||||
@@ -107,12 +105,12 @@ static inline size_t ALIGN_SIZE(size_t x, size_t a)
|
||||
|
||||
ofmem_t* ofmem_arch_get_private(void)
|
||||
{
|
||||
return OFMEM;
|
||||
return (ofmem_t*)(get_heap_top() - OFMEM_SIZE);
|
||||
}
|
||||
|
||||
void* ofmem_arch_get_malloc_base(void)
|
||||
{
|
||||
return OF_MALLOC_BASE;
|
||||
return (char*)ofmem_arch_get_private() + ALIGN_SIZE(sizeof(ofmem_t), 4);
|
||||
}
|
||||
|
||||
ucell ofmem_arch_get_heap_top(void)
|
||||
@@ -388,15 +386,12 @@ isi_exception( void )
|
||||
void
|
||||
setup_mmu( unsigned long ramsize )
|
||||
{
|
||||
ofmem_t *ofmem = OFMEM;
|
||||
ofmem_t *ofmem;
|
||||
unsigned long sdr1, sr_base, msr;
|
||||
unsigned long hash_base;
|
||||
unsigned long hash_mask = 0xffff0000;
|
||||
int i;
|
||||
|
||||
memset(ofmem, 0, sizeof(ofmem_t));
|
||||
ofmem->ramsize = ramsize;
|
||||
|
||||
/* SDR1: Storage Description Register 1 */
|
||||
|
||||
if(is_ppc64())
|
||||
@@ -415,6 +410,10 @@ setup_mmu( unsigned long ramsize )
|
||||
asm volatile("mtsrin %0,%1" :: "r" (sr_base + i), "r" (j) );
|
||||
}
|
||||
|
||||
ofmem = ofmem_arch_get_private();
|
||||
memset(ofmem, 0, sizeof(ofmem_t));
|
||||
ofmem->ramsize = ramsize;
|
||||
|
||||
memcpy((void *)get_rom_base(), (void *)OF_CODE_START, 0x00100000);
|
||||
|
||||
/* Enable MMU */
|
||||
|
||||
Reference in New Issue
Block a user