Index: kernel/generic/src/mm/frame.c
===================================================================
--- kernel/generic/src/mm/frame.c	(revision d630139332f649889fde186aaa1729516725c881)
+++ kernel/generic/src/mm/frame.c	(revision 5d7daffb996b8fe2ed2955eedceaf948fc1a9f75)
@@ -71,5 +71,6 @@
 	count_t refcount;	/**< tracking of shared frames  */
 	uint8_t buddy_order;	/**< buddy system block order */
-	link_t buddy_link;	/**< link to the next free block inside one order */
+	link_t buddy_link;	/**< link to the next free block inside one
+				     order */
 	void *parent;           /**< If allocated by slab, this points there */
 } frame_t;
@@ -77,8 +78,10 @@
 typedef struct {
 	SPINLOCK_DECLARE(lock);	/**< this lock protects everything below */
-	pfn_t base;		/**< frame_no of the first frame in the frames array */
+	pfn_t base;		/**< frame_no of the first frame in the frames
+				     array */
 	count_t count;          /**< Size of zone */
 
-	frame_t *frames;	/**< array of frame_t structures in this zone */
+	frame_t *frames;	/**< array of frame_t structures in this
+				     zone */
 	count_t free_count;	/**< number of free frame_t structures */
 	count_t busy_count;	/**< number of busy frame_t structures */
@@ -158,6 +161,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;
@@ -167,5 +170,5 @@
 	}
 	/* Move other zones up */
-	for (j = i;j < zones.count; j++)
+	for (j = i; j < zones.count; j++)
 		zones.info[j + 1] = zones.info[j];
 	zones.info[i] = newzone;
@@ -203,5 +206,6 @@
 		spinlock_lock(&z->lock);
 		if (z->base <= frame && z->base + z->count > frame) {
-			spinlock_unlock(&zones.lock); /* Unlock the global lock */
+			/* Unlock the global lock */
+			spinlock_unlock(&zones.lock); 
 			if (pzone)
 				*pzone = i;
@@ -230,5 +234,6 @@
  *
  * @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
+ * @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)
@@ -274,8 +279,8 @@
  */
 static link_t *zone_buddy_find_block(buddy_system_t *b, link_t *child,
-				     uint8_t order)
-{
-	frame_t * frame;
-	zone_t * zone;
+    uint8_t order)
+{
+	frame_t *frame;
+	zone_t *zone;
 	index_t index;
 	
@@ -294,6 +299,6 @@
 static void zone_buddy_print_id(buddy_system_t *b, link_t *block)
 {
-	frame_t * frame;
-	zone_t * zone;
+	frame_t *frame;
+	zone_t *zone;
 	index_t index;
 
@@ -311,8 +316,8 @@
  * @return Buddy for given block if found
  */
-static link_t * zone_buddy_find_buddy(buddy_system_t *b, link_t * block) 
-{
-	frame_t * frame;
-	zone_t * zone;
+static link_t *zone_buddy_find_buddy(buddy_system_t *b, link_t *block) 
+{
+	frame_t *frame;
+	zone_t *zone;
 	index_t index;
 	bool is_left, is_right;
@@ -320,5 +325,6 @@
 	frame = list_get_instance(block, frame_t, buddy_link);
 	zone = (zone_t *) b->data;
-	ASSERT(IS_BUDDY_ORDER_OK(frame_index_abs(zone, frame), frame->buddy_order));
+	ASSERT(IS_BUDDY_ORDER_OK(frame_index_abs(zone, frame),
+	    frame->buddy_order));
 	
 	is_left = IS_BUDDY_LEFT_BLOCK_ABS(zone, frame);
@@ -349,6 +355,6 @@
  * @return right block
  */
-static link_t * zone_buddy_bisect(buddy_system_t *b, link_t * block) {
-	frame_t * frame_l, * frame_r;
+static link_t * zone_buddy_bisect(buddy_system_t *b, link_t *block) {
+	frame_t *frame_l, *frame_r;
 
 	frame_l = list_get_instance(block, frame_t, buddy_link);
@@ -366,6 +372,6 @@
  * @return Coalesced block (actually block that represents lower address)
  */
-static link_t * zone_buddy_coalesce(buddy_system_t *b, link_t * block_1, 
-				    link_t * block_2) 
+static link_t *zone_buddy_coalesce(buddy_system_t *b, link_t *block_1, 
+    link_t *block_2) 
 {
 	frame_t *frame1, *frame2;
@@ -383,6 +389,7 @@
  * @param order Order to set
  */
-static void zone_buddy_set_order(buddy_system_t *b, link_t * block, uint8_t order) {
-	frame_t * frame;
+static void zone_buddy_set_order(buddy_system_t *b, link_t *block,
+    uint8_t order) {
+	frame_t *frame;
 	frame = list_get_instance(block, frame_t, buddy_link);
 	frame->buddy_order = order;
@@ -396,6 +403,6 @@
  * @return Order of block
  */
-static uint8_t zone_buddy_get_order(buddy_system_t *b, link_t * block) {
-	frame_t * frame;
+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);
 	return frame->buddy_order;
@@ -421,6 +428,6 @@
  *
  */
-static void zone_buddy_mark_available(buddy_system_t *b, link_t * block) {
-	frame_t * frame;
+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);
 	frame->refcount = 0;
@@ -521,6 +528,6 @@
 	if (frame->refcount)
 		return;
-	link = buddy_system_alloc_block(zone->buddy_system, 
-					&frame->buddy_link);
+	link = buddy_system_alloc_block(zone->buddy_system,
+	    &frame->buddy_link);
 	ASSERT(link);
 	zone->free_count--;
@@ -546,10 +553,10 @@
 	frame_t *frame;
 
-	ASSERT(!overlaps(z1->base,z1->count,z2->base,z2->count));
+	ASSERT(!overlaps(z1->base, z1->count, z2->base, z2->count));
 	ASSERT(z1->base < z2->base);
 
 	spinlock_initialize(&z->lock, "zone_lock");
 	z->base = z1->base;
-	z->count = z2->base+z2->count - z1->base;
+	z->count = z2->base + z2->count - z1->base;
 	z->flags = z1->flags & z2->flags;
 
@@ -559,10 +566,10 @@
 	max_order = fnzb(z->count);
 
-	z->buddy_system = (buddy_system_t *)&z[1];
-	buddy_system_create(z->buddy_system, max_order, 
-			    &zone_buddy_system_operations, 
-			    (void *) z);
-
-	z->frames = (frame_t *)((uint8_t *) z->buddy_system + buddy_conf_size(max_order));
+	z->buddy_system = (buddy_system_t *) &z[1];
+	buddy_system_create(z->buddy_system, max_order,
+	    &zone_buddy_system_operations, (void *) z);
+
+	z->frames = (frame_t *)((uint8_t *) z->buddy_system +
+	    buddy_conf_size(max_order));
 	for (i = 0; i < z->count; i++) {
 		/* This marks all frames busy */
@@ -604,5 +611,5 @@
 	while (zone_can_alloc(z2, 0)) {
 		frame_idx = zone_frame_alloc(z2, 0);
-		frame = &z->frames[frame_idx + (z2->base-z1->base)];
+		frame = &z->frames[frame_idx + (z2->base - z1->base)];
 		frame->refcount = 0;
 		buddy_system_free(z->buddy_system, &frame->buddy_link);
@@ -669,5 +676,5 @@
 		frame = &zone->frames[i + frame_idx];
 		frame->buddy_order = 0;
-		if (! frame->refcount)
+		if (!frame->refcount)
 			frame->refcount = 1;
 		ASSERT(frame->refcount == 1);
@@ -711,5 +718,6 @@
 	spinlock_lock(&zone2->lock);
 
-	cframes = SIZE2FRAMES(zone_conf_size(zone2->base+zone2->count-zone1->base));
+	cframes = SIZE2FRAMES(zone_conf_size(zone2->base + zone2->count -
+	    zone1->base));
 	if (cframes == 1)
 		order = 0;
@@ -804,5 +812,6 @@
 	/* Allocate frames _after_ the conframe */
 	/* Check sizes */
-	z->frames = (frame_t *)((uint8_t *) z->buddy_system + buddy_conf_size(max_order));
+	z->frames = (frame_t *)((uint8_t *) z->buddy_system +
+	    buddy_conf_size(max_order));
 	for (i = 0; i < count; i++) {
 		frame_initialize(&z->frames[i]);
@@ -866,8 +875,10 @@
 		for (;confframe < start + count; confframe++) {
 			addr = PFN2ADDR(confframe);
-			if (overlaps(addr, PFN2ADDR(confcount), KA2PA(config.base), config.kernel_size))
+			if (overlaps(addr, PFN2ADDR(confcount),
+			    KA2PA(config.base), config.kernel_size))
 				continue;
 			
-			if (overlaps(addr, PFN2ADDR(confcount), KA2PA(config.stack_base), config.stack_size))
+			if (overlaps(addr, PFN2ADDR(confcount),
+			    KA2PA(config.stack_base), config.stack_size))
 				continue;
 			
@@ -875,5 +886,7 @@
 			count_t i;
 			for (i = 0; i < init.cnt; i++)
-				if (overlaps(addr, PFN2ADDR(confcount), KA2PA(init.tasks[i].addr), init.tasks[i].size)) {
+				if (overlaps(addr, PFN2ADDR(confcount),
+				    KA2PA(init.tasks[i].addr),
+				    init.tasks[i].size)) {
 					overlap = true;
 					break;
@@ -916,5 +929,5 @@
 }
 
-void * frame_get_parent(pfn_t pfn, unsigned int hint)
+void *frame_get_parent(pfn_t pfn, unsigned int hint)
 {
 	zone_t *zone = find_zone_and_lock(pfn, &hint);
@@ -1074,13 +1087,19 @@
 	frame_arch_init();
 	if (config.cpu_active == 1) {
-		frame_mark_unavailable(ADDR2PFN(KA2PA(config.base)), SIZE2FRAMES(config.kernel_size));
-		frame_mark_unavailable(ADDR2PFN(KA2PA(config.stack_base)), SIZE2FRAMES(config.stack_size));
+		frame_mark_unavailable(ADDR2PFN(KA2PA(config.base)),
+		    SIZE2FRAMES(config.kernel_size));
+		frame_mark_unavailable(ADDR2PFN(KA2PA(config.stack_base)),
+		    SIZE2FRAMES(config.stack_size));
 		
 		count_t i;
-		for (i = 0; i < init.cnt; i++)
-			frame_mark_unavailable(ADDR2PFN(KA2PA(init.tasks[i].addr)), SIZE2FRAMES(init.tasks[i].size));
+		for (i = 0; i < init.cnt; i++) {
+			pfn_t pfn = ADDR2PFN(KA2PA(init.tasks[i].addr));
+			frame_mark_unavailable(pfn,
+			    SIZE2FRAMES(init.tasks[i].size));
+		}
 
 		if (ballocs.size)
-			frame_mark_unavailable(ADDR2PFN(KA2PA(ballocs.base)), SIZE2FRAMES(ballocs.size));
+			frame_mark_unavailable(ADDR2PFN(KA2PA(ballocs.base)),
+			    SIZE2FRAMES(ballocs.size));
 
 		/* Black list first frame, as allocating NULL would
@@ -1107,5 +1126,6 @@
 		zone = zones.info[i];
 		spinlock_lock(&zone->lock);
-		printf("%-2d %12p %12zd %12zd\n", i, PFN2ADDR(zone->base), zone->free_count, zone->busy_count);
+		printf("%-2d %12p %12zd %12zd\n", i, PFN2ADDR(zone->base),
+		    zone->free_count, zone->busy_count);
 		spinlock_unlock(&zone->lock);
 	}
@@ -1139,8 +1159,12 @@
 	spinlock_lock(&zone->lock);
 	printf("Memory zone information\n");
-	printf("Zone base address: %#.*p\n", sizeof(uintptr_t) * 2, PFN2ADDR(zone->base));
-	printf("Zone size: %zd frames (%zdK)\n", zone->count, ((zone->count) * FRAME_SIZE) >> 10);
-	printf("Allocated space: %zd frames (%zdK)\n", zone->busy_count, (zone->busy_count * FRAME_SIZE) >> 10);
-	printf("Available space: %zd frames (%zdK)\n", zone->free_count, (zone->free_count * FRAME_SIZE) >> 10);
+	printf("Zone base address: %#.*p\n", sizeof(uintptr_t) * 2,
+	    PFN2ADDR(zone->base));
+	printf("Zone size: %zd frames (%zdK)\n", zone->count,
+	    ((zone->count) * FRAME_SIZE) >> 10);
+	printf("Allocated space: %zd frames (%zdK)\n", zone->busy_count,
+	    (zone->busy_count * FRAME_SIZE) >> 10);
+	printf("Available space: %zd frames (%zdK)\n", zone->free_count,
+	    (zone->free_count * FRAME_SIZE) >> 10);
 	buddy_system_structure_print(zone->buddy_system, FRAME_SIZE);
 	
@@ -1153,2 +1177,3 @@
 /** @}
  */
+
