Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Add __HAVE_PREEMPTION support to gic_splfuncs asm f...
details: https://anonhg.NetBSD.org/src/rev/4459cf6289bb
branches: trunk
changeset: 990595:4459cf6289bb
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sat Oct 30 20:23:11 2021 +0000
description:
Add __HAVE_PREEMPTION support to gic_splfuncs asm funcs.
"looks right to me" - thorpej
diffstat:
sys/arch/aarch64/aarch64/genassym.cf | 3 +-
sys/arch/arm/cortex/gic_splfuncs_armv8.S | 35 ++++++++++++++++++++++++-------
2 files changed, 29 insertions(+), 9 deletions(-)
diffs (101 lines):
diff -r 8a48a14204c1 -r 4459cf6289bb sys/arch/aarch64/aarch64/genassym.cf
--- a/sys/arch/aarch64/aarch64/genassym.cf Sat Oct 30 20:01:46 2021 +0000
+++ b/sys/arch/aarch64/aarch64/genassym.cf Sat Oct 30 20:23:11 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: genassym.cf,v 1.36 2021/10/30 18:49:47 jmcneill Exp $
+# $NetBSD: genassym.cf,v 1.37 2021/10/30 20:23:11 jmcneill Exp $
#-
# Copyright (c) 2014 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -163,6 +163,7 @@
define L_MD_DA_USER offsetof(struct lwp, l_md.md_da_user)
define L_MD_DB_USER offsetof(struct lwp, l_md.md_db_user)
define L_MD_GA_USER offsetof(struct lwp, l_md.md_ga_user)
+define L_NOPREEMPT offsetof(struct lwp, l_nopreempt)
define LW_SYSTEM LW_SYSTEM
define FB_X19 FB_X19
diff -r 8a48a14204c1 -r 4459cf6289bb sys/arch/arm/cortex/gic_splfuncs_armv8.S
--- a/sys/arch/arm/cortex/gic_splfuncs_armv8.S Sat Oct 30 20:01:46 2021 +0000
+++ b/sys/arch/arm/cortex/gic_splfuncs_armv8.S Sat Oct 30 20:23:11 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gic_splfuncs_armv8.S,v 1.1 2021/10/30 18:44:24 jmcneill Exp $ */
+/* $NetBSD: gic_splfuncs_armv8.S,v 1.2 2021/10/30 20:23:12 jmcneill Exp $ */
/*-
* Copyright (c) 2021 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,21 @@
#include <machine/asm.h>
#include "assym.h"
-RCSID("$NetBSD: gic_splfuncs_armv8.S,v 1.1 2021/10/30 18:44:24 jmcneill Exp $")
+RCSID("$NetBSD: gic_splfuncs_armv8.S,v 1.2 2021/10/30 20:23:12 jmcneill Exp $")
+
+#ifdef __HAVE_PREEMPTION
+#define DISABLE_PREEMPTION \
+ ldr w1, [x3, #L_NOPREEMPT]; \
+ add w1, w1, #1; \
+ str w1, [x3, #L_NOPREEMPT]
+#define ENABLE_PREEMPTION \
+ ldr w1, [x3, #L_NOPREEMPT]; \
+ sub w1, w1, #1; \
+ str w1, [x3, #L_NOPREEMPT]
+#else
+#define DISABLE_PREEMPTION
+#define ENABLE_PREEMPTION
+#endif
/*
* int
@@ -39,9 +53,10 @@
*/
.align 7 /* cacheline-aligned */
ENTRY_NP(gic_splraise)
- /* Save cpu_info pointer in x1 */
- mrs x1, tpidr_el1 /* get curlwp */
- ldr x1, [x1, #L_CPU] /* get curcpu */
+ /* Save curlwp in x3, curcpu in x1 */
+ mrs x3, tpidr_el1 /* get curlwp */
+ DISABLE_PREEMPTION
+ ldr x1, [x3, #L_CPU] /* get curcpu */
/* If newipl > cpl, update cpl */
ldr w2, [x1, #CI_CPL]
@@ -50,6 +65,7 @@
str w0, [x1, #CI_CPL]
.Lnoraise:
+ ENABLE_PREEMPTION
mov w0, w2 /* return oldipl */
ret
END(gic_splraise)
@@ -63,9 +79,10 @@
*/
.align 7 /* cacheline-aligned */
ENTRY_NP(gic_splx)
- /* Save cpu_info pointer in x1 */
- mrs x1, tpidr_el1 /* get curlwp */
- ldr x1, [x1, #L_CPU] /* get curcpu */
+ /* Save curlwp in x3, curcpu in x1 */
+ mrs x3, tpidr_el1 /* get curlwp */
+ DISABLE_PREEMPTION
+ ldr x1, [x3, #L_CPU] /* get curcpu */
/* If newipl >= cpl, just return */
ldr w2, [x1, #CI_CPL]
@@ -99,6 +116,7 @@
cbnz w2, _C_LABEL(dosoftints)
.Ldone:
+ ENABLE_PREEMPTION
ret
.Lrestart:
@@ -113,6 +131,7 @@
str xzr, [x1, #CI_SPLX_RESTART]
.Lslow:
+ ENABLE_PREEMPTION
/* Jump to slow path */
b _C_LABEL(Xgic_splx)
END(gic_splx)
Home |
Main Index |
Thread Index |
Old Index