<p>Marshall Dawson has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/20537">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">x86/lapic/secondary.S: Align stack for _secondary_start<br><br>At a process _start, the stack is expected to be aligned to a<br>16-byte boundary.  Upon entry to any function the stack frame<br>must have the end of any arguments also aligned.  In other words<br>the value of %esp+4 or %rsp+8 is always a multiple of 16 (1).<br><br>Align the stack down inside _secondary_start and preserve proper<br>alignment for the call to secondary_cpu_init.<br><br>Although 4-byte alignment is the minimum requirement for i386,<br>some AMD platforms use SSE instructions which expect 16-byte.<br><br>1) http://wiki.osdev.org/System_V_ABI<br>   See "Initial Stack and Register State" and "The Stack Frame"<br>   in the supplements.<br><br>BUG=chrome-os-partner:62841664<br><br>Change-Id: I72b7a474013e5caf67aedfabeb8d8d2553499b73<br>Signed-off-by: Marshall Dawson <marshalldawson3rd@gmail.com><br>---<br>M src/cpu/x86/lapic/secondary.S<br>1 file changed, 4 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/37/20537/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/src/cpu/x86/lapic/secondary.S b/src/cpu/x86/lapic/secondary.S<br>index 0c4c0d0..1bb957d 100644<br>--- a/src/cpu/x86/lapic/secondary.S<br>+++ b/src/cpu/x86/lapic/secondary.S<br>@@ -55,7 +55,6 @@<br>   ljmpl   $0x10, $__ap_protected_start<br> <br> __ap_protected_start:<br>-<br>    movw    $0x18, %ax<br>    movw    %ax, %ds<br>      movw    %ax, %es<br>@@ -69,6 +68,10 @@<br>  /* Set the stack pointer, and flag that we are done */<br>        xorl    %eax, %eax<br>    movl    secondary_stack, %esp<br>+        andl    $0xfffffff0, %esp<br>+    pushl   $0x0 /* maintain 16-byte alignment for the call below */<br>+     pushl   $0x0<br>+ pushl   $0x0<br>  movl    secondary_cpu_index, %edi<br>     pushl   %edi<br>  movl    %eax, secondary_stack<br></pre><p>To view, visit <a href="https://review.coreboot.org/20537">change 20537</a>. To unsubscribe, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/20537"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I72b7a474013e5caf67aedfabeb8d8d2553499b73 </div>
<div style="display:none"> Gerrit-Change-Number: 20537 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Marshall Dawson <marshalldawson3rd@gmail.com> </div>