summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarshall Dawson <marshalldawson3rd@gmail.com>2017-07-11 17:39:01 -0600
committerMartin Roth <martinroth@google.com>2017-07-20 15:34:21 +0000
commitfb66e81e6c58b0825e85b2c0afabbe032f103d6e (patch)
treec2fabc3c95ea48bb21244d89767f152e20ca26d9
parentfb95a52b6e927891509006f3c14124af4dc1d890 (diff)
x86/lapic/secondary.S: Align stack for _secondary_start
At a process _start, the stack is expected to be aligned to a 16-byte boundary. Upon entry to any function the stack frame must have the end of any arguments also aligned. In other words the value of %esp+4 or %rsp+8 is always a multiple of 16 (1). Align the stack down inside _secondary_start and preserve proper alignment for the call to secondary_cpu_init. Although 4-byte alignment is the minimum requirement for i386, some AMD platforms use SSE instructions which expect 16-byte. 1) http://wiki.osdev.org/System_V_ABI See "Initial Stack and Register State" and "The Stack Frame" in the supplements. BUG=chrome-os-partner:62841664 Change-Id: I72b7a474013e5caf67aedfabeb8d8d2553499b73 Signed-off-by: Marshall Dawson <marshalldawson3rd@gmail.com> Reviewed-on: https://review.coreboot.org/20537 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
-rw-r--r--src/cpu/x86/lapic/secondary.S2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/cpu/x86/lapic/secondary.S b/src/cpu/x86/lapic/secondary.S
index a36502b1ac..27ee697db1 100644
--- a/src/cpu/x86/lapic/secondary.S
+++ b/src/cpu/x86/lapic/secondary.S
@@ -69,6 +69,8 @@ __ap_protected_start:
/* Set the stack pointer, and flag that we are done */
xorl %eax, %eax
movl secondary_stack, %esp
+ andl $0xfffffff0, %esp
+ sub $12, %esp /* maintain 16-byte alignment for the call below */
movl secondary_cpu_index, %edi
pushl %edi
movl %eax, secondary_stack