From 3597d5dc704c192a85b9902f7264fe9025aad277 Mon Sep 17 00:00:00 2001
From: Robert Morris <rtm@csail.mit.edu>
Date: Tue, 31 Aug 2010 19:21:33 -0400
Subject: [PATCH] oops. last minute simplicifaction to kalloc().

---
 kalloc.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/kalloc.c b/kalloc.c
index 8c9ff93..43e80e8 100644
--- a/kalloc.c
+++ b/kalloc.c
@@ -24,10 +24,9 @@ kinit(void)
   extern char end[];
 
   initlock(&kmem.lock, "kmem");
-  char *p1 = (char*)PGROUNDUP((uint)end);
-  char *p2 = PGROUNDDOWN(PHYSTOP);
-  for( ; p1 < p2; p1 += 4096)
-    kfree(p1);
+  char *p = (char*)PGROUNDUP((uint)end);
+  for( ; p + PGSIZE - 1 < (char*) PHYSTOP; p += PGSIZE)
+    kfree(p);
 }
 
 // Free the page of physical memory pointed at by v,
-- 
GitLab