From f552738889f56586728d1b5d2a63cde0cf124929 Mon Sep 17 00:00:00 2001 From: rsc Date: Wed, 6 Sep 2006 17:50:20 +0000 Subject: no /* */ comments --- kalloc.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) (limited to 'kalloc.c') diff --git a/kalloc.c b/kalloc.c index 2cd0ba8..83338c7 100644 --- a/kalloc.c +++ b/kalloc.c @@ -1,11 +1,9 @@ -/* - * physical memory allocator, intended to be used to allocate - * memory for user processes. allocates in 4096-byte "pages". - * free list is sorted and combines adjacent pages into - * long runs, to make it easier to allocate big segments. - * one reason the page size is 4k is that the x86 segment size - * granularity is 4k. - */ +// Physical memory allocator, intended to allocate +// memory for user processes. Allocates in 4096-byte "pages". +// Free list is kept sorted and combines adjacent pages into +// long runs, to make it easier to allocate big segments. +// One reason the page size is 4k is that the x86 segment size +// granularity is 4k. #include "param.h" #include "types.h" @@ -23,11 +21,10 @@ struct run { }; struct run *freelist; -/* - * initialize free list of physical pages. this code - * cheats by just considering the one megabyte of pages - * after _end. - */ +// Initialize free list of physical pages. +// This code cheats by just considering one megabyte of +// pages after _end. Real systems would determine the +// amount of memory available in the system and use it all. void kinit(void) { @@ -95,11 +92,9 @@ kfree(char *cp, int len) release(&kalloc_lock); } -/* - * allocate n bytes of physical memory. - * returns a kernel-segment pointer. - * returns 0 if there's no run that's big enough. - */ +// Allocate n bytes of physical memory. +// Returns a kernel-segment pointer. +// Returns 0 if the memory cannot be allocated. char* kalloc(int n) { -- cgit v1.2.3