shithub: riscv

Download patch

ref: c0f464b98fde437a1c6556006e87662827d77096
parent: 0ee738ef8c34d5494265b8a14435333f45b96dc6
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Tue Oct 1 21:01:34 EDT 2019

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

--- a/sys/src/9/pc/memory.c
+++ b/sys/src/9/pc/memory.c
@@ -224,6 +224,8 @@
 {
 	ulong m;
 	
+	if(conf.mem[0].npage != 0)
+		return xspanalloc(BY2PG, BY2PG, 0);
 	m = mapalloc(&rmapram, 0, BY2PG, BY2PG);
 	if(m == 0)
 		return nil;
--- a/sys/src/9/pc/mmu.c
+++ b/sys/src/9/pc/mmu.c
@@ -523,17 +523,9 @@
 		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));