git: f0d036cf6655 - main - amd64/fpu: Fix build for NODEBUG kernels

From: Bojan Novković <bnovkov_at_FreeBSD.org>
Date: Wed, 22 Jan 2025 15:15:58 UTC
The branch main has been updated by bnovkov:

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

commit f0d036cf665520cead4970b4337d72b077ed5eea
Author:     Bojan Novković <bnovkov@FreeBSD.org>
AuthorDate: 2025-01-22 15:02:17 +0000
Commit:     Bojan Novković <bnovkov@FreeBSD.org>
CommitDate: 2025-01-22 15:15:32 +0000

    amd64/fpu: Fix build for NODEBUG kernels
    
    Fixes:  b995101
    Reported by:    Michael Butler (imb@protected-networks.net)
---
 sys/amd64/amd64/fpu.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c
index 79d1722268b7..48bfaa53c7b4 100644
--- a/sys/amd64/amd64/fpu.c
+++ b/sys/amd64/amd64/fpu.c
@@ -1297,6 +1297,7 @@ fpu_save_area_reset(struct savefpu *fsa)
 static __inline void
 xsave_extfeature_check(uint64_t feature, bool supervisor)
 {
+#ifdef INVARIANTS
 	uint64_t mask;
 
 	mask = supervisor ? xsave_mask_supervisor : xsave_mask;
@@ -1305,16 +1306,19 @@ xsave_extfeature_check(uint64_t feature, bool supervisor)
 	KASSERT(ilog2(feature) <= ilog2(mask),
 	    ("%s: unsupported %s XFEATURE 0x%lx", __func__,
 	    supervisor ? "supervisor" : "user", feature));
+#endif
 }
 
 static __inline void
 xsave_extstate_bv_check(uint64_t xstate_bv, bool supervisor)
 {
+#ifdef INVARIANTS
 	uint64_t mask;
 
 	mask = supervisor ? xsave_mask_supervisor : xsave_mask;
 	KASSERT(xstate_bv != 0 && ilog2(xstate_bv) <= ilog2(mask),
 	    ("%s: invalid XSTATE_BV 0x%lx", __func__, xstate_bv));
+#endif
 }
 
 /*