From df3190413354b9c7453e759f5579934474f0ab97 Mon Sep 17 00:00:00 2001 From: Marshall Dawson Date: Fri, 29 Sep 2017 11:14:44 -0600 Subject: [PATCH] cpu/x86: Align stack in SIPI handler Ensure the stack is properly aligned in the SIPI handler. This avoids an exception when an aligned instruction is performed on stack data. BUG=b:66003093 TEST=boot kahlee built with gcc 6.3 Change-Id: Ibdd8242494c6a2bc0c6ead7ac98be55149219d7c Signed-off-by: Marshall Dawson Reviewed-on: https://review.coreboot.org/21768 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/cpu/x86/sipi_vector.S | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cpu/x86/sipi_vector.S b/src/cpu/x86/sipi_vector.S index b40ea76f76..bd60c65a88 100644 --- a/src/cpu/x86/sipi_vector.S +++ b/src/cpu/x86/sipi_vector.S @@ -114,6 +114,8 @@ _start: movl stack_top, %edx subl %eax, %edx mov %edx, %esp + andl $0xfffffff0, %esp /* ensure stack alignment */ + /* Save CPU number. */ mov %ecx, %esi @@ -192,7 +194,8 @@ load_msr: mov %eax, %cr4 #endif - /* c_handler(cpu_num) */ + /* c_handler(cpu_num), preserve proper stack alignment */ + sub $12, %esp push %esi /* cpu_num */ mov c_handler, %eax call *%eax