git: ce284dded5d5 - main - arm64: Fix comparing ID register fields
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 19 Nov 2024 17:47:03 UTC
The branch main has been updated by andrew:
URL: https://cgit.FreeBSD.org/src/commit/?id=ce284dded5d5db6b1bceda309dccba616f485ade
commit ce284dded5d5db6b1bceda309dccba616f485ade
Author: Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2024-11-19 10:20:24 +0000
Commit: Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-11-19 17:31:00 +0000
arm64: Fix comparing ID register fields
The logic in update_special_reg_field was reversed. Fix by swapping the
order of the arguments.
PR: 282505
Fixes: f1fb1d5c9017 ("arm64: Support more ID register field types")
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D47437
---
sys/arm64/arm64/identcpu.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sys/arm64/arm64/identcpu.c b/sys/arm64/arm64/identcpu.c
index f4d297e7d9bc..95e7669d053e 100644
--- a/sys/arm64/arm64/identcpu.c
+++ b/sys/arm64/arm64/identcpu.c
@@ -2261,14 +2261,14 @@ 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(cur, new_val, shift, width, sign) != 0)
+ if (mrs_field_cmp(new_val, cur, shift, width, sign) != 0)
break;
/* FALLTHROUGH */
case MRS_EXACT:
cur = (uint64_t)MRS_SAFE_VAL(type) << shift;
break;
case MRS_LOWER:
- if (mrs_field_cmp(cur, new_val, shift, width, sign) < 0)
+ if (mrs_field_cmp(new_val, cur, shift, width, sign) < 0)
cur = new_val;
break;
case MRS_HIGHER_OR_ZERO:
@@ -2278,7 +2278,7 @@ update_special_reg_field(uint64_t user_reg, u_int type, uint64_t value,
}
/* FALLTHROUGH */
case MRS_HIGHER:
- if (mrs_field_cmp(cur, new_val, shift, width, sign) > 0)
+ if (mrs_field_cmp(new_val, cur, shift, width, sign) > 0)
cur = new_val;
break;
default: