[coreboot-gerrit] Patch set updated for coreboot: AGESA: Fix SSE regression and align stack early

Kyösti Mälkki (kyosti.malkki@gmail.com) gerrit at coreboot.org
Wed Mar 8 23:22:49 CET 2017


Kyösti Mälkki (kyosti.malkki at gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18622

-gerrit

commit 277cc341425b334f4ffed146b858eac6127cc7d7
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date:   Wed Nov 23 20:40:53 2016 +0200

    AGESA: 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.
    
    Fixes regression with new toolchain using GCC-6.3 and
      ec0a393 console: Enable printk for ENV_LIBAGESA
    
    For some builds, the above-mentioned commit emitted
    SSE instruction 'andps (%esp),%xmm0' with incorrectly
    aligned esp, raising exception and thus preventing boot.
    
    Change-Id: Ief57a2ea053c7497d50903838310b7f7800bff26
    Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
---
 src/cpu/amd/agesa/cache_as_ram.inc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/cpu/amd/agesa/cache_as_ram.inc b/src/cpu/amd/agesa/cache_as_ram.inc
index 24db600..c0a69ec 100644
--- a/src/cpu/amd/agesa/cache_as_ram.inc
+++ b/src/cpu/amd/agesa/cache_as_ram.inc
@@ -63,6 +63,9 @@ cache_as_ram_setup:
 
   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 @@ cache_as_ram_setup:
   /* Pass the BIST result */
   cvtsd2si        %xmm0, %edi
 
-  /* align the stack */
-  and     $0xFFFFFFF0, %esp
 
   .code64
   call    cache_as_ram_main
@@ -126,6 +127,9 @@ cache_as_ram_setup:
   /* 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



More information about the coreboot-gerrit mailing list