Index: arch/ia32/_link.ld
===================================================================
--- arch/ia32/_link.ld	(revision 23f4b1fb2631fe93032788d7cc4f5232e1e61ac9)
+++ arch/ia32/_link.ld	(revision 339e0535bd8ae53c62ad981cb00092dd47075ff1)
@@ -54,4 +54,5 @@
 	
 	_hardcoded_kernel_size = (ktext_end - ktext_start) + (unmapped_ktext_end - unmapped_ktext_start) + (kdata_end - kdata_start) + (unmapped_kdata_end - unmapped_kdata_start);
+	_hardcoded_unmapped_size = (unmapped_ktext_end - unmapped_ktext_start) + (unmapped_kdata_end - unmapped_kdata_start);
 	
 	_map_address = 0x80100000;
Index: arch/ia32/src/boot/boot.S
===================================================================
--- arch/ia32/src/boot/boot.S	(revision 23f4b1fb2631fe93032788d7cc4f5232e1e61ac9)
+++ arch/ia32/src/boot/boot.S	(revision 339e0535bd8ae53c62ad981cb00092dd47075ff1)
@@ -28,4 +28,5 @@
 
 #include <arch/boot/boot.h>
+#include <arch/boot/memmapasm.h>
 
 .section K_TEXT_START
@@ -81,6 +82,4 @@
 	movw %ax, %ss
 	
-	call map_kernel			# map kernel and turn paging on
-	
 	movb $0xd1, %al			# enable A20 using the keyboard controller
 	outb %al, $0x64
@@ -93,4 +92,6 @@
 	cld
 	rep movsb
+	
+	call map_kernel			# map kernel and turn paging on
 	
 	call main_bsp			# never returns
@@ -114,6 +115,12 @@
 	multiboot_meeting_point:
 	
-	pushl %ebx
+	pushl %ebx										# save parameters from GRUB
 	pushl %eax
+	
+	movl $BOOTSTRAP_OFFSET + BOOT_OFFSET, %esi
+	movl $BOOTSTRAP_OFFSET, %edi
+	movl $_hardcoded_unmapped_size, %ecx
+	cld
+	rep movsb
 	
 	call map_kernel									# map kernel and turn paging on
@@ -121,28 +128,73 @@
 	popl %eax
 	popl %ebx
-	cmpl $MULTIBOOT_LOADER_MAGIC, %eax
+	cmpl $MULTIBOOT_LOADER_MAGIC, %eax			# compare GRUB signature
 	je valid_boot
-	
-		# ...
+		
+		xorl %ecx, %ecx							# no memory size or map available
+		movl %ecx, e801memorysize
+		movl %ecx, e820counter
 		
 		jmp invalid_boot
-	
+		
 	valid_boot:
 		
-		movl (%ebx), %eax
-		
-		# ... check flags in eax
-		
-		movl 4(%ebx), %ecx
-		addl 8(%ebx), %ecx
+		movl (%ebx), %eax						# ebx = physical address of struct multiboot_info
+		
+		bt $0, %eax								# mbi->flags[0] (mem_lower, mem_upper valid)
+		jc mem_valid
+			
+			xorl %ecx, %ecx
+			jmp mem_invalid
+			
+		mem_valid:
+		movl 4(%ebx), %ecx						# mbi->mem_lower
+		addl 8(%ebx), %ecx						# mbi->mem_upper
+		
+		mem_invalid:
 		movl %ecx, e801memorysize
 		
-#		movl 44(%ebx), %ecx
-		xorl %ecx, %ecx
-		movl %ecx, e820counter
-#		movl 48(%ebx), %esi
-#		movl $e820table, %edi
-#		cld
-#		rep movsb
+		bt $6, %eax								# mbi->flags[6] (mmap_length, mmap_addr valid)	
+		jc mmap_valid
+			
+			xorl %edx, %edx
+			jmp mmap_invalid
+			
+		mmap_valid:
+		movl 44(%ebx), %ecx						# mbi->mmap_length
+		movl 48(%ebx), %esi						# mbi->mmap_addr
+		movl $e820table, %edi
+		xorl %edx, %edx
+		
+		mmap_loop:
+			cmpl $0, %ecx
+			jle mmap_end
+			
+			movl 4(%esi), %eax					# mmap->base_addr_low
+			movl %eax, (%edi)
+			
+			movl 8(%esi), %eax					# mmap->base_addr_high
+			movl %eax, 4(%edi)
+			
+			movl 12(%esi), %eax					# mmap->length_low
+			movl %eax, 8(%edi)
+			
+			movl 16(%esi), %eax					# mmap->length_high
+			movl %eax, 12(%edi)
+			
+			movl 20(%esi), %eax					# mmap->type
+			movl %eax, 16(%edi)
+			
+			movl (%esi), %eax					# mmap->size
+			addl $0x4, %eax
+			addl %eax, %esi
+			subl %eax, %ecx
+			addl $MEMMAP_E820_RECORD_SIZE, %edi
+			incl %edx
+			jmp mmap_loop
+		
+		mmap_end:
+		
+		mmap_invalid:
+		movl %edx, e820counter
 		
 	invalid_boot:
Index: arch/ia32/src/boot/memmap.S
===================================================================
--- arch/ia32/src/boot/memmap.S	(revision 23f4b1fb2631fe93032788d7cc4f5232e1e61ac9)
+++ arch/ia32/src/boot/memmap.S	(revision 339e0535bd8ae53c62ad981cb00092dd47075ff1)
@@ -30,6 +30,4 @@
 #include <arch/boot/memmapasm.h>
 
-E820_RECORD_SIZE = MEMMAP_E820_RECORD_SIZE
-E820_MAX_RECORDS = MEMMAP_E820_MAX_RECORDS
 E820_SMAP = 0x534d4150
 
@@ -47,10 +45,10 @@
 	movw	%bx,%es
 	movw	$e820table_boot,%di
-	movb	$E820_MAX_RECORDS,e820counter_boot
+	movb	$MEMMAP_E820_MAX_RECORDS,e820counter_boot
 e820loop:	
 	movl	$E820_SMAP,%edx 	# control sequence "SMAP"
 
 	movl	$0x0000e820,%eax	# service
-	movl	$E820_RECORD_SIZE,%ecx
+	movl	$MEMMAP_E820_RECORD_SIZE,%ecx
 	int 	$0x15
 	jc	e820err
@@ -59,9 +57,9 @@
 	jne	e820err
 
-	cmpl	$E820_RECORD_SIZE,%ecx
+	cmpl	$MEMMAP_E820_RECORD_SIZE,%ecx
 	jne	e820err			# bad record size - bug in bios
 	
 	movw	%di,%ax		# next record
-	addw	$E820_RECORD_SIZE,%ax
+	addw	$MEMMAP_E820_RECORD_SIZE,%ax
 	movw	%ax,%di
 		
@@ -73,5 +71,5 @@
 	
 e820end:
-	movb	$E820_MAX_RECORDS,%al
+	movb	$MEMMAP_E820_MAX_RECORDS,%al
 	subb	e820counter_boot,%al
 	movb	%al,e820counter_boot # store # of valid entries in e820counter
