Index: arch/amd64/_link.ld.in
===================================================================
--- arch/amd64/_link.ld.in	(revision 89298e36479568f5ea9680f5cfd750723dafbbdd)
+++ arch/amd64/_link.ld.in	(revision 42744880a09efbd22a7e49822241bb65a91cd197)
@@ -39,7 +39,7 @@
 		QUAD(kdata_end - kdata_start + (unmapped_kdata_end - unmapped_kdata_start));
 		hardcoded_unmapped_ktext_size = .;
-		LONG(unmapped_ktext_end - unmapped_ktext_start);
+		QUAD(unmapped_ktext_end - unmapped_ktext_start);
 		hardcoded_unmapped_kdata_size = .;
-		LONG(unmapped_kdata_end - unmapped_kdata_start);
+		QUAD(unmapped_kdata_end - unmapped_kdata_start);
 		*(COMMON);		/* global variables */
 
Index: arch/amd64/src/asm_utils.S
===================================================================
--- arch/amd64/src/asm_utils.S	(revision 89298e36479568f5ea9680f5cfd750723dafbbdd)
+++ arch/amd64/src/asm_utils.S	(revision 42744880a09efbd22a7e49822241bb65a91cd197)
@@ -219,3 +219,3 @@
 .global interrupt_handler_size
 
-interrupt_handler_size: .long (h_end-h_start)/IDT_ITEMS
+interrupt_handler_size: .quad (h_end-h_start)/IDT_ITEMS
Index: arch/amd64/src/boot/boot.S
===================================================================
--- arch/amd64/src/boot/boot.S	(revision 89298e36479568f5ea9680f5cfd750723dafbbdd)
+++ arch/amd64/src/boot/boot.S	(revision 42744880a09efbd22a7e49822241bb65a91cd197)
@@ -165,4 +165,5 @@
 		
 		xorq %rdx, %rdx
+		movq %rdx, %rcx
 		movl 24(%ebx), %esi						# mbi->mods_addr
 		movl 0(%esi), %edx						# mods->mod_start
@@ -172,5 +173,5 @@
 		
 		mods_invalid:
-		movl %ecx, init_size
+		movq %rcx, init_size
 		movq %rdx, init_addr
 		
Index: arch/ia32/src/mm/frame.c
===================================================================
--- arch/ia32/src/mm/frame.c	(revision 89298e36479568f5ea9680f5cfd750723dafbbdd)
+++ arch/ia32/src/mm/frame.c	(revision 42744880a09efbd22a7e49822241bb65a91cd197)
@@ -42,5 +42,4 @@
 #include <console/kconsole.h>
 
-
 size_t hardcoded_unmapped_ktext_size = 0;
 size_t hardcoded_unmapped_kdata_size = 0;
@@ -51,5 +50,6 @@
 {
 	int i;
-	pfn_t start, size,conf;
+	pfn_t start, conf;
+	size_t size;
 
 	for (i = 0; i < e820counter; i++) {
@@ -57,5 +57,5 @@
 			start = ADDR2PFN(ALIGN_UP(e820table[i].base_address,
 						  FRAME_SIZE));
-			size = SIZE2PFN(ALIGN_DOWN(e820table[i].size,
+			size = SIZE2FRAMES(ALIGN_DOWN(e820table[i].size,
 						   FRAME_SIZE));
 			if (minconf < start || minconf >= start+size)
@@ -63,5 +63,5 @@
 			else
 				conf = minconf;
-			zone_create(start,size, conf, 0);
+			zone_create(start, size, conf, 0);
 			if (last_frame < ALIGN_UP(e820table[i].base_address + e820table[i].size, FRAME_SIZE))
 				last_frame = ALIGN_UP(e820table[i].base_address + e820table[i].size, FRAME_SIZE);
Index: arch/mips32/src/drivers/arc.c
===================================================================
--- arch/mips32/src/drivers/arc.c	(revision 89298e36479568f5ea9680f5cfd750723dafbbdd)
+++ arch/mips32/src/drivers/arc.c	(revision 42744880a09efbd22a7e49822241bb65a91cd197)
@@ -306,5 +306,5 @@
 			
 			zone_create(ADDR2PFN(base),
-				    SIZE2PFN(ALIGN_DOWN(basesize,FRAME_SIZE)),
+				    SIZE2FRAMES(ALIGN_DOWN(basesize,FRAME_SIZE)),
 				    ADDR2PFN(base),0);
 		}
Index: arch/sparc64/_link.ld.in
===================================================================
--- arch/sparc64/_link.ld.in	(revision 89298e36479568f5ea9680f5cfd750723dafbbdd)
+++ arch/sparc64/_link.ld.in	(revision 42744880a09efbd22a7e49822241bb65a91cd197)
@@ -27,7 +27,7 @@
 		*(.sbss);
 		hardcoded_ktext_size = .;
-		LONG(ktext_end - ktext_start);	
+		QUAD(ktext_end - ktext_start);	
 		hardcoded_kdata_size = .;
-		LONG(kdata_end - kdata_start);
+		QUAD(kdata_end - kdata_start);
 		hardcoded_load_address = .;
 		QUAD(0x4000);
Index: arch/sparc64/src/mm/frame.c
===================================================================
--- arch/sparc64/src/mm/frame.c	(revision 89298e36479568f5ea9680f5cfd750723dafbbdd)
+++ arch/sparc64/src/mm/frame.c	(revision 42744880a09efbd22a7e49822241bb65a91cd197)
@@ -30,8 +30,9 @@
 #include <mm/frame.h>
 #include <config.h>
+#include <align.h>
 
 void frame_arch_init(void)
 {
-	zone_create(0, config.memory_size >> FRAME_WIDTH, 1, 0);
+	zone_create(0, config.memory_size >> FRAME_WIDTH, ADDR2PFN(ALIGN_UP(config.base + config.kernel_size + CONFIG_STACK_SIZE, FRAME_SIZE)), 0);
 
 	/*
Index: generic/include/config.h
===================================================================
--- generic/include/config.h	(revision 89298e36479568f5ea9680f5cfd750723dafbbdd)
+++ generic/include/config.h	(revision 42744880a09efbd22a7e49822241bb65a91cd197)
@@ -37,5 +37,4 @@
 
 #define CONFIG_MEMORY_SIZE	(8*1024*1024)
-#define CONFIG_HEAP_SIZE	(300*1024)
 #define CONFIG_STACK_SIZE	STACK_SIZE
 
@@ -50,9 +49,5 @@
 	size_t init_size;
 	
-	__address heap_addr;
-	size_t heap_size;
-	size_t heap_delta;            /**< Extra space between heap and stack (enforced by alignment requirements) */
-	
-	size_t kernel_size;           /**< Size of memory in bytes taken by kernel, heap and stack */
+	size_t kernel_size;           /**< Size of memory in bytes taken by kernel and stack */
 };
 
Index: generic/include/mm/frame.h
===================================================================
--- generic/include/mm/frame.h	(revision 89298e36479568f5ea9680f5cfd750723dafbbdd)
+++ generic/include/mm/frame.h	(revision 42744880a09efbd22a7e49822241bb65a91cd197)
@@ -75,9 +75,9 @@
 }
 
-static inline pfn_t SIZE2PFN(__address size)
+static inline count_t SIZE2FRAMES(size_t size)
 {
 	if (!size)
 		return 0;
-	return (pfn_t)((size-1) >> FRAME_WIDTH)+1;
+	return (count_t)((size-1) >> FRAME_WIDTH)+1;
 }
 
@@ -96,10 +96,10 @@
 extern void frame_free(__address addr);
 
-extern void zone_create(pfn_t start, pfn_t count, pfn_t confframe, int flags);
+extern void zone_create(pfn_t start, count_t count, pfn_t confframe, int flags);
 
 void * frame_get_parent(pfn_t frame, int hint);
 void frame_set_parent(pfn_t frame, void *data, int hint);
-void frame_mark_unavailable(pfn_t start, pfn_t count);
-__address zone_conf_size(pfn_t start, pfn_t count);
+void frame_mark_unavailable(pfn_t start, count_t count);
+__address zone_conf_size(pfn_t start, count_t count);
 
 /*
Index: generic/include/typedefs.h
===================================================================
--- generic/include/typedefs.h	(revision 89298e36479568f5ea9680f5cfd750723dafbbdd)
+++ generic/include/typedefs.h	(revision 42744880a09efbd22a7e49822241bb65a91cd197)
@@ -35,7 +35,7 @@
 typedef short bool;
 
-typedef unsigned int size_t;
-typedef unsigned int count_t;
-typedef unsigned int index_t;
+typedef unsigned long size_t;
+typedef unsigned long count_t;
+typedef unsigned long index_t;
 
 typedef struct config config_t;
Index: generic/src/main/kinit.c
===================================================================
--- generic/src/main/kinit.c	(revision 89298e36479568f5ea9680f5cfd750723dafbbdd)
+++ generic/src/main/kinit.c	(revision 42744880a09efbd22a7e49822241bb65a91cd197)
@@ -73,5 +73,5 @@
 	as_area_t *a;
 	__address frame;
-	pfn_t frames;
+	count_t frames;
 	int i;
 	task_t *u;
@@ -166,5 +166,5 @@
 			frame = KA2PA(frame);
 
-		frames = SIZE2PFN(config.init_size);
+		frames = SIZE2FRAMES(config.init_size);
 		
 		a = as_area_create(as, AS_AREA_TEXT, frames, UTEXT_ADDRESS);
Index: generic/src/mm/frame.c
===================================================================
--- generic/src/mm/frame.c	(revision 89298e36479568f5ea9680f5cfd750723dafbbdd)
+++ generic/src/mm/frame.c	(revision 42744880a09efbd22a7e49822241bb65a91cd197)
@@ -62,5 +62,5 @@
 	SPINLOCK_DECLARE(lock);	/**< this lock protects everything below */
 	pfn_t base;	/**< frame_no of the first frame in the frames array */
-	pfn_t count;          /**< Size of zone */
+	count_t count;          /**< Size of zone */
 
 	frame_t *frames;	/**< array of frame_t structures in this zone */
@@ -100,5 +100,5 @@
 
 /** Compute pfn_t from frame_t pointer & zone pointer */
-static pfn_t make_frame_index(zone_t *zone, frame_t *frame)
+static index_t make_frame_index(zone_t *zone, frame_t *frame)
 {
 	return frame - zone->frames;
@@ -424,5 +424,5 @@
  * Assume zone is locked
  */
-static void zone_frame_free(zone_t *zone, pfn_t frame_idx)
+static void zone_frame_free(zone_t *zone, index_t frame_idx)
 {
 	frame_t *frame;
@@ -446,5 +446,5 @@
 
 /** Return frame from zone */
-static frame_t * zone_get_frame(zone_t *zone, pfn_t frame_idx)
+static frame_t * zone_get_frame(zone_t *zone, index_t frame_idx)
 {
 	ASSERT(frame_idx < zone->count);
@@ -453,5 +453,5 @@
 
 /** Mark frame in zone unavailable to allocation */
-static void zone_mark_unavailable(zone_t *zone, pfn_t frame_idx)
+static void zone_mark_unavailable(zone_t *zone, index_t frame_idx)
 {
 	frame_t *frame;
@@ -476,5 +476,5 @@
  * @return Initialized zone.
  */
-static zone_t * zone_construct(pfn_t start, pfn_t count, 
+static zone_t * zone_construct(pfn_t start, count_t count, 
 			       zone_t *z, int flags)
 {
@@ -517,5 +517,5 @@
 
 /** Compute configuration data size for zone */
-__address zone_conf_size(pfn_t start, pfn_t count)
+__address zone_conf_size(pfn_t start, count_t count)
 {
 	int size = sizeof(zone_t) + count*sizeof(frame_t);
@@ -531,15 +531,14 @@
  *
  * @param confframe Where configuration frame is supposed to be.
- *                  Always check, that we will not disturb kernel pages
- *                  the kernel and possibly init. 
+ *                  Always check, 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
  */
-void zone_create(pfn_t start, pfn_t count, pfn_t confframe, int flags)
+void zone_create(pfn_t start, count_t count, pfn_t confframe, int flags)
 {
 	zone_t *z;
 	__address addr,endaddr;
-	pfn_t confcount;
+	count_t confcount;
 	int i;
 
@@ -552,5 +551,5 @@
 	 * it does not span kernel & init
 	 */
-	confcount = SIZE2PFN(zone_conf_size(start,count));
+	confcount = SIZE2FRAMES(zone_conf_size(start,count));
 	if (confframe >= start && confframe < start+count) {
 		for (;confframe < start+count;confframe++) {
@@ -700,5 +699,5 @@
 
 /** Mark given range unavailable in frame zones */
-void frame_mark_unavailable(pfn_t start, pfn_t count)
+void frame_mark_unavailable(pfn_t start, count_t count)
 {
 	int i;
@@ -730,8 +729,8 @@
 	if (config.cpu_active == 1) {
 		frame_mark_unavailable(ADDR2PFN(KA2PA(config.base)),
-				       SIZE2PFN(config.kernel_size));
+				       SIZE2FRAMES(config.kernel_size));
 		if (config.init_size > 0)
 			frame_mark_unavailable(ADDR2PFN(KA2PA(config.init_addr)),
-					       SIZE2PFN(config.init_size));
+					       SIZE2FRAMES(config.init_size));
 	}
 }
