git: 14006c96214a - main - arm64: Fix the MRS_EXACT_IF_DIFFERENT check

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Thu, 12 Dec 2024 18:18:58 UTC
The branch main has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=14006c96214a772ba2e2f07bb4301657d8c2055a

commit 14006c96214a772ba2e2f07bb4301657d8c2055a
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2024-12-11 17:54:37 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-12-12 18:00:22 +0000

    arm64: Fix the MRS_EXACT_IF_DIFFERENT check
    
    When comparing two ID registers to create a common userspace view we
    have an option where we set an exact value only if the two are
    different. This is only used in one field in the cache type register
    that is accessible by userspace without being trapped by the kernel.
    
    In preparation for trapping access to this register to handle it in
    the kernel in some situations fix the 'if different' check.
    
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D47811
---
 sys/arm64/arm64/identcpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/arm64/arm64/identcpu.c b/sys/arm64/arm64/identcpu.c
index 95e7669d053e..646d10d5ae1a 100644
--- a/sys/arm64/arm64/identcpu.c
+++ b/sys/arm64/arm64/identcpu.c
@@ -2261,7 +2261,7 @@ update_special_reg_field(uint64_t user_reg, u_int type, uint64_t value,
 
 	switch (type & MRS_TYPE_MASK) {
 	case MRS_EXACT_IF_DIFFERENT:
-		if (mrs_field_cmp(new_val, cur, shift, width, sign) != 0)
+		if (mrs_field_cmp(new_val, cur, shift, width, sign) == 0)
 			break;
 		/* FALLTHROUGH */
 	case MRS_EXACT: