Index: kernel/arch/amd64/src/smp/ap.S
===================================================================
--- kernel/arch/amd64/src/smp/ap.S	(revision a0d9abcd8580e03c999ae26a009e1f3999d6a336)
+++ kernel/arch/amd64/src/smp/ap.S	(revision 4928165de7cf0ac048c2faf57cbe0209de03919c)
@@ -39,4 +39,5 @@
 #include <arch/cpu.h>
 #include <arch/cpuid.h>
+#include <arch/context_struct.h>
 
 .section K_TEXT_START, "ax"
@@ -98,5 +99,5 @@
 start64:
 	movabsq $ctx, %rsp
-	movq (%rsp), %rsp
+	movq CONTEXT_OFFSET_SP(%rsp), %rsp
 	
 	pushq $0
Index: kernel/arch/ia32/src/smp/ap.S
===================================================================
--- kernel/arch/ia32/src/smp/ap.S	(revision a0d9abcd8580e03c999ae26a009e1f3999d6a336)
+++ kernel/arch/ia32/src/smp/ap.S	(revision 4928165de7cf0ac048c2faf57cbe0209de03919c)
@@ -38,4 +38,5 @@
 #include <arch/pm.h>
 #include <arch/cpu.h>
+#include <arch/context_struct.h>
 
 .section K_TEXT_START, "ax"
@@ -74,7 +75,7 @@
 	movw %ax, %es
 	movw %ax, %ss
-	movl $KA2PA(ctx), %eax  /* KA2PA((uintptr_t) &ctx) */
-	movl (%eax), %esp
-	subl $0x80000000, %esp  /* KA2PA(ctx.sp) */
+	movl $KA2PA(ctx), %eax	/* KA2PA((uintptr_t) &ctx) */
+	movl CONTEXT_OFFSET_SP(%eax), %esp
+	subl $PA2KA(0), %esp	/* KA2PA(ctx.sp) */
 
 	/*
@@ -84,5 +85,5 @@
 	call map_kernel_pse
 	
-	addl $0x80000000, %esp  /*  PA2KA(ctx.sp) */
+	addl $PA2KA(0), %esp	/* PA2KA(ctx.sp) */
 	
 	/* create the first stack frame */
