Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/aarch64/include daif_disable: since we read bits be...
details: https://anonhg.NetBSD.org/src/rev/1b52a7b7191c
branches: trunk
changeset: 980856:1b52a7b7191c
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sat Feb 20 19:27:35 2021 +0000
description:
daif_disable: since we read bits before setting them, if the current state
matches the desired state we can skip the daif write
diffstat:
sys/arch/aarch64/include/locore.h | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diffs (26 lines):
diff -r ecec1a98f62a -r 1b52a7b7191c sys/arch/aarch64/include/locore.h
--- a/sys/arch/aarch64/include/locore.h Sat Feb 20 19:10:37 2021 +0000
+++ b/sys/arch/aarch64/include/locore.h Sat Feb 20 19:27:35 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.h,v 1.7 2021/02/07 21:15:09 jmcneill Exp $ */
+/* $NetBSD: locore.h,v 1.8 2021/02/20 19:27:35 jmcneill Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -80,10 +80,12 @@
daif_disable(register_t psw)
{
register_t oldpsw = reg_daif_read();
- if (!__builtin_constant_p(psw)) {
- reg_daif_write(oldpsw | psw);
- } else {
- reg_daifset_write((psw & DAIF_MASK) >> DAIF_SETCLR_SHIFT);
+ if ((oldpsw & psw) != psw) {
+ if (!__builtin_constant_p(psw)) {
+ reg_daif_write(oldpsw | psw);
+ } else {
+ reg_daifset_write((psw & DAIF_MASK) >> DAIF_SETCLR_SHIFT);
+ }
}
return oldpsw;
}
Home |
Main Index |
Thread Index |
Old Index