From 5fa2a10ba6822fc1e500e921dcae344db46e1649 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Sun, 23 Jun 2024 15:29:42 -0600 Subject: bsd-user: Define TARGET_SIGSTACK_ALIGN and use it to round stack Most (all?) targets require stacks to be properly aligned. Rather than a series of ifdefs in bsd-user/signal.h, instead use a manditory #define for all architectures. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/signal.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'bsd-user/signal.c') diff --git a/bsd-user/signal.c b/bsd-user/signal.c index 8b6654b91d..da49b9bffc 100644 --- a/bsd-user/signal.c +++ b/bsd-user/signal.c @@ -728,14 +728,7 @@ static inline abi_ulong get_sigframe(struct target_sigaction *ka, sp = ts->sigaltstack_used.ss_sp + ts->sigaltstack_used.ss_size; } -/* TODO: make this a target_arch function / define */ -#if defined(TARGET_ARM) - return (sp - frame_size) & ~7; -#elif defined(TARGET_AARCH64) - return (sp - frame_size) & ~15; -#else - return sp - frame_size; -#endif + return ROUND_DOWN(sp - frame_size, TARGET_SIGSTACK_ALIGN); } /* compare to $M/$M/exec_machdep.c sendsig and sys/kern/kern_sig.c sigexit */ -- cgit 1.4.1