pc: move low-level allocation details out of mmu.c into memory.c rampage() function

This commit is contained in:
cinap_lenrek 2019-10-02 01:01:34 +02:00
parent 0ee738ef8c
commit c0f464b98f
2 changed files with 4 additions and 10 deletions

View file

@ -224,6 +224,8 @@ rampage(void)
{
ulong m;
if(conf.mem[0].npage != 0)
return xspanalloc(BY2PG, BY2PG, 0);
m = mapalloc(&rmapram, 0, BY2PG, BY2PG);
if(m == 0)
return nil;

View file

@ -523,17 +523,9 @@ mmuwalk(ulong* pdb, ulong va, int level, int create)
if(*table & PTESIZE)
panic("mmuwalk2: va %luX entry %luX", va, *table);
if(!(*table & PTEVALID)){
/*
* 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();
map = rampage();
if(map == nil)
panic("mmuwalk xspanalloc failed");
panic("mmuwalk: page alloc failed");
*table = PADDR(map)|PTEWRITE|PTEVALID;
}
table = KADDR(PPN(*table));