From 5611020f337cb90ea695eba6f648b304168cb4e4 Mon Sep 17 00:00:00 2001 From: Sebastian Sumpf Date: Fri, 24 May 2019 13:41:20 +0200 Subject: [PATCH] hw: fix stack alignment in bootstrap for x86_64 Fix initial stack pointer alignment for x86_64 in crt0.s startup code of bootstrap. SysV ABI states that upon function entry (rsp + 8) % 16 = 0. There, we have to align the stack to 16 bytes before all 'call' instruction not 8. Otherwise FPU (GP) exception might be raised later on because of unaligned FPU accesses. issue #3365 --- repos/base-hw/src/bootstrap/spec/x86_64/crt0.s | 1 - 1 file changed, 1 deletion(-) diff --git a/repos/base-hw/src/bootstrap/spec/x86_64/crt0.s b/repos/base-hw/src/bootstrap/spec/x86_64/crt0.s index cf2a97512..d158d6d68 100644 --- a/repos/base-hw/src/bootstrap/spec/x86_64/crt0.s +++ b/repos/base-hw/src/bootstrap/spec/x86_64/crt0.s @@ -152,7 +152,6 @@ __gdt: inc %rcx mulq %rcx movq %rax, %rcx - subq $8, %rcx leaq __bootstrap_stack@GOTPCREL(%rip),%rax movq (%rax), %rsp addq %rcx, %rsp