Index: kernel/generic/src/mm/frame.c
===================================================================
--- kernel/generic/src/mm/frame.c	(revision 69eac4aa01fc2a2eb07931b006cf18b42b9f0bd0)
+++ kernel/generic/src/mm/frame.c	(revision deaf8d550ca13cfcdab1e6faa67f3aaba90355a9)
@@ -130,9 +130,7 @@
 }
 
-/** Initialize frame structure
- *
- * Initialize frame structure.
- *
- * @param frame Frame structure to be initialized.
+/** Initialize frame structure.
+ *
+ * @param framei	Frame structure to be initialized.
  */
 static void frame_initialize(frame_t *frame)
@@ -146,9 +144,8 @@
 /**********************/
 
-/**
- * Insert-sort zone into zones list
- *
- * @param newzone New zone to be inserted into zone list
- * @return zone number on success, -1 on error
+/** Insert-sort zone into zones list.
+ *
+ * @param newzone	New zone to be inserted into zone list.
+ * @return		Zone number on success, -1 on error.
  */
 static int zones_add_zone(zone_t *newzone)
@@ -172,5 +169,6 @@
 		/* Check for overflow */
 		z = zones.info[i];
-		if (overlaps(newzone->base, newzone->count, z->base, z->count)) {
+		if (overlaps(newzone->base, newzone->count, z->base,
+		    z->count)) {
 			printf("Zones overlap!\n");
 			return -1;
@@ -194,14 +192,14 @@
 
 /**
- * Try to find a zone where can we find the frame
+ * Try to find a zone where can we find the frame.
  *
  * Assume interrupts are disabled.
  *
- * @param frame Frame number contained in zone
- * @param pzone If not null, it is used as zone hint. Zone index
- *              is filled into the variable on success. 
- * @return Pointer to locked zone containing frame
- */
-static zone_t * find_zone_and_lock(pfn_t frame, unsigned int *pzone)
+ * @param frame		Frame number contained in zone.
+ * @param pzone		If not null, it is used as zone hint. Zone index is
+ * 			filled into the variable on success. 
+ * @return		Pointer to locked zone containing frame.
+ */
+static zone_t *find_zone_and_lock(pfn_t frame, unsigned int *pzone)
 {
 	unsigned int i;
@@ -246,9 +244,9 @@
  * Assume interrupts are disabled.
  *
- * @param order Size (2^order) of free space we are trying to find
- * @param pzone Pointer to preferred zone or NULL, on return contains zone
- * 		number
- */
-static zone_t * find_free_zone_and_lock(uint8_t order, unsigned int *pzone)
+ * @param order		Size (2^order) of free space we are trying to find.
+ * @param pzone		Pointer to preferred zone or NULL, on return contains
+ * 			zone number.
+ */
+static zone_t *find_free_zone_and_lock(uint8_t order, unsigned int *pzone)
 {
 	unsigned int i;
@@ -284,10 +282,11 @@
 /**************************/
 
-/** Buddy system find_block implementation
+/** Buddy system find_block implementation.
  *
  * Find block that is parent of current list.
  * That means go to lower addresses, until such block is found
  *
- * @param order - Order of parent must be different then this parameter!!
+ * @param order		Order of parent must be different then this
+ * 			parameter!!
  */
 static link_t *zone_buddy_find_block(buddy_system_t *b, link_t *child,
@@ -322,10 +321,10 @@
 }				     
 
-/** Buddy system find_buddy implementation
- *
- * @param b Buddy system.
- * @param block Block for which buddy should be found
- *
- * @return Buddy for given block if found
+/** Buddy system find_buddy implementation.
+ *
+ * @param b		Buddy system.
+ * @param block		Block for which buddy should be found.
+ *
+ * @return		Buddy for given block if found.
  */
 static link_t *zone_buddy_find_buddy(buddy_system_t *b, link_t *block) 
@@ -346,7 +345,9 @@
 	ASSERT(is_left ^ is_right);
 	if (is_left) {
-		index = (frame_index(zone, frame)) + (1 << frame->buddy_order);
+		index = (frame_index(zone, frame)) +
+		    (1 << frame->buddy_order);
 	} else { 	/* if (is_right) */
-		index = (frame_index(zone, frame)) - (1 << frame->buddy_order);
+		index = (frame_index(zone, frame)) -
+		    (1 << frame->buddy_order);
 	}
 	
@@ -361,12 +362,13 @@
 }
 
-/** Buddy system bisect implementation
- *
- * @param b Buddy system.
- * @param block Block to bisect
- *
- * @return right block
- */
-static link_t * zone_buddy_bisect(buddy_system_t *b, link_t *block) {
+/** Buddy system bisect implementation.
+ *
+ * @param b		Buddy system.
+ * @param block		Block to bisect.
+ *
+ * @return		Right block.
+ */
+static link_t *zone_buddy_bisect(buddy_system_t *b, link_t *block)
+{
 	frame_t *frame_l, *frame_r;
 
@@ -377,11 +379,12 @@
 }
 
-/** Buddy system coalesce implementation
- *
- * @param b Buddy system.
- * @param block_1 First block
- * @param block_2 First block's buddy
- *
- * @return Coalesced block (actually block that represents lower address)
+/** Buddy system coalesce implementation.
+ *
+ * @param b		Buddy system.
+ * @param block_1	First block.
+ * @param block_2	First block's buddy.
+ *
+ * @return		Coalesced block (actually block that represents lower
+ * 			address).
  */
 static link_t *zone_buddy_coalesce(buddy_system_t *b, link_t *block_1, 
@@ -396,12 +399,13 @@
 }
 
-/** Buddy system set_order implementation
- *
- * @param b Buddy system.
- * @param block Buddy system block
- * @param order Order to set
+/** Buddy system set_order implementation.
+ *
+ * @param b		Buddy system.
+ * @param block		Buddy system block.
+ * @param order		Order to set.
  */
 static void zone_buddy_set_order(buddy_system_t *b, link_t *block,
-    uint8_t order) {
+    uint8_t order)
+{
 	frame_t *frame;
 	frame = list_get_instance(block, frame_t, buddy_link);
@@ -409,12 +413,13 @@
 }
 
-/** Buddy system get_order implementation
- *
- * @param b Buddy system.
- * @param block Buddy system block
- *
- * @return Order of block
- */
-static uint8_t zone_buddy_get_order(buddy_system_t *b, link_t *block) {
+/** Buddy system get_order implementation.
+ *
+ * @param b		Buddy system.
+ * @param block		Buddy system block.
+ *
+ * @return		Order of block.
+ */
+static uint8_t zone_buddy_get_order(buddy_system_t *b, link_t *block)
+{
 	frame_t *frame;
 	frame = list_get_instance(block, frame_t, buddy_link);
@@ -422,11 +427,11 @@
 }
 
-/** Buddy system mark_busy implementation
- *
- * @param b Buddy system
- * @param block Buddy system block
- *
- */
-static void zone_buddy_mark_busy(buddy_system_t *b, link_t * block) {
+/** Buddy system mark_busy implementation.
+ *
+ * @param b		Buddy system.
+ * @param block		Buddy system block.
+ */
+static void zone_buddy_mark_busy(buddy_system_t *b, link_t * block)
+{
 	frame_t * frame;
 
@@ -435,11 +440,11 @@
 }
 
-/** Buddy system mark_available implementation
- *
- * @param b Buddy system
- * @param block Buddy system block
- *
- */
-static void zone_buddy_mark_available(buddy_system_t *b, link_t *block) {
+/** Buddy system mark_available implementation.
+ *
+ * @param b		Buddy system.
+ * @param block		Buddy system block.
+ */
+static void zone_buddy_mark_available(buddy_system_t *b, link_t *block)
+{
 	frame_t *frame;
 	frame = list_get_instance(block, frame_t, buddy_link);
@@ -463,13 +468,13 @@
 /******************/
 
-/** Allocate frame in particular zone
- *
- * Assume zone is locked
+/** Allocate frame in particular zone.
+ *
+ * Assume zone is locked.
  * Panics if allocation is impossible.
  *
- * @param zone  Zone to allocate from.
- * @param order Allocate exactly 2^order frames.
- *
- * @return Frame index in zone
+ * @param zone		Zone to allocate from.
+ * @param order		Allocate exactly 2^order frames.
+ *
+ * @return		Frame index in zone.
  *
  */
@@ -497,10 +502,10 @@
 }
 
-/** Free frame from zone
- *
- * Assume zone is locked
- *
- * @param zone Pointer to zone from which the frame is to be freed
- * @param frame_idx Frame index relative to zone
+/** Free frame from zone.
+ *
+ * Assume zone is locked.
+ *
+ * @param zone		Pointer to zone from which the frame is to be freed.
+ * @param frame_idx	Frame index relative to zone.
  */
 static void zone_frame_free(zone_t *zone, index_t frame_idx)
@@ -525,5 +530,5 @@
 }
 
-/** Return frame from zone */
+/** Return frame from zone. */
 static frame_t * zone_get_frame(zone_t *zone, index_t frame_idx)
 {
@@ -532,5 +537,5 @@
 }
 
-/** Mark frame in zone unavailable to allocation */
+/** Mark frame in zone unavailable to allocation. */
 static void zone_mark_unavailable(zone_t *zone, index_t frame_idx)
 {
@@ -547,14 +552,13 @@
 }
 
-/** 
- * Join 2 zones
- *
- * Expect zone_t *z to point to space at least zone_conf_size large
- *
- * Assume z1 & z2 are locked 
- *
- * @param z Target zone structure pointer
- * @param z1 Zone to merge
- * @param z2 Zone to merge
+/** Join two zones.
+ *
+ * Expect zone_t *z to point to space at least zone_conf_size large.
+ *
+ * Assume z1 & z2 are locked.
+ *
+ * @param z		Target zone structure pointer.
+ * @param z1		Zone to merge.
+ * @param z2		Zone to merge.
  */
 static void _zone_merge(zone_t *z, zone_t *z1, zone_t *z2)
@@ -630,5 +634,5 @@
 }
 
-/** Return old configuration frames into the zone
+/** Return old configuration frames into the zone.
  *
  * We have several cases
@@ -637,7 +641,7 @@
  *   updated with reduce_region -> free every frame
  *
- * @param newzone The actual zone where freeing should occur
- * @param oldzone Pointer to old zone configuration data that should
- *                be freed from new zone
+ * @param newzone	The actual zone where freeing should occur.
+ * @param oldzone	Pointer to old zone configuration data that should
+ * 			be freed from new zone.
  */
 static void return_config_frames(zone_t *newzone, zone_t *oldzone)
@@ -663,5 +667,5 @@
 }
 
-/** Reduce allocated block to count of order 0 frames
+/** Reduce allocated block to count of order 0 frames.
  *
  * The allocated block need 2^order frames of space. Reduce all frames
@@ -671,6 +675,6 @@
  *
  * @param zone 
- * @param frame_idx Index to block 
- * @param count Allocated space in block
+ * @param frame_idx		Index to block.
+ * @param count			Allocated space in block.
  */
 static void zone_reduce_region(zone_t *zone, pfn_t frame_idx, count_t count)
@@ -699,5 +703,5 @@
 }
 
-/** Merge zones z1 and z2
+/** Merge zones z1 and z2.
  *
  * - the zones must be 2 zones with no zone existing in between,
@@ -774,6 +778,5 @@
 }
 
-/**
- * Merge all zones into one big zone
+/** Merge all zones into one big zone.
  *
  * It is reasonable to do this on systems whose bios reports parts in chunks,
@@ -790,14 +793,12 @@
 }
 
-/** Create frame zone
- *
- * Create new frame zone.
- *
- * @param start Physical address of the first frame within the zone.
- * @param count Count of frames in zone
- * @param z Address of configuration information of zone
- * @param flags Zone flags.
- *
- * @return Initialized zone.
+/** Create new frame zone.
+ *
+ * @param start		Physical address of the first frame within the zone.
+ * @param count		Count of frames in zone.
+ * @param z		Address of configuration information of zone.
+ * @param flags		Zone flags.
+ *
+ * @return		Initialized zone.
  */
 static void zone_construct(pfn_t start, count_t count, zone_t *z, int flags)
@@ -820,6 +821,5 @@
 	
 	buddy_system_create(z->buddy_system, max_order, 
-			    &zone_buddy_system_operations, 
-			    (void *) z);
+	    &zone_buddy_system_operations, (void *) z);
 	
 	/* Allocate frames _after_ the conframe */
@@ -838,8 +838,8 @@
 }
 
-/** Compute configuration data size for zone
- *
- * @param count Size of zone in frames
- * @return Size of zone configuration info (in bytes)
+/** Compute configuration data size for zone.
+ *
+ * @param count		Size of zone in frames.
+ * @return		Size of zone configuration info (in bytes).
  */
 uintptr_t zone_conf_size(count_t count)
@@ -853,18 +853,18 @@
 }
 
-/** Create and add zone to system
- *
- * @param start First frame number (absolute)
- * @param count Size of zone in frames
- * @param confframe Where configuration frames are supposed to be.
- *                  Automatically checks, that we will not disturb the 
- *                  kernel and possibly init. 
- *                  If confframe is given _outside_ this zone, it is expected,
- *                  that the area is already marked BUSY and big enough
- *                  to contain zone_conf_size() amount of data.
- *                  If the confframe is inside the area, the zone free frame
- *                  information is modified not to include it.
- *
- * @return Zone number or -1 on error
+/** Create and add zone to system.
+ *
+ * @param start		First frame number (absolute).
+ * @param count		Size of zone in frames.
+ * @param confframe	Where configuration frames are supposed to be.
+ * 			Automatically checks, that we will not disturb the 
+ * 			kernel and possibly init.  If confframe is given
+ * 			_outside_ this zone, it is expected, that the area is
+ * 			already marked BUSY and big enough to contain
+ * 			zone_conf_size() amount of data.  If the confframe is
+ * 			inside the area, the zone free frame information is
+ * 			modified not to include it.
+ *
+ * @return		Zone number or -1 on error.
  */
 int zone_create(pfn_t start, count_t count, pfn_t confframe, int flags)
@@ -931,5 +931,5 @@
 /* Frame functions */
 
-/** Set parent of frame */
+/** Set parent of frame. */
 void frame_set_parent(pfn_t pfn, void *data, unsigned int hint)
 {
@@ -956,12 +956,12 @@
 /** Allocate power-of-two frames of physical memory.
  *
- * @param order  Allocate exactly 2^order frames.
- * @param flags  Flags for host zone selection and address processing.
- * @param pzone  Preferred zone
- *
- * @return Physical address of the allocated frame.
- *
- */
-void * frame_alloc_generic(uint8_t order, int flags, unsigned int *pzone) 
+ * @param order		Allocate exactly 2^order frames.
+ * @param flags		Flags for host zone selection and address processing.
+ * @param pzone		Preferred zone.
+ *
+ * @return		Physical address of the allocated frame.
+ *
+ */
+void *frame_alloc_generic(uint8_t order, int flags, unsigned int *pzone)
 {
 	ipl_t ipl;
@@ -1020,5 +1020,5 @@
  * If it drops to zero, move the frame structure to free list.
  *
- * @param Frame Physical Address of of the frame to be freed.
+ * @param frame		Physical Address of of the frame to be freed.
  */
 void frame_free(uintptr_t frame)
@@ -1047,5 +1047,5 @@
  * increment frame reference count.
  *
- * @param pfn Frame number of the frame to be freed.
+ * @param pfn		Frame number of the frame to be freed.
  */
 void frame_reference_add(pfn_t pfn)
@@ -1060,8 +1060,8 @@
 	 * First, find host frame zone for addr.
 	 */
-	zone = find_zone_and_lock(pfn,NULL);
+	zone = find_zone_and_lock(pfn, NULL);
 	ASSERT(zone);
 	
-	frame = &zone->frames[pfn-zone->base];
+	frame = &zone->frames[pfn - zone->base];
 	frame->refcount++;
 	
@@ -1070,5 +1070,5 @@
 }
 
-/** Mark given range unavailable in frame zones */
+/** Mark given range unavailable in frame zones. */
 void frame_mark_unavailable(pfn_t start, count_t count)
 {
@@ -1087,8 +1087,5 @@
 }
 
-/** Initialize physical memory management
- *
- * Initialize physical memory managemnt.
- */
+/** Initialize physical memory management. */
 void frame_init(void)
 {
@@ -1123,8 +1120,7 @@
 
 
-/** Return total size of all zones
- *
- */
-uint64_t zone_total_size(void) {
+/** Return total size of all zones. */
+uint64_t zone_total_size(void)
+{
 	zone_t *zone = NULL;
 	unsigned int i;
@@ -1148,10 +1144,7 @@
 }
 
-
-
-/** Prints list of zones
- *
- */
-void zone_print_list(void) {
+/** Prints list of zones. */
+void zone_print_list(void)
+{
 	zone_t *zone = NULL;
 	unsigned int i;
@@ -1176,11 +1169,12 @@
 
 #ifdef __32_BITS__
-		printf("%-2u   %10p %12" PRIc " %12" PRIc "\n", i, PFN2ADDR(zone->base),
-		    zone->free_count, zone->busy_count);
+		printf("%-2u   %10p %12" PRIc " %12" PRIc "\n",
+		    i, PFN2ADDR(zone->base), zone->free_count,
+		    zone->busy_count);
 #endif
 
 #ifdef __64_BITS__
-		printf("%-2u   %18p %12" PRIc " %12" PRIc "\n", i, PFN2ADDR(zone->base),
-		    zone->free_count, zone->busy_count);
+		printf("%-2u   %18p %12" PRIc " %12" PRIc "\n", i,
+		    PFN2ADDR(zone->base), zone->free_count, zone->busy_count);
 #endif
 		
@@ -1194,7 +1188,8 @@
 /** Prints zone details.
  *
- * @param num Zone base address or zone number.
- */
-void zone_print_one(unsigned int num) {
+ * @param num		Zone base address or zone number.
+ */
+void zone_print_one(unsigned int num)
+{
 	zone_t *zone = NULL;
 	ipl_t ipl;
@@ -1219,9 +1214,9 @@
 	printf("Zone base address: %p\n", PFN2ADDR(zone->base));
 	printf("Zone size: %" PRIc " frames (%" PRIs " KB)\n", zone->count,
-		SIZE2KB(FRAMES2SIZE(zone->count)));
-	printf("Allocated space: %" PRIc " frames (%" PRIs " KB)\n", zone->busy_count,
-		SIZE2KB(FRAMES2SIZE(zone->busy_count)));
-	printf("Available space: %" PRIc " frames (%" PRIs " KB)\n", zone->free_count,
-		SIZE2KB(FRAMES2SIZE(zone->free_count)));
+	    SIZE2KB(FRAMES2SIZE(zone->count)));
+	printf("Allocated space: %" PRIc " frames (%" PRIs " KB)\n",
+	    zone->busy_count, SIZE2KB(FRAMES2SIZE(zone->busy_count)));
+	printf("Available space: %" PRIc " frames (%" PRIs " KB)\n",
+	    zone->free_count, SIZE2KB(FRAMES2SIZE(zone->free_count)));
 	buddy_system_structure_print(zone->buddy_system, FRAME_SIZE);
 	spinlock_unlock(&zone->lock);
