Index: arch/ia32/src/mm/frame.c
===================================================================
--- arch/ia32/src/mm/frame.c	(revision 445745566f2e9f2942ee3a1fe4596b711a29dbe7)
+++ arch/ia32/src/mm/frame.c	(revision 34722eec48a3738a79af032a3ee21e3eead183db)
@@ -35,7 +35,10 @@
 #include <panic.h>
 #include <debug.h>
+#include <align.h>
 
 size_t hardcoded_unmapped_ktext_size = 0;
 size_t hardcoded_unmapped_kdata_size = 0;
+
+__address last_frame = 0;
 
 void frame_arch_init(void)
@@ -54,6 +57,8 @@
 		for (i = 0; i < e820counter; i++) {
 			if (e820table[i].type == MEMMAP_MEMORY_AVAILABLE) {
-				zone_create_in_region(e820table[i].base_address,  e820table[i].size & ~(FRAME_SIZE-1));
-			}
+				zone_create_in_region(e820table[i].base_address, e820table[i].size & ~(FRAME_SIZE-1));
+				if (last_frame < ALIGN(e820table[i].base_address + e820table[i].size, FRAME_SIZE))
+					last_frame = ALIGN(e820table[i].base_address + e820table[i].size, FRAME_SIZE);
+			}			
 		}
 	}
Index: arch/ia32/src/mm/page.c
===================================================================
--- arch/ia32/src/mm/page.c	(revision 445745566f2e9f2942ee3a1fe4596b711a29dbe7)
+++ arch/ia32/src/mm/page.c	(revision 34722eec48a3738a79af032a3ee21e3eead183db)
@@ -27,10 +27,11 @@
  */
 
+#include <arch/mm/page.h>
+#include <arch/mm/frame.h>
+#include <mm/frame.h>
+#include <mm/page.h>
 #include <arch/types.h>
 #include <config.h>
 #include <func.h>
-#include <mm/frame.h>
-#include <mm/page.h>
-#include <arch/mm/page.h>
 #include <arch/interrupt.h>
 #include <arch/asm.h>
@@ -45,5 +46,5 @@
 {
 	__address dba;
-	__u32 i;
+	__address cur;
 
 	if (config.cpu_active == 1) {
@@ -54,8 +55,8 @@
 		
 		/*
-		 * PA2KA(identity) mapping for all frames.
+		 * PA2KA(identity) mapping for all frames until last_frame.
 		 */
-		for (i = 0; i < config.memory_size/PAGE_SIZE; i++)
-			page_mapping_insert(PA2KA(i * PAGE_SIZE), i * PAGE_SIZE, PAGE_CACHEABLE, KA2PA(dba));
+		for (cur = 0; cur < last_frame; cur += FRAME_SIZE)
+			page_mapping_insert(PA2KA(cur), cur, PAGE_CACHEABLE, KA2PA(dba));
 
 		trap_register(14, page_fault);
