Module Name: src
Committed By: jmcneill
Date: Sat Feb 20 19:27:35 UTC 2021
Modified Files:
src/sys/arch/aarch64/include: locore.h
Log Message:
daif_disable: since we read bits before setting them, if the current state
matches the desired state we can skip the daif write
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/aarch64/include/locore.h
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/include/locore.h
diff -u src/sys/arch/aarch64/include/locore.h:1.7 src/sys/arch/aarch64/include/locore.h:1.8
--- src/sys/arch/aarch64/include/locore.h:1.7 Sun Feb 7 21:15:09 2021
+++ src/sys/arch/aarch64/include/locore.h Sat Feb 20 19:27:35 2021
@@ -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 @@ static inline register_t __unused
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;
}