From 4587b35847b116057e3ef1058da914b8837ff343 Mon Sep 17 00:00:00 2001 From: Robert Morris Date: Sun, 19 Sep 2010 07:18:42 -0400 Subject: exec questions --- kalloc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'kalloc.c') diff --git a/kalloc.c b/kalloc.c index 5f690f5..72ce58a 100644 --- a/kalloc.c +++ b/kalloc.c @@ -17,12 +17,12 @@ struct { struct run *freelist; } kmem; +extern char end[]; // first address after kernel loaded from ELF file + // Initialize free list of physical pages. void kinit(void) { - extern char end[]; - initlock(&kmem.lock, "kmem"); char *p = (char*)PGROUNDUP((uint)end); for( ; p + PGSIZE - 1 < (char*) PHYSTOP; p += PGSIZE) @@ -39,7 +39,7 @@ kfree(char *v) { struct run *r; - if(((uint) v) % PGSIZE || (uint)v < 1024*1024 || (uint)v >= PHYSTOP) + if(((uint) v) % PGSIZE || v < end || (uint)v >= PHYSTOP) panic("kfree"); // Fill with junk to catch dangling refs. -- cgit v1.2.3