qemu/bsd-user/x86_64
Ilya Leoshkevich 1f31243a8c bsd-user/x86_64/target_arch_thread.h: Align stack
bsd-user qemu-x86_64 almost immediately dies with:

    qemu: 0x4002201a68: unhandled CPU exception 0xd - aborting

on FreeBSD 14.1-RELEASE. This is an instruction that requires
alignment:

    (gdb) x/i 0x4002201a68
       0x4002201a68:        movaps %xmm0,-0x40(%rbp)

and the argument is not aligned:

    (gdb) p/x env->regs[5]
    $1 = 0x822443b58

A quick experiment shows that the userspace entry point expects
misaligned rsp:

    (gdb) starti
    (gdb) p/x $rsp
    $1 = 0x7fffffffeaa8

Emulate this behavior in bsd-user.

[[ applied Richard's suggestion ]]

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Warner Losh <imp@bsdimp.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
2024-11-04 20:26:40 -07:00
..
signal.c bsd-user: Clean up includes 2023-02-08 07:16:23 +01:00
target_arch_cpu.c bsd-user: Clean up includes 2023-02-08 07:16:23 +01:00
target_arch_cpu.h Clean up ill-advised or unusual header guards 2022-05-11 16:50:01 +02:00
target_arch_elf.h bsd-user: Remove ELF_START_MMAP and image_info.start_mmap 2023-08-28 12:16:18 -06:00
target_arch_reg.h Clean up ill-advised or unusual header guards 2022-05-11 16:50:01 +02:00
target_arch_signal.h bsd-user: Define TARGET_SIGSTACK_ALIGN and use it to round stack 2024-07-23 10:56:30 -06:00
target_arch_sigtramp.h Clean up ill-advised or unusual header guards 2022-05-11 16:50:01 +02:00
target_arch_sysarch.h Clean up header guards that don't match their file name 2022-05-11 16:49:06 +02:00
target_arch_thread.h bsd-user/x86_64/target_arch_thread.h: Align stack 2024-11-04 20:26:40 -07:00
target_arch_vmparam.h Clean up ill-advised or unusual header guards 2022-05-11 16:50:01 +02:00
target_arch.h Clean up ill-advised or unusual header guards 2022-05-11 16:50:01 +02:00
target_syscall.h bsd-user: move strace OS/arch dependent code to host/arch dirs 2021-01-11 14:59:21 +01:00
target.h Clean up decorations and whitespace around header guards 2022-05-11 16:50:32 +02:00