[PATCH 0/1] x86_64: Fix stack aligment for x86-64 SysV ABI
Joel Sherrill
joel at rtems.org
Sat Mar 23 15:08:28 UTC 2024
This is a great explanation. Would you mind filing a ticket with this
explanatino and referencing the ticket in the commit message of the patch?
When someone wonders about the change in the future, the ticket explanation
will be useful
On Fri, Mar 22, 2024 at 9:24 PM Matheus Pecoraro <matpecor at gmail.com> wrote:
> I kept getting a general protection fault whenever attempting to
> execute the amd64 BSP while preparing for my GSOC proposal.
>
> The GPF was being caused by an instruction attempting to move an SSE
> register to an address on the stack not aligned to 16 bytes. After
> some debugging I noticed that the code for setting up the stack frame
> for a context would result in it being misaligned by 8 bytes as to
> what is expected by the x86-64 SysV ABI, thus leading the compiler to
> unknowingly cause the exception (when control is transferred to the
> function entry point RSP+8 is supposed to be a multiple of 16, without
> this patch RSP itself was a multiple of 16).
>
> After the fix I was able to run the hello test on the amd64 BSP both
> while booting through the FreeBSD bootloader with no EFI boot services
> as well as through GRUB with multiboot2 and EFI boot services.
>
> Matheus Pecoraro (1):
> x86_64: Fix stack aligment for x86-64 SysV ABI
>
> bsps/x86_64/amd64/clock/eficlock.c | 28 ++-----------------
> bsps/x86_64/amd64/start/start.S | 1 -
> .../cpu/x86_64/x86_64-context-initialize.c | 4 +--
> 3 files changed, 5 insertions(+), 28 deletions(-)
>
> --
> 2.43.0
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20240323/8e06ecaf/attachment.htm>
More information about the devel
mailing list