diff options
Diffstat (limited to 'kalloc.c')
-rw-r--r-- | kalloc.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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; } |