aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2026-07-30 09:45:51 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2026-07-30 17:08:24 +0000
commit72952bf6a307391e127d3ab4a6f073664ce62d89 (patch)
treed21893c283ad9b6b299346fec8aee3cd7565bdab
parentcef05c5a62ba63eda222eed083972bfaa1449ac2 (diff)
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
-rw-r--r--sys/amd64/amd64/exception.S17
1 files changed, 17 insertions, 0 deletions
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.