[coreboot-gerrit] Change in coreboot[master]: binaryPI: Fix SSE regression and align stack early

gerrit code review gerrit at coreboot.org
Thu Mar 16 15:23:22 CET 2017


>From Martin Roth <martinroth at google.com>:

Martin Roth has submitted this change and it was merged. ( https://review.coreboot.org/18691 )

Change subject: binaryPI: Fix SSE regression and align stack early
......................................................................


binaryPI: Fix SSE regression and align stack early

When allowing use of SSE instructions, stack must be
aligned to 16 bytes. Adjust x86 entry to C accordingly,
by pushing values to maintain the alignment.

For some builds, new toolchain and GCC-6.3 could emit
SSE instruction 'andps (%esp),%xmm0' with incorrectly
aligned esp, raising exception and thus preventing boot.

Change-Id: I452d40eadac2b743d0d8431809c9a81bf28c330a
Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
Reviewed-on: https://review.coreboot.org/18691
Reviewed-by: Aaron Durbin <adurbin at chromium.org>
Reviewed-by: Nico Huber <nico.h at gmx.de>
Tested-by: build bot (Jenkins)
Reviewed-by: Marshall Dawson <marshalldawson3rd at gmail.com>
---
M src/cpu/amd/pi/cache_as_ram.inc
1 file changed, 6 insertions(+), 2 deletions(-)

Approvals:
  Aaron Durbin: Looks good to me, approved
  Marshall Dawson: Looks good to me, approved
  build bot (Jenkins): Verified
  Nico Huber: Looks good to me, approved



diff --git a/src/cpu/amd/pi/cache_as_ram.inc b/src/cpu/amd/pi/cache_as_ram.inc
index 24db600..c0a69ec 100644
--- a/src/cpu/amd/pi/cache_as_ram.inc
+++ b/src/cpu/amd/pi/cache_as_ram.inc
@@ -63,6 +63,9 @@
 
   AMD_ENABLE_STACK
 
+  /* Align the stack. */
+  and     $0xFFFFFFF0, %esp
+
 #ifdef __x86_64__
   /* switch to 64 bit long mode */
   mov     %esi, %ecx
@@ -111,8 +114,6 @@
   /* Pass the BIST result */
   cvtsd2si        %xmm0, %edi
 
-  /* align the stack */
-  and     $0xFFFFFFF0, %esp
 
   .code64
   call    cache_as_ram_main
@@ -126,6 +127,9 @@
   /* Restore the  cpu_init_detected */
   cvtsd2si  %xmm1, %ebx
 
+  /* Must maintain 16-byte stack alignment here. */
+  pushl $0x0
+  pushl $0x0
   pushl %ebx  /* init detected */
   pushl %edx  /* bist */
   call  cache_as_ram_main

-- 
To view, visit https://review.coreboot.org/18691
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I452d40eadac2b743d0d8431809c9a81bf28c330a
Gerrit-PatchSet: 3
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Owner: Kyösti Mälkki <kyosti.malkki at gmail.com>
Gerrit-Reviewer: Aaron Durbin <adurbin at chromium.org>
Gerrit-Reviewer: Marc Jones <marc at marcjonesconsulting.com>
Gerrit-Reviewer: Marshall Dawson <marshalldawson3rd at gmail.com>
Gerrit-Reviewer: Martin Roth <martinroth at google.com>
Gerrit-Reviewer: Nico Huber <nico.h at gmx.de>
Gerrit-Reviewer: Paul Menzel <paulepanter at users.sourceforge.net>
Gerrit-Reviewer: build bot (Jenkins)



More information about the coreboot-gerrit mailing list