amd64: gate WRMSRNS immediate form on compiler support

This support was introduced in LLVM 20 and we still support releases
with LLVM 19 so it's too early to require LLVM 20.  Decay to the
non-immediate form when the compiler it too old.  This makes the ifunc
pointless, but limits the need for other ifdefs.

Reviewed by:	kib
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D60023
This commit is contained in:
Brooks Davis committed 2026-09-26 12:43:34 +01:00
1 parent 2a717d519e
commit 53fe018630
1 file changed
+10
+10
View File
@@ -390,8 +390,18 @@ wrmsrns(u_int msr, uint64_t newval)
__asm __volatile("wrmsrns" : : "a" (low), "d" (high), "c" (msr));
}
#if defined(__clang__) && \
(__clang_major__ > 20 || (__clang_major__ == 20 && __clang_minor__ >= 1))
#define wrmsr_imm(msr, val) \
__asm __volatile("wrmsrns %0, %1" : : "r" (val), "i" (msr))
#else
/*
* When Clang does not support the immediate form of wrmsr, decay it
* to plain wrmsr.
*/
#define wrmsr_imm(msr, val) \
wrmsr((msr), (val));
#endif
static __inline void
load_cr0(u_long data)