Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/alpha Add _UC_SETSTACK / _UC_CLRSTACK handling. Fi...
details: https://anonhg.NetBSD.org/src/rev/b0bdd854a7e4
branches: trunk
changeset: 1021298:b0bdd854a7e4
user: thorpej <thorpej%NetBSD.org@localhost>
date: Mon May 24 21:00:12 2021 +0000
description:
Add _UC_SETSTACK / _UC_CLRSTACK handling. Fixes the t_sigaltstack test
on alpha.
diffstat:
sys/arch/alpha/alpha/machdep.c | 15 +++++++++++++--
sys/arch/alpha/include/mcontext.h | 4 +++-
2 files changed, 16 insertions(+), 3 deletions(-)
diffs (70 lines):
diff -r 13eabbb8f7b7 -r b0bdd854a7e4 sys/arch/alpha/alpha/machdep.c
--- a/sys/arch/alpha/alpha/machdep.c Mon May 24 13:43:21 2021 +0000
+++ b/sys/arch/alpha/alpha/machdep.c Mon May 24 21:00:12 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.371 2021/05/05 15:36:17 thorpej Exp $ */
+/* $NetBSD: machdep.c,v 1.372 2021/05/24 21:00:12 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2019, 2020 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.371 2021/05/05 15:36:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.372 2021/05/24 21:00:12 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1525,6 +1525,8 @@
frame.sf_uc.uc_flags = _UC_SIGMASK;
frame.sf_uc.uc_sigmask = *mask;
frame.sf_uc.uc_link = l->l_ctxlink;
+ frame.sf_uc.uc_flags |= (l->l_sigstk.ss_flags & SS_ONSTACK)
+ ? _UC_SETSTACK : _UC_CLRSTACK;
sendsig_reset(l, sig);
mutex_exit(p->p_lock);
cpu_getmcontext(l, &frame.sf_uc.uc_mcontext, &frame.sf_uc.uc_flags);
@@ -1885,8 +1887,10 @@
frame->tf_regs[FRAME_PC] = gr[_REG_PC];
frame->tf_regs[FRAME_PS] = gr[_REG_PS];
}
+
if (flags & _UC_TLSBASE)
lwp_setprivate(l, (void *)(uintptr_t)gr[_REG_UNIQUE]);
+
/* Restore floating point register context, if any. */
if (flags & _UC_FPU) {
/* If we have an FP register context, get rid of it. */
@@ -1896,6 +1900,13 @@
l->l_md.md_flags = mcp->__fpregs.__fp_fpcr & MDLWP_FP_C;
}
+ mutex_enter(l->l_proc->p_lock);
+ if (flags & _UC_SETSTACK)
+ l->l_sigstk.ss_flags |= SS_ONSTACK;
+ if (flags & _UC_CLRSTACK)
+ l->l_sigstk.ss_flags &= ~SS_ONSTACK;
+ mutex_exit(l->l_proc->p_lock);
+
return (0);
}
diff -r 13eabbb8f7b7 -r b0bdd854a7e4 sys/arch/alpha/include/mcontext.h
--- a/sys/arch/alpha/include/mcontext.h Mon May 24 13:43:21 2021 +0000
+++ b/sys/arch/alpha/include/mcontext.h Mon May 24 21:00:12 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mcontext.h,v 1.10 2019/12/27 00:32:16 kamil Exp $ */
+/* $NetBSD: mcontext.h,v 1.11 2021/05/24 21:00:12 thorpej Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -94,6 +94,8 @@
/* Machine-dependent uc_flags */
#define _UC_TLSBASE 0x20 /* valid process-unique value in _REG_UNIQUE */
+#define _UC_SETSTACK 0x00010000
+#define _UC_CLRSTACK 0x00020000
#define _UC_MACHINE_SP(uc) ((uc)->uc_mcontext.__gregs[_REG_SP])
#define _UC_MACHINE_FP(uc) ((uc)->uc_mcontext.__gregs[_REG_S6])
Home |
Main Index |
Thread Index |
Old Index