summaryrefslogtreecommitdiff
path: root/kalloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'kalloc.c')
-rw-r--r--kalloc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/kalloc.c b/kalloc.c
index 14cd4f4..fb939b7 100644
--- a/kalloc.c
+++ b/kalloc.c
@@ -47,7 +47,7 @@ void
freerange(void *vstart, void *vend)
{
char *p;
- p = (char*)PGROUNDUP((uint)vstart);
+ p = (char*)PGROUNDUP((uint64)vstart);
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
kfree(p);
}
@@ -61,7 +61,7 @@ kfree(char *v)
{
struct run *r;
- if((uint)v % PGSIZE || v < end || V2P(v) >= PHYSTOP)
+ if((uint64)v % PGSIZE || v < end || V2P(v) >= PHYSTOP)
panic("kfree");
// Fill with junk to catch dangling refs.
@@ -91,6 +91,8 @@ kalloc(void)
kmem.freelist = r->next;
if(kmem.use_lock)
release(&kmem.lock);
+ if(r != 0 && (uint64) r < KERNBASE)
+ panic("kalloc");
return (char*)r;
}