Index: kernel/arch/amd64/src/asm.S
===================================================================
--- kernel/arch/amd64/src/asm.S	(revision 1a5eca452dd19104f8673b755943e0707abc00e4)
+++ kernel/arch/amd64/src/asm.S	(revision 7ba16eb2305f77c05ab9260d09fae55d5c25fa4f)
@@ -33,4 +33,5 @@
 #include <arch/kseg_struct.h>
 #include <arch/cpu.h>
+#include <arch/smp/apic.h>
 
 .text
@@ -93,5 +94,5 @@
 	
 	/* Flip the ID bit */
-	btcl $21, %edx
+	xorl $RFLAGS_ID, %edx
 	
 	/* Store RFLAGS */
@@ -102,6 +103,6 @@
 	/* Get the ID bit again */
 	popq %rdx
-	andl $(1 << 21), %eax
-	andl $(1 << 21), %edx
+	andl $RFLAGS_ID, %eax
+	andl $RFLAGS_ID, %edx
 	
 	/* 0 if not supported, 1 if supported */
@@ -127,17 +128,16 @@
 FUNCTION_END(cpuid)
 
-FUNCTION_BEGIN(set_efer_flag)
-	movl $0xc0000080, %ecx
+/** Enable local APIC
+ *
+ * Enable local APIC in MSR.
+ *
+ */
+FUNCTION_BEGIN(enable_l_apic_in_msr)
+	movl $AMD_MSR_APIC_BASE, %ecx
 	rdmsr
-	btsl %edi, %eax
+	orl $(L_APIC_BASE | AMD_APIC_BASE_GE), %eax
 	wrmsr
 	ret
-FUNCTION_END(set_efer_flag)
-
-FUNCTION_BEGIN(read_efer_flag)
-	movl $0xc0000080, %ecx
-	rdmsr
-	ret
-FUNCTION_END(read_efer_flag)
+FUNCTION_END(enable_l_apic_in_msr)
 
 /*
@@ -541,3 +541,2 @@
 	ret
 FUNCTION_END(early_putchar)
-
