Skip to content

Instantly share code, notes, and snippets.

@lilyanatia
Created August 11, 2020 09:51
Show Gist options
  • Save lilyanatia/c1cef273103c8ebc3a215fe2b7d79380 to your computer and use it in GitHub Desktop.
Save lilyanatia/c1cef273103c8ebc3a215fe2b7d79380 to your computer and use it in GitHub Desktop.
diff --git a/armstubs/armstub8.S b/armstubs/armstub8.S
index f85eb521..188c0d55 100644
--- a/armstubs/armstub8.S
+++ b/armstubs/armstub8.S
@@ -65,6 +65,9 @@
#define SCR_VAL \
(SCR_RW | SCR_HCE | SCR_SMD | SCR_RES1_5 | SCR_RES1_4 | SCR_NS)
+#define CPUACTLR_EL1 S3_1_C15_C2_0
+#define CPUACTLR_EL1_DLPS BIT(55)
+
#define CPUECTLR_EL1 S3_1_C15_C2_1
#define CPUECTLR_EL1_SMPEN BIT(6)
@@ -124,6 +127,10 @@ _start:
mov x0, #CPUECTLR_EL1_SMPEN
msr CPUECTLR_EL1, x0
+ /* mitigate Spectre v4 */
+ mov x0, #CPUACTLR_EL1_DLPS
+ msr CPUACTLR_EL1, x0
+
#ifdef GIC
bl setup_gic
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment