diff options
author | Marshall Dawson <marshalldawson3rd@gmail.com> | 2017-07-07 16:09:56 -0600 |
---|---|---|
committer | Martin Roth <martinroth@google.com> | 2017-07-13 16:48:22 +0000 |
commit | ce9c88348cb1380199b8f57a435a51a7edb470a0 (patch) | |
tree | f484a1f3a6c7cfbf5b78817c486d2a8fd793fed1 /src/arch/x86 | |
parent | c35a1e888729b060229b4a326b1b42d09cb7c278 (diff) |
arch/x86/assembly_entry: Align stack for car_stage_entry
At 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 and change the method for executing
car_stage_entry from jmp to call which should preserve proper
alignment regardless of a 32- or 64-bit build.
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: I8a15514f551a8e17e9fe77b8402fe0d2b106972e
Signed-off-by: Marshall Dawson <marshalldawson3rd@gmail.com>
Reviewed-on: https://review.coreboot.org/20528
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/arch/x86')
-rw-r--r-- | src/arch/x86/assembly_entry.S | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/arch/x86/assembly_entry.S b/src/arch/x86/assembly_entry.S index 56a5b630c8..220cc6e400 100644 --- a/src/arch/x86/assembly_entry.S +++ b/src/arch/x86/assembly_entry.S @@ -63,7 +63,8 @@ debug_spinloop: jz debug_spinloop #endif - jmp car_stage_entry + andl $0xfffffff0, %esp + call car_stage_entry /* This is here for linking purposes. */ .weak car_stage_entry |