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 Fix a problem that setcontext(2) so...



details:   https://anonhg.NetBSD.org/src/rev/742e78d4c156
branches:  trunk
changeset: 933180:742e78d4c156
user:      ryo <ryo%NetBSD.org@localhost>
date:      Thu May 21 05:41:40 2020 +0000

description:
Fix a problem that setcontext(2) sometimes fail on ARMv8.5-BTI cpu.

fixed to always get 0 for SPSR.BTYPE with getcontext(2).
a non-zero SPSR.BTYPE cannot be set with setcontext(2).

diffstat:

 sys/arch/aarch64/aarch64/cpu_machdep.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r ddd9fa5e17aa -r 742e78d4c156 sys/arch/aarch64/aarch64/cpu_machdep.c
--- a/sys/arch/aarch64/aarch64/cpu_machdep.c    Thu May 21 05:04:13 2020 +0000
+++ b/sys/arch/aarch64/aarch64/cpu_machdep.c    Thu May 21 05:41:40 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_machdep.c,v 1.9 2020/05/01 17:58:48 tnn Exp $ */
+/* $NetBSD: cpu_machdep.c,v 1.10 2020/05/21 05:41:40 ryo 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.9 2020/05/01 17:58:48 tnn Exp $");
+__KERNEL_RCSID(1, "$NetBSD: cpu_machdep.c,v 1.10 2020/05/21 05:41:40 ryo Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -185,6 +185,7 @@
 
        memcpy(mcp->__gregs, &tf->tf_regs, sizeof(mcp->__gregs));
        mcp->__gregs[_REG_TPIDR] = (uintptr_t)l->l_private;
+       mcp->__gregs[_REG_SPSR] &= ~SPSR_A64_BTYPE;
 
        if (fpu_used_p(l)) {
                const struct pcb * const pcb = lwp_getpcb(l);



Home | Main Index | Thread Index | Old Index