Re: [PATCH] x86/fpu: Fix boot crash in the early FPU code

Maciej W. Rozycki
2015-07-05T10:00:18Z

On Sat, 4 Jul 2015, Ingo Molnar wrote:

> Btw., is it a GCC bug or a known GCC property that a structure with a 16-byte
> alignment attribute does not get properly aligned on the stack?

What's the stack alignment mandated by the x86 psABI? Is that anything
beyond what the PUSH instructions imply (i.e. 4 bytes for 32-bit and 8
bytes for 64-bit targets)? Otherwise GCC might not be smart enough to
apply the right subtract and mask operations to the stack/frame pointer.
This might even have been documented with the alignment attribute.

> So fix this bug by making the variable static again, but also mark it
> __initdata this time, because fpu__init_system_mxcsr() is now an
> __init function.

You could have used `alloca' and manually aligned the structure within
the area obtained too (to avoid static storage if desired).

FWIW,

Maciej