Index: arch/amd64/Makefile.inc
===================================================================
--- arch/amd64/Makefile.inc	(revision 3817ed1b528d35beeab51abb588dc261aee19fa8)
+++ arch/amd64/Makefile.inc	(revision c832cc0a825039a5a4787d1046ba3d79f6332334)
@@ -27,4 +27,4 @@
 	arch/delay.S \
 	arch/amd64.c \
-	arch/bios/bios.c
-
+	arch/bios/bios.c \
+	arch/interrupt.c
Index: arch/amd64/_link.ld
===================================================================
--- arch/amd64/_link.ld	(revision 3817ed1b528d35beeab51abb588dc261aee19fa8)
+++ arch/amd64/_link.ld	(revision c832cc0a825039a5a4787d1046ba3d79f6332334)
@@ -32,12 +32,14 @@
 		*(.rodata*);		/* string literals */
 		*(COMMON);		/* global variables */
+		hardcoded_load_address = .;
+		QUAD(0xffffffff80008000);
+		hardcoded_ktext_size = .;
+		QUAD(ktext_end - ktext_start + (unmapped_ktext_end - unmapped_ktext_start));
+		hardcoded_kdata_size = .;
+		QUAD(kdata_end - kdata_start + (unmapped_kdata_end - unmapped_kdata_start));
+		*(.eh_frame);
 		*(.bss);		/* uninitialized static variables */
-		*(.eh_frame);
 		*(K_DATA_END);
 		kdata_end = .;
 	}
-
-	_hardcoded_ktext_size = ktext_end - ktext_start + (unmapped_ktext_end - unmapped_ktext_start);
-	_hardcoded_kdata_size = kdata_end - kdata_start + (unmapped_kdata_end - unmapped_kdata_start);
-	_hardcoded_load_address = 0xffffffff80008000;
 }
Index: arch/amd64/include/asm.h
===================================================================
--- arch/amd64/include/asm.h	(revision 3817ed1b528d35beeab51abb588dc261aee19fa8)
+++ arch/amd64/include/asm.h	(revision c832cc0a825039a5a4787d1046ba3d79f6332334)
@@ -132,4 +132,13 @@
 }
 
+/** Read CR2
+ *
+ * Return value in CR2
+ *
+ * @return Value read.
+ */
+static inline __u32 read_cr2(void) { __u64 v; __asm__ volatile ("movq %%cr2,%0" : "=r" (v)); return v; }
+
+
 extern size_t interrupt_handler_size;
 extern void interrupt_handlers(void);
Index: arch/amd64/src/dummy.s
===================================================================
--- arch/amd64/src/dummy.s	(revision 3817ed1b528d35beeab51abb588dc261aee19fa8)
+++ arch/amd64/src/dummy.s	(revision c832cc0a825039a5a4787d1046ba3d79f6332334)
@@ -43,37 +43,14 @@
 .global frame_arch_init
 .global dummy
-.global trap_register
-.global trap_virtual_eoi
-.global trap_virtual_enable_irqs
 .global rdtsc
-.global trap_virtual_disable_irqs
-.global enable_irqs_function
-.global disable_irqs_function
-.global eoi_function
-.global syscall
+.global reset_TS_flag
+.global fpu_init
 	
-.global null_interrupt
 .global interrupt_handler_size
-.global gp_fault
-.global nm_fault
-.global ss_fault
 .global interrupt_handlers
-.global memcpy
 
-null_interrupt:
 interrupt_handler_size:
 interrupt_handlers:	
-gp_fault:
-nm_fault:
-ss_fault:	
-eoi_function:
-syscall:	
-enable_irqs_function:
-disable_irqs_function:	
 rdtsc:
-trap_virtual_eoi:
-trap_virtual_enable_irqs:
-trap_virtual_disable_irqs:	
-trap_register:	
 before_thread_runs_arch:
 userspace:
@@ -90,7 +67,12 @@
 page_arch_init:
 frame_arch_init:
-memcpy:
-
+reset_TS_flag:
+fpu_init:	
+	
 dummy:
 0:
 	ret
+
+.global memcpy
+memcpy:
+	jmp _memcpy
Index: arch/ia32/_link.ld
===================================================================
--- arch/ia32/_link.ld	(revision 3817ed1b528d35beeab51abb588dc261aee19fa8)
+++ arch/ia32/_link.ld	(revision c832cc0a825039a5a4787d1046ba3d79f6332334)
@@ -32,12 +32,13 @@
 		*(.rodata*);		/* string literals */
 		*(COMMON);		/* global variables */
+		hardcoded_load_address = .;
+		LONG(0xffffffff80008000);
+		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));
 		*(.bss);		/* uninitialized static variables */
 		*(K_DATA_END);
 		kdata_end = .;
 	}
-
-	_hardcoded_ktext_size = ktext_end - ktext_start + (unmapped_ktext_end - unmapped_ktext_start);
-	_hardcoded_kdata_size = kdata_end - kdata_start + (unmapped_kdata_end - unmapped_kdata_start);
-	_hardcoded_load_address = 0x80008000;
-
 }
Index: arch/ia32/src/boot/boot.S
===================================================================
--- arch/ia32/src/boot/boot.S	(revision 3817ed1b528d35beeab51abb588dc261aee19fa8)
+++ arch/ia32/src/boot/boot.S	(revision c832cc0a825039a5a4787d1046ba3d79f6332334)
@@ -67,8 +67,4 @@
 	call map_kernel			# map kernel and turn paging on
 
-	movl $_hardcoded_ktext_size, hardcoded_ktext_size
-	movl $_hardcoded_kdata_size, hardcoded_kdata_size
-	movl $_hardcoded_load_address, hardcoded_load_address
-
 	call main_bsp			# never returns
 
Index: arch/ia32/src/interrupt.c
===================================================================
--- arch/ia32/src/interrupt.c	(revision 3817ed1b528d35beeab51abb588dc261aee19fa8)
+++ arch/ia32/src/interrupt.c	(revision c832cc0a825039a5a4787d1046ba3d79f6332334)
@@ -64,5 +64,5 @@
  * CPU is cpu_priority_high().
  */
-void trap_dispatcher(__u8 n, __u32 stack[])
+void trap_dispatcher(__u8 n, __native stack[])
 {
 	ASSERT(n < IVT_ITEMS);
@@ -71,5 +71,5 @@
 }
 
-void null_interrupt(__u8 n, __u32 stack[])
+void null_interrupt(__u8 n, __native stack[])
 {
 	printf("int %d: null_interrupt\n", n);
@@ -78,5 +78,5 @@
 }
 
-void gp_fault(__u8 n, __u32 stack[])
+void gp_fault(__u8 n, __native stack[])
 {
 	printf("ERROR_WORD=%X, %%eip=%X, %%cs=%X, flags=%X\n", stack[0], stack[1], stack[2], stack[3]);
@@ -87,5 +87,5 @@
 }
 
-void ss_fault(__u8 n, __u32 stack[])
+void ss_fault(__u8 n, __native stack[])
 {
 	printf("ERROR_WORD=%X, %%eip=%X, %%cs=%X, flags=%X\n", stack[0], stack[1], stack[2], stack[3]);
@@ -96,5 +96,5 @@
 
 
-void nm_fault(__u8 n, __u32 stack[])
+void nm_fault(__u8 n, __native stack[])
 {
 	reset_TS_flag();
@@ -110,5 +110,5 @@
 
 
-void page_fault(__u8 n, __u32 stack[])
+void page_fault(__u8 n, __native stack[])
 {
 	printf("page fault address: %X\n", read_cr2());
@@ -119,5 +119,5 @@
 }
 
-void syscall(__u8 n, __u32 stack[])
+void syscall(__u8 n, __native stack[])
 {
 	printf("cpu%d: syscall\n", CPU->id);
@@ -125,5 +125,5 @@
 }
 
-void tlb_shootdown_ipi(__u8 n, __u32 stack[])
+void tlb_shootdown_ipi(__u8 n, __native stack[])
 {
 	trap_virtual_eoi();
@@ -131,5 +131,5 @@
 }
 
-void wakeup_ipi(__u8 n, __u32 stack[])
+void wakeup_ipi(__u8 n, __native stack[])
 {
 	trap_virtual_eoi();
Index: arch/mips/_link.ld
===================================================================
--- arch/mips/_link.ld	(revision 3817ed1b528d35beeab51abb588dc261aee19fa8)
+++ arch/mips/_link.ld	(revision c832cc0a825039a5a4787d1046ba3d79f6332334)
@@ -28,4 +28,10 @@
 		*(.sdata);
 		*(.sbss);
+		hardcoded_ktext_size = .;
+		LONG(ktext_end - ktext_start);	
+		hardcoded_kdata_size = .;
+		LONG(kdata_end - kdata_start);
+		hardcoded_load_address = .;
+		LONG(0x80000000);
 		*(.bss);		/* uninitialized static variables */	
 		*(.scommon);
@@ -34,19 +40,3 @@
 
 	} = 0x00000000
-
-	. = ABSOLUTE(hardcoded_ktext_size);
-	.patch_1 : {
-		LONG(ktext_end - ktext_start);
-	}
-
-	. = ABSOLUTE(hardcoded_kdata_size);
-	.patch_2 : {
-		LONG(kdata_end - kdata_start);
-	}
-
-	. = ABSOLUTE(hardcoded_load_address);
-	.patch_3 : {
-		LONG(0x80000000);
-	}
-
 }
Index: src/build.amd64
===================================================================
--- src/build.amd64	(revision 3817ed1b528d35beeab51abb588dc261aee19fa8)
+++ src/build.amd64	(revision c832cc0a825039a5a4787d1046ba3d79f6332334)
@@ -5,5 +5,5 @@
 (cd ../arch/amd64/src;make gencontext;./gencontext)
 # Create links to ia32 architecture
-for a in drivers bios; do
+for a in drivers bios interrupt.c; do
   ln -sf ../../../arch/ia32/src/$a ../arch/amd64/src/
 done
