git: 72952bf6a307 - main - amd64: try to fix the build with old clang that does not know about FRED
Date: Thu, 30 Jul 2026 17:08:58 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=72952bf6a307391e127d3ab4a6f073664ce62d89
commit 72952bf6a307391e127d3ab4a6f073664ce62d89
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-07-30 09:45:51 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-07-30 17:08:24 +0000
amd64: try to fix the build with old clang that does not know about FRED
Reported by: jhb
Reviewed by: jhb, jrtc27
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D58550
---
sys/amd64/amd64/exception.S | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/sys/amd64/amd64/exception.S b/sys/amd64/amd64/exception.S
index 6dfb8a431fe7..458a7c405793 100644
--- a/sys/amd64/amd64/exception.S
+++ b/sys/amd64/amd64/exception.S
@@ -1403,6 +1403,23 @@ gsbase_load_fault:
movq $0,PCB_GSBASE(%r8)
jmp doreti
+#if defined(__clang__) && (__clang_major__ <= 18)
+ .macro lkgs reg
+ .if \reg != %ax
+ .err "Only %ax is supported"
+ .endif
+ .byte 0xf2, 0x0f, 0x00, 0xf0
+ .endm
+
+ .macro eretu
+ .byte 0xf3, 0x0f, 0x01, 0xca
+ .endm
+
+ .macro erets
+ .byte 0xf2, 0x0f, 0x01, 0xca
+ .endm
+#endif
+
/*
* FRED guarantees that on entry, %rflags is set to '2', which in
* particular means that interrupts are disabled, and DF/AC are clear.