diff --git a/i386/i386/thread.h b/i386/i386/thread.h
index cb317bee..c5da7522 100644
--- a/i386/i386/thread.h
+++ b/i386/i386/thread.h
@@ -225,6 +225,17 @@ typedef struct pcb {
#define STACK_IEL(stack) \
((struct i386_exception_link *)STACK_IKS(stack) - 1)
+#ifdef __x86_64__
+#ifdef USER32
+#define STACK_ALIGN 4
+#else
+/* Follow System V AMD64 ABI guidelines. */
+#define STACK_ALIGN 16
+#endif
+#else
+#define STACK_ALIGN 4
+#endif /* __x86_64__ */
+
#define USER_REGS(thread) (&(thread)->pcb->iss)