From: miod Date: Mon, 20 Nov 2023 16:10:37 +0000 (+0000) Subject: Make sure the low two bits of stvec are always zero (since we don't use X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f03cce2a7dce1ef3e80716902f3eadde9117ad73;p=openbsd Make sure the low two bits of stvec are always zero (since we don't use vectored exceptions) by adding an alignment constraint to cpu_exception_handler. --- diff --git a/sys/arch/riscv64/riscv64/exception.S b/sys/arch/riscv64/riscv64/exception.S index 1fe16a33c4d..c9eb9b3467c 100644 --- a/sys/arch/riscv64/riscv64/exception.S +++ b/sys/arch/riscv64/riscv64/exception.S @@ -1,4 +1,4 @@ -/* $OpenBSD: exception.S,v 1.6 2022/12/02 12:27:08 jca Exp $ */ +/* $OpenBSD: exception.S,v 1.7 2023/11/20 16:10:37 miod Exp $ */ /*- * Copyright (c) 2015-2018 Ruslan Bukin @@ -208,6 +208,12 @@ 2: .endm + /* + * cpu_exception_handler needs to be aligned to a 32-bit + * boundary, but ENTRY() only enforces 16-bit alignment. + */ + .text + .p2align 2 ENTRY(cpu_exception_handler) csrrw sp, sscratch, sp beqz sp, 1f