git: a1a8bcdfde2e - main - x86: x86_msr_op(): Simplify assertions
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 03 Feb 2026 14:05:04 UTC
The branch main has been updated by olce:
URL: https://cgit.FreeBSD.org/src/commit/?id=a1a8bcdfde2e616cffeb4bf4e1968ba55cf409e9
commit a1a8bcdfde2e616cffeb4bf4e1968ba55cf409e9
Author: Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2026-01-22 14:37:00 +0000
Commit: Olivier Certner <olce@FreeBSD.org>
CommitDate: 2026-02-03 14:03:01 +0000
x86: x86_msr_op(): Simplify assertions
Simplify them by moving them into more natural places, i.e., default
cases of 'switch' statements.
No functional change (intended).
Reviewed by: kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D54996
---
sys/x86/x86/cpu_machdep.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/sys/x86/x86/cpu_machdep.c b/sys/x86/x86/cpu_machdep.c
index b0763d7bd98e..5cbcb40540bb 100644
--- a/sys/x86/x86/cpu_machdep.c
+++ b/sys/x86/x86/cpu_machdep.c
@@ -145,6 +145,8 @@ x86_msr_op_one(void *argp)
v = rdmsr(a->msr);
*a->res = v;
break;
+ default:
+ __assert_unreachable();
}
}
@@ -162,13 +164,7 @@ x86_msr_op(u_int msr, u_int op, uint64_t arg1, uint64_t *res)
int bound_cpu, cpu, i, is_bound;
exmode = op & MSR_OP_EXMODE_MASK;
- MPASS(exmode == MSR_OP_LOCAL || exmode == MSR_OP_SCHED_ALL ||
- exmode == MSR_OP_SCHED_ONE || exmode == MSR_OP_RENDEZVOUS_ALL ||
- exmode == MSR_OP_RENDEZVOUS_ONE);
-
a.op = op & MSR_OP_OP_MASK;
- MPASS(a.op == MSR_OP_ANDNOT || a.op == MSR_OP_OR ||
- a.op == MSR_OP_WRITE || a.op == MSR_OP_READ);
a.msr = msr;
a.arg1 = arg1;
a.res = res;
@@ -219,6 +215,8 @@ x86_msr_op(u_int msr, u_int op, uint64_t arg1, uint64_t *res)
smp_rendezvous_cpus(set, smp_no_rendezvous_barrier,
x86_msr_op_one, smp_no_rendezvous_barrier, &a);
break;
+ default:
+ __assert_unreachable();
}
}