summaryrefslogtreecommitdiff
path: root/kalloc.c
diff options
context:
space:
mode:
authorFrans Kaashoek <[email protected]>2011-08-16 20:23:17 -0400
committerFrans Kaashoek <[email protected]>2011-08-16 20:23:17 -0400
commit5f069dcf2f9d833a6c4f58ed87269d61c6abb687 (patch)
tree4756e313b7681bbbb4a4c2d1879031bee6130681 /kalloc.c
parentc3dcf479663bc1bc9144c39ba2dd7607ea9c1c52 (diff)
downloadxv6-labs-5f069dcf2f9d833a6c4f58ed87269d61c6abb687.tar.gz
xv6-labs-5f069dcf2f9d833a6c4f58ed87269d61c6abb687.tar.bz2
xv6-labs-5f069dcf2f9d833a6c4f58ed87269d61c6abb687.zip
Switch back to #define for PHYSTOP. Using the E820 to retrieve the memory map is too complicated (must be done in 16-bit real-mode, probably enlarged bootblock beyond 512 bytes, and a #define requires less explanation).
Diffstat (limited to 'kalloc.c')
-rw-r--r--kalloc.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/kalloc.c b/kalloc.c
index 9ff3245..35ea6ed 100644
--- a/kalloc.c
+++ b/kalloc.c
@@ -19,7 +19,6 @@ struct {
} kmem;
extern char end[]; // first address after kernel loaded from ELF file
-extern uint maxpa; // Maximum physical address
static char *newend;
// simple page allocator to get off the ground during entry
@@ -51,7 +50,7 @@ kinit(void)
initlock(&kmem.lock, "kmem");
p = (char*)PGROUNDUP((uint)newend);
- for(; p + PGSIZE <= (char*)p2v(maxpa); p += PGSIZE)
+ for(; p + PGSIZE <= (char*)p2v(PHYSTOP); p += PGSIZE)
kfree(p);
}
@@ -65,7 +64,7 @@ kfree(char *v)
{
struct run *r;
- if((uint)v % PGSIZE || v < end || v2p(v) >= maxpa)
+ if((uint)v % PGSIZE || v < end || v2p(v) >= PHYSTOP)
panic("kfree");
// Fill with junk to catch dangling refs.