Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/aarch64/aarch64 aarch64: handle _UC_SETSTACK and _U...



details:   https://anonhg.NetBSD.org/src/rev/5cadb8060b76
branches:  trunk
changeset: 932179:5cadb8060b76
user:      tnn <tnn%NetBSD.org@localhost>
date:      Fri May 01 17:58:48 2020 +0000

description:
aarch64: handle _UC_SETSTACK and _UC_CLRSTACK like on arm32

ok ryo@

diffstat:

 sys/arch/aarch64/aarch64/cpu_machdep.c |  13 +++++++++++--
 sys/arch/aarch64/aarch64/sig_machdep.c |   6 ++++--
 2 files changed, 15 insertions(+), 4 deletions(-)

diffs (68 lines):

diff -r d11fb70e34f5 -r 5cadb8060b76 sys/arch/aarch64/aarch64/cpu_machdep.c
--- a/sys/arch/aarch64/aarch64/cpu_machdep.c    Fri May 01 17:14:28 2020 +0000
+++ b/sys/arch/aarch64/aarch64/cpu_machdep.c    Fri May 01 17:58:48 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_machdep.c,v 1.8 2019/11/23 19:40:34 ad Exp $ */
+/* $NetBSD: cpu_machdep.c,v 1.9 2020/05/01 17:58:48 tnn Exp $ */
 
 /*-
  * Copyright (c) 2014, 2019 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: cpu_machdep.c,v 1.8 2019/11/23 19:40:34 ad Exp $");
+__KERNEL_RCSID(1, "$NetBSD: cpu_machdep.c,v 1.9 2020/05/01 17:58:48 tnn Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -198,6 +198,8 @@
 int
 cpu_setmcontext(struct lwp *l, const mcontext_t *mcp, unsigned int flags)
 {
+       struct proc * const p = l->l_proc;
+
        if (flags & _UC_CPU) {
                struct trapframe * const tf = l->l_md.md_utf;
                int error = cpu_mcontext_validate(l, mcp);
@@ -216,6 +218,13 @@
                pcb->pcb_fpregs = *(const struct fpreg *)&mcp->__fregs;
        }
 
+       mutex_enter(p->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(p->p_lock);
+
        return 0;
 }
 
diff -r d11fb70e34f5 -r 5cadb8060b76 sys/arch/aarch64/aarch64/sig_machdep.c
--- a/sys/arch/aarch64/aarch64/sig_machdep.c    Fri May 01 17:14:28 2020 +0000
+++ b/sys/arch/aarch64/aarch64/sig_machdep.c    Fri May 01 17:58:48 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sig_machdep.c,v 1.4 2020/04/23 17:21:53 skrll Exp $ */
+/* $NetBSD: sig_machdep.c,v 1.5 2020/05/01 17:58:48 tnn Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: sig_machdep.c,v 1.4 2020/04/23 17:21:53 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sig_machdep.c,v 1.5 2020/05/01 17:58:48 tnn Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -71,6 +71,8 @@
        uc.uc_flags = _UC_SIGMASK;
        uc.uc_sigmask = *mask;
        uc.uc_link = l->l_ctxlink;
+       uc.uc_flags |= (l->l_sigstk.ss_flags & SS_ONSTACK)
+           ? _UC_SETSTACK : _UC_CLRSTACK;
        sendsig_reset(l, ksi->ksi_signo);
        mutex_exit(p->p_lock);
        cpu_getmcontext(l, &uc.uc_mcontext, &uc.uc_flags);



Home | Main Index | Thread Index | Old Index