pc: move low-level allocation details out of mmu.c into memory.c rampage() function
This commit is contained in:
parent
0ee738ef8c
commit
c0f464b98f
2 changed files with 4 additions and 10 deletions
|
@ -224,6 +224,8 @@ rampage(void)
|
||||||
{
|
{
|
||||||
ulong m;
|
ulong m;
|
||||||
|
|
||||||
|
if(conf.mem[0].npage != 0)
|
||||||
|
return xspanalloc(BY2PG, BY2PG, 0);
|
||||||
m = mapalloc(&rmapram, 0, BY2PG, BY2PG);
|
m = mapalloc(&rmapram, 0, BY2PG, BY2PG);
|
||||||
if(m == 0)
|
if(m == 0)
|
||||||
return nil;
|
return nil;
|
||||||
|
|
|
@ -523,17 +523,9 @@ mmuwalk(ulong* pdb, ulong va, int level, int create)
|
||||||
if(*table & PTESIZE)
|
if(*table & PTESIZE)
|
||||||
panic("mmuwalk2: va %luX entry %luX", va, *table);
|
panic("mmuwalk2: va %luX entry %luX", va, *table);
|
||||||
if(!(*table & PTEVALID)){
|
if(!(*table & PTEVALID)){
|
||||||
/*
|
map = rampage();
|
||||||
* Have to call low-level allocator from
|
|
||||||
* memory.c if we haven't set up the xalloc
|
|
||||||
* tables yet.
|
|
||||||
*/
|
|
||||||
if(conf.mem[0].npage != 0)
|
|
||||||
map = xspanalloc(BY2PG, BY2PG, 0);
|
|
||||||
else
|
|
||||||
map = rampage();
|
|
||||||
if(map == nil)
|
if(map == nil)
|
||||||
panic("mmuwalk xspanalloc failed");
|
panic("mmuwalk: page alloc failed");
|
||||||
*table = PADDR(map)|PTEWRITE|PTEVALID;
|
*table = PADDR(map)|PTEWRITE|PTEVALID;
|
||||||
}
|
}
|
||||||
table = KADDR(PPN(*table));
|
table = KADDR(PPN(*table));
|
||||||
|
|
Loading…
Reference in a new issue