[PATCH 0/1] x86_64: Fix stack aligment for x86-64 SysV ABI
Matheus Pecoraro
matpecor at gmail.com
Sat Mar 23 02:24:01 UTC 2024
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
More information about the devel
mailing list