-/* $OpenBSD: cpu.c,v 1.107 2024/03/01 15:57:43 kettenis Exp $ */
+/* $OpenBSD: cpu.c,v 1.108 2024/03/05 18:42:20 kettenis Exp $ */
/*
* Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>
WRITE_SPECIALREG(sctlr_el1, sctlr);
}
+ /* Enable strict BTI compatibility for PACIASP and PACIBSP. */
+ if (ID_AA64PFR1_BT(cpu_id_aa64pfr1) >= ID_AA64PFR1_BT_IMPL) {
+ sctlr = READ_SPECIALREG(sctlr_el1);
+ sctlr |= SCTLR_BT0 | SCTLR_BT1;
+ WRITE_SPECIALREG(sctlr_el1, sctlr);
+ }
+
/* Initialize debug registers. */
WRITE_SPECIALREG(mdscr_el1, DBG_MDSCR_TDCC);
WRITE_SPECIALREG(oslar_el1, 0);
-/* $OpenBSD: armreg.h,v 1.30 2023/11/29 23:32:16 kettenis Exp $ */
+/* $OpenBSD: armreg.h,v 1.31 2024/03/05 18:42:20 kettenis Exp $ */
/*-
* Copyright (c) 2013, 2014 Andrew Turner
* Copyright (c) 2015 The FreeBSD Foundation
#define SCTLR_EnDA 0x0000000008000000
#define SCTLR_EnIB 0x0000000040000000
#define SCTLR_EnIA 0x0000000080000000
+#define SCTLR_BT0 0x0000000800000000
+#define SCTLR_BT1 0x0000001000000000
/* SPSR_EL1 */
/*