git: 74d971fe1561 - main - x86: Add external retpoline thunk
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 09 Oct 2026 14:50:51 UTC
The branch main has been updated by emaste:
URL: https://cgit.FreeBSD.org/src/commit/?id=74d971fe156113cc63add2e6701e369c93c4f52b
commit 74d971fe156113cc63add2e6701e369c93c4f52b
Author: Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2018-03-14 14:53:34 +0000
Commit: Ed Maste <emaste@FreeBSD.org>
CommitDate: 2026-10-09 14:50:40 +0000
x86: Add external retpoline thunk
This allows use of -mindirect-branch=thunk-extern, and is only a few
bytes of dead code if not used.
Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D60524
---
sys/amd64/amd64/support.S | 10 ++++++++++
sys/i386/i386/support.S | 10 ++++++++++
2 files changed, 20 insertions(+)
diff --git a/sys/amd64/amd64/support.S b/sys/amd64/amd64/support.S
index 1d7d05843ba8..b037e03f87f2 100644
--- a/sys/amd64/amd64/support.S
+++ b/sys/amd64/amd64/support.S
@@ -1996,4 +1996,14 @@ ENTRY(cpu_sync_core)
iretq
END(cpu_sync_core)
+/* External Retpoline thunk */
+ENTRY(__x86_indirect_thunk_r11)
+ callq 2f
+1: pause
+ lfence
+ jmp 1b
+2: movq %r11, (%rsp)
+ retq
+END(__x86_indirect_thunk_r11)
+
.section .note.GNU-stack,"",%progbits
diff --git a/sys/i386/i386/support.S b/sys/i386/i386/support.S
index e5e39c9ec5d4..cb6420750f77 100644
--- a/sys/i386/i386/support.S
+++ b/sys/i386/i386/support.S
@@ -587,4 +587,14 @@ ENTRY(cpu_sync_core)
iretl
END(cpu_sync_core)
+/* External retpoline thunk */
+ENTRY(__x86_indirect_thunk_eax)
+ calll 2f
+1: pause
+ lfence
+ jmp 1b
+2: movl %eax, (%esp)
+ retl
+END(__x86_indirect_thunk_eax)
+
.section .note.GNU-stack,"",%progbits