Module Name: src
Committed By: tnn
Date: Fri May 1 17:58:48 UTC 2020
Modified Files:
src/sys/arch/aarch64/aarch64: cpu_machdep.c sig_machdep.c
Log Message:
aarch64: handle _UC_SETSTACK and _UC_CLRSTACK like on arm32
ok ryo@
To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/aarch64/aarch64/cpu_machdep.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/aarch64/aarch64/sig_machdep.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/aarch64/aarch64/cpu_machdep.c
diff -u src/sys/arch/aarch64/aarch64/cpu_machdep.c:1.8 src/sys/arch/aarch64/aarch64/cpu_machdep.c:1.9
--- src/sys/arch/aarch64/aarch64/cpu_machdep.c:1.8 Sat Nov 23 19:40:34 2019
+++ src/sys/arch/aarch64/aarch64/cpu_machdep.c Fri May 1 17:58:48 2020
@@ -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 @@ cpu_getmcontext(struct lwp *l, mcontext_
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 @@ cpu_setmcontext(struct lwp *l, const mco
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;
}
Index: src/sys/arch/aarch64/aarch64/sig_machdep.c
diff -u src/sys/arch/aarch64/aarch64/sig_machdep.c:1.4 src/sys/arch/aarch64/aarch64/sig_machdep.c:1.5
--- src/sys/arch/aarch64/aarch64/sig_machdep.c:1.4 Thu Apr 23 17:21:53 2020
+++ src/sys/arch/aarch64/aarch64/sig_machdep.c Fri May 1 17:58:48 2020
@@ -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 @@ sendsig_siginfo(const ksiginfo_t *ksi, c
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);