summaryrefslogtreecommitdiff
path: root/arch/arm64/include/asm/nospec-branch.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm64/include/asm/nospec-branch.h')
-rw-r--r--arch/arm64/include/asm/nospec-branch.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/nospec-branch.h b/arch/arm64/include/asm/nospec-branch.h
index 63db0e2b19a2..8a5d2c41da3b 100644
--- a/arch/arm64/include/asm/nospec-branch.h
+++ b/arch/arm64/include/asm/nospec-branch.h
@@ -8,6 +8,17 @@
#ifdef __ASSEMBLY__
+/*
+ * On certain processors the bl/ret sequence is a synchronization
+ * point for any pending speculation, and the value of all registers is
+ * known after this sequence. So the next flow of instructions, in particular
+ * any indirect branch, will be executed without any speculation.
+ *
+ * This property allows to create the retpoline-like code sequence below.
+ * Note, that this sequence does not jump to a provided target using the ret
+ * instruction, instead the ret instruction just goes on and
+ * the execution sequence continues on the same flow.
+ */
.macro retpoline
alternative_if ARM64_RETPOLINE
str x30, [sp, #-16]!