Index: arch/amd64/Makefile.inc
===================================================================
--- arch/amd64/Makefile.inc	(revision 8f2153be63f6407e45f93d58a8ffff855f01cc0b)
+++ arch/amd64/Makefile.inc	(revision 1b492b57c58741902af1ee1caf3ef1b9fb5cc981)
@@ -26,5 +26,5 @@
 LFLAGS=-M 
 
-../arch/amd64/_link.ld: ../arch/amd64/_link.ld.in
+../arch/$(ARCH)/_link.ld: ../arch/$(ARCH)/_link.ld.in
 	$(CC) $(CFLAGS) -E -x c $< | grep -v "^\#" > $@
 
Index: arch/amd64/_link.ld.in
===================================================================
--- arch/amd64/_link.ld.in	(revision 8f2153be63f6407e45f93d58a8ffff855f01cc0b)
+++ arch/amd64/_link.ld.in	(revision 1b492b57c58741902af1ee1caf3ef1b9fb5cc981)
@@ -38,5 +38,5 @@
 		*(.rodata*);		/* string literals */
 		hardcoded_load_address = .;
-		QUAD(ktext_start - SIZEOF(.unmapped));
+		QUAD(PA2KA(BOOT_OFFSET+BOOTSTRAP_OFFSET));
 		hardcoded_ktext_size = .;
 		QUAD(ktext_end - ktext_start + (unmapped_ktext_end - unmapped_ktext_start));
@@ -62,8 +62,4 @@
 
 	_hardcoded_kernel_size = (ktext_end - ktext_start) + (unmapped_ktext_end - unmapped_ktext_start) + (kdata_end - kdata_start) + (unmapped_kdata_end - unmapped_kdata_start);
-	_boot_offset = 0x100000;
-	_ka2pa_offset = 0xffffffff80000000;
-	_map_address = _ka2pa_offset + _boot_offset;
-
 
 	e820table_boot = KA2PA(e820table) - BOOT_OFFSET;
Index: arch/ia32/Makefile.inc
===================================================================
--- arch/ia32/Makefile.inc	(revision 8f2153be63f6407e45f93d58a8ffff855f01cc0b)
+++ arch/ia32/Makefile.inc	(revision 1b492b57c58741902af1ee1caf3ef1b9fb5cc981)
@@ -21,4 +21,7 @@
 CFLAGS=$(CPPFLAGS) -nostdlib -fno-builtin -fomit-frame-pointer -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3
 LFLAGS=-M -no-check-sections
+
+../arch/$(ARCH)/_link.ld: ../arch/$(ARCH)/_link.ld.in
+	$(CC) $(CFLAGS) -E -x c $< | grep -v "^\#" > $@
 
 arch_sources= \
Index: ch/ia32/_link.ld
===================================================================
--- arch/ia32/_link.ld	(revision 8f2153be63f6407e45f93d58a8ffff855f01cc0b)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/** IA-32 linker script
- *  
- * umapped section:
- * 	kernel text
- * 	kernel data
- * mapped section:
- *	kernel text
- *	kernel data 
- */
-
-OUTPUT_FORMAT(binary)
-ENTRY(kernel_image_start)
-
-SECTIONS {
-	.unmapped 0x8000: AT (0x8000) {
-		unmapped_ktext_start = .;
-		*(K_TEXT_START);
-		*(K_TEXT_START_2);
-		unmapped_ktext_end = .;
-		
-		unmapped_kdata_start = .;
-		*(K_DATA_START);
-		unmapped_kdata_end = .;
-	}
-	
-	.mapped (0x80100000+0x8000+SIZEOF(.unmapped)): AT (0x8000+SIZEOF(.unmapped)) { 
-		ktext_start = .;
-		*(BOOT_DATA)
-		*(.text);
-		ktext_end = .;
-		
-		kdata_start = .;
-		*(.data);		/* initialized data */
-		*(.rodata*);		/* string literals */
-		*(COMMON);		/* global variables */
-		hardcoded_load_address = .;
-		LONG(0x80108000);
-		hardcoded_ktext_size = .;
-		LONG(ktext_end - ktext_start + (unmapped_ktext_end - unmapped_ktext_start));
-		hardcoded_kdata_size = .;
-		LONG(kdata_end - kdata_start + (unmapped_kdata_end - unmapped_kdata_start));
-		hardcoded_unmapped_ktext_size = .;
-		LONG(unmapped_ktext_end - unmapped_ktext_start);
-		hardcoded_unmapped_kdata_size = .;
-		LONG(unmapped_kdata_end - unmapped_kdata_start);
-		*(.bss);		/* uninitialized static variables */
-		*(K_DATA_END);
-
-		symbol_table = .;
-		*(symtab.*);            /* Symbol table, must be LAST symbol!*/
-
-		kdata_end = .;
-	}
-	
-	_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;
-	e820table_boot = e820table - _map_address;
-	e820counter_boot = e820counter - _map_address;
-	real_bootstrap_gdtr = real_bootstrap_gdtr_boot + 0x80000000;
-}
Index: arch/ia32/_link.ld.in
===================================================================
--- arch/ia32/_link.ld.in	(revision 1b492b57c58741902af1ee1caf3ef1b9fb5cc981)
+++ arch/ia32/_link.ld.in	(revision 1b492b57c58741902af1ee1caf3ef1b9fb5cc981)
@@ -0,0 +1,65 @@
+/** IA-32 linker script
+ *  
+ * umapped section:
+ * 	kernel text
+ * 	kernel data
+ * mapped section:
+ *	kernel text
+ *	kernel data 
+ */
+
+#define __ASM__
+#include <arch/boot/boot.h>
+#include <arch/mm/page.h>
+
+OUTPUT_FORMAT(binary)
+ENTRY(kernel_image_start)
+
+SECTIONS {
+	.unmapped BOOTSTRAP_OFFSET: AT (BOOTSTRAP_OFFSET) {
+		unmapped_ktext_start = .;
+		*(K_TEXT_START);
+		*(K_TEXT_START_2);
+		unmapped_ktext_end = .;
+		
+		unmapped_kdata_start = .;
+		*(K_DATA_START);
+		unmapped_kdata_end = .;
+	}
+	
+	.mapped (PA2KA(BOOT_OFFSET+BOOTSTRAP_OFFSET)+SIZEOF(.unmapped)): AT (BOOTSTRAP_OFFSET+SIZEOF(.unmapped)) { 
+		ktext_start = .;
+		*(BOOT_DATA)
+		*(.text);
+		ktext_end = .;
+		
+		kdata_start = .;
+		*(.data);		/* initialized data */
+		*(.rodata*);		/* string literals */
+		*(COMMON);		/* global variables */
+		hardcoded_load_address = .;
+		LONG(PA2KA(BOOT_OFFSET+BOOTSTRAP_OFFSET));
+		hardcoded_ktext_size = .;
+		LONG(ktext_end - ktext_start + (unmapped_ktext_end - unmapped_ktext_start));
+		hardcoded_kdata_size = .;
+		LONG(kdata_end - kdata_start + (unmapped_kdata_end - unmapped_kdata_start));
+		hardcoded_unmapped_ktext_size = .;
+		LONG(unmapped_ktext_end - unmapped_ktext_start);
+		hardcoded_unmapped_kdata_size = .;
+		LONG(unmapped_kdata_end - unmapped_kdata_start);
+		*(.bss);		/* uninitialized static variables */
+		*(K_DATA_END);
+
+		symbol_table = .;
+		*(symtab.*);            /* Symbol table, must be LAST symbol!*/
+
+		kdata_end = .;
+	}
+	
+	_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);
+	
+	e820table_boot = KA2PA(e820table) - BOOT_OFFSET;
+	e820counter_boot = KA2PA(e820counter) - BOOT_OFFSET;
+	real_bootstrap_gdtr = PA2KA(real_bootstrap_gdtr_boot);
+}
