summaryrefslogtreecommitdiff
path: root/kalloc.c
diff options
context:
space:
mode:
authorrsc <rsc>2007-08-10 16:37:27 +0000
committerrsc <rsc>2007-08-10 16:37:27 +0000
commitb6095304b7ee2b69d2ee4a9a7265999d1a2b9675 (patch)
tree3193df85e9fc228f512010d4bddf3aeb31e9993e /kalloc.c
parent3bbbaca14db70c6f255139c66a62b4cd5191462c (diff)
downloadxv6-labs-b6095304b7ee2b69d2ee4a9a7265999d1a2b9675.tar.gz
xv6-labs-b6095304b7ee2b69d2ee4a9a7265999d1a2b9675.tar.bz2
xv6-labs-b6095304b7ee2b69d2ee4a9a7265999d1a2b9675.zip
Make cp a magic symbol.
Diffstat (limited to 'kalloc.c')
-rw-r--r--kalloc.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/kalloc.c b/kalloc.c
index bfa9207..cc2faac 100644
--- a/kalloc.c
+++ b/kalloc.c
@@ -40,24 +40,22 @@ kinit(void)
kfree(start, mem * PAGE);
}
-// Free the len bytes of memory pointed at by cp,
+// Free the len bytes of memory pointed at by v,
// which normally should have been returned by a
-// call to kalloc(cp). (The exception is when
+// call to kalloc(len). (The exception is when
// initializing the allocator; see kinit above.)
void
-kfree(char *cp, int len)
+kfree(char *v, int len)
{
struct run **rr;
- struct run *p = (struct run*) cp;
- struct run *pend = (struct run*) (cp + len);
- int i;
+ struct run *p = (struct run*)v;
+ struct run *pend = (struct run*)(v + len);
if(len % PAGE)
panic("kfree");
// Fill with junk to catch dangling refs.
- for(i = 0; i < len; i++)
- cp[i] = 1;
+ memset(v, 1, len);
acquire(&kalloc_lock);