git: 2947a48bea3b - stable/15 - amd64: try to fix the build with old clang that does not know about FRED

Konstantin Belousov <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src,gmane.os.freebsd.devel.stable.scm
Message-ID <[email protected]>
The branch stable/15 has been updated by kib:

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

commit 2947a48bea3b720e58f3a2e1d6740789e9cc259a
Author:     Konstantin Belousov <[email protected]>
AuthorDate: 2026-07-30 09:45:51 +0000
Commit:     Konstantin Belousov <[email protected]>
CommitDate: 2026-08-07 10:27:34 +0000

    amd64: try to fix the build with old clang that does not know about FRED
    
    (cherry picked from commit 72952bf6a307391e127d3ab4a6f073664ce62d89)
---
 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 8eb5c185974d..0e783fe4ff00 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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.