diff options
author | rsc <rsc> | 2007-08-10 16:37:27 +0000 |
---|---|---|
committer | rsc <rsc> | 2007-08-10 16:37:27 +0000 |
commit | b6095304b7ee2b69d2ee4a9a7265999d1a2b9675 (patch) | |
tree | 3193df85e9fc228f512010d4bddf3aeb31e9993e /kalloc.c | |
parent | 3bbbaca14db70c6f255139c66a62b4cd5191462c (diff) | |
download | xv6-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.c | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -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); |