lkml.org 
[lkml]   [2021]   [Oct]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH 2/3] tools/nolibc: i386: fix initial stack alignment
Date
From: Willy Tarreau
> Sent: 24 October 2021 18:28
>
> After re-checking in the spec and comparing stack offsets with glibc,
> The last pushed argument must be 16-byte aligned (i.e. aligned before the
> call) so that in the callee esp+4 is multiple of 16, so the principle is
> the 32-bit equivalent to what Ammar fixed for x86_64. It's possible that
> 32-bit code using SSE2 or MMX could have been affected. In addition the
> frame pointer ought to be zero at the deepest level.
>
...
> /* startup code */
> +/*
> + * i386 System V ABI mandates:
> + * 1) last pushed argument must be 16-byte aligned.
> + * 2) The deepest stack frame should be set to zero

I'm pretty sure that the historic SYSV i386 ABI only every required
4-byte alignment for the stack.

At some point it got 'randomly' changed to 16-byte.
I don't think this happened until after compiler support for SSE2
intrinsics was added.
ISTR the NetBSD found that it was gcc that moved the goalposts.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

\
 
 \ /
  Last update: 2021-10-25 09:46    [W:0.443 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site