mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
Update totavail when memory is allocated by dumb memory allocator
git-svn-id: svn://coreboot.org/openbios/openbios-devel@154 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
@@ -53,8 +53,6 @@ static void (*sync_hook)(void);
|
|||||||
|
|
||||||
static struct linux_romvec romvec0;
|
static struct linux_romvec romvec0;
|
||||||
|
|
||||||
static unsigned long free_ram;
|
|
||||||
|
|
||||||
static void doublewalk(__attribute__((unused)) unsigned int ptab1,
|
static void doublewalk(__attribute__((unused)) unsigned int ptab1,
|
||||||
__attribute__((unused)) unsigned int va)
|
__attribute__((unused)) unsigned int va)
|
||||||
{
|
{
|
||||||
@@ -418,8 +416,9 @@ static char * obp_dumb_memalloc(char *va, unsigned int size)
|
|||||||
{
|
{
|
||||||
static unsigned int next_free_address = 0xFFEDA000;
|
static unsigned int next_free_address = 0xFFEDA000;
|
||||||
|
|
||||||
free_ram -= size;
|
totmap[0].num_bytes -= size;
|
||||||
DPRINTF("obp_dumb_memalloc req 0x%x of %d at 0x%x\n", va, size, free_ram);
|
DPRINTF("obp_dumb_memalloc req 0x%x of %d at 0x%x\n", va, size,
|
||||||
|
totmap[0].num_bytes);
|
||||||
|
|
||||||
// If va is null, the allocator is supposed to pick a "suitable" address.
|
// If va is null, the allocator is supposed to pick a "suitable" address.
|
||||||
// (See OpenSolaric prom_alloc.c) There's not any real guidance as
|
// (See OpenSolaric prom_alloc.c) There's not any real guidance as
|
||||||
@@ -432,7 +431,7 @@ static char * obp_dumb_memalloc(char *va, unsigned int size)
|
|||||||
DPRINTF("obp_dumb_memalloc req null -> 0x%x\n", va);
|
DPRINTF("obp_dumb_memalloc req null -> 0x%x\n", va);
|
||||||
}
|
}
|
||||||
|
|
||||||
obp_dumb_mmap(va, 0, free_ram, size);
|
obp_dumb_mmap(va, 0, totmap[0].num_bytes, size);
|
||||||
|
|
||||||
return va;
|
return va;
|
||||||
}
|
}
|
||||||
@@ -499,8 +498,6 @@ static void obp_fortheval_v2(char *str)
|
|||||||
void *
|
void *
|
||||||
init_openprom(unsigned long memsize)
|
init_openprom(unsigned long memsize)
|
||||||
{
|
{
|
||||||
free_ram = va2pa((int)&_start) - PAGE_SIZE;
|
|
||||||
|
|
||||||
ptphys = totphys;
|
ptphys = totphys;
|
||||||
ptmap = totmap;
|
ptmap = totmap;
|
||||||
ptavail = totavail;
|
ptavail = totavail;
|
||||||
@@ -514,7 +511,7 @@ init_openprom(unsigned long memsize)
|
|||||||
|
|
||||||
totavail[0].theres_more = NULL;
|
totavail[0].theres_more = NULL;
|
||||||
totavail[0].start_adr = (char *) 0;
|
totavail[0].start_adr = (char *) 0;
|
||||||
totavail[0].num_bytes = free_ram;
|
totavail[0].num_bytes = va2pa((int)&_start) - PAGE_SIZE;
|
||||||
|
|
||||||
totmap[0].theres_more = NULL;
|
totmap[0].theres_more = NULL;
|
||||||
totmap[0].start_adr = &_start;
|
totmap[0].start_adr = &_start;
|
||||||
|
|||||||
Reference in New Issue
Block a user