bsd-user:Add AArch64 improvements and signal handling functions

Added get_ucontext_sigreturn function to check processor state ensuring current execution mode is EL0 and no flags
indicating interrupts or exceptions are set.
Updated AArch64 code to use CF directly without reading/writing the entire processor state, improving efficiency.
Changed FP data structures to use Int128 instead of __uint128_t, leveraging QEMU's generic mechanism for referencing this type.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Ajeet Singh <itachis@FreeBSD.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20240707191128.10509-9-itachis@FreeBSD.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
This commit is contained in:
Stacey Son 2024-07-08 00:41:28 +05:30 committed by Warner Losh
parent dadfc6d5df
commit ce6c541dcb
5 changed files with 26 additions and 8 deletions

View file

@ -21,7 +21,7 @@
#include "qemu.h"
/*
* Compare to sendsig() in sys/arm64/arm64/machdep.c
* Compare to sendsig() in sys/arm64/arm64/exec_machdep.c
* Assumes that target stack frame memory is locked.
*/
abi_long set_sigtramp_args(CPUARMState *regs, int sig,
@ -117,3 +117,21 @@ abi_long set_mcontext(CPUARMState *regs, target_mcontext_t *mcp, int srflag)
return err;
}
/* Compare to sys_sigreturn() in arm64/arm64/machdep.c */
abi_long get_ucontext_sigreturn(CPUARMState *regs, abi_ulong target_sf,
abi_ulong *target_uc)
{
uint32_t pstate = pstate_read(regs);
*target_uc = 0;
if ((pstate & PSTATE_M) != PSTATE_MODE_EL0t ||
(pstate & (PSTATE_F | PSTATE_I | PSTATE_A | PSTATE_D)) != 0) {
return -TARGET_EINVAL;
}
*target_uc = target_sf;
return 0;
}