Skip to content

Commit

Permalink
arm64: Fix the MRS_EXACT_IF_DIFFERENT check
Browse files Browse the repository at this point in the history
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

(cherry picked from commit 14006c96214a772ba2e2f07bb4301657d8c2055a)
  • Loading branch information
zxombie authored and bsdjhb committed Feb 6, 2025
1 parent 1cc8725 commit 8e84bc4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sys/arm64/arm64/identcpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -2279,7 +2279,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:
Expand Down

0 comments on commit 8e84bc4

Please sign in to comment.