Module Name:    src
Committed By:   ryo
Date:           Thu May 21 05:41:40 UTC 2020

Modified Files:
        src/sys/arch/aarch64/aarch64: cpu_machdep.c

Log Message:
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).


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/aarch64/aarch64/cpu_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.9 src/sys/arch/aarch64/aarch64/cpu_machdep.c:1.10
--- src/sys/arch/aarch64/aarch64/cpu_machdep.c:1.9	Fri May  1 17:58:48 2020
+++ src/sys/arch/aarch64/aarch64/cpu_machdep.c	Thu May 21 05:41:40 2020
@@ -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 @@ cpu_getmcontext(struct lwp *l, mcontext_
 
 	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);

Reply via email to