From 92f0513a0ca8a3d262f3e16f17366a2e517fec74 Mon Sep 17 00:00:00 2001 From: Jonathan Neuschäfer Date: Tue, 26 Sep 2017 01:44:46 +0200 Subject: arch/riscv: mprv_read_*: Mark result as earlyclobber MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes a case of mstatus corruption, where GCC generated code that used the same register for the mprv bit and the result. GCC inline assembly register modifiers are documented here: https://gcc.gnu.org/onlinedocs/gcc/Modifiers.html Change-Id: I2c563d171892c2e22ac96b34663aa3965553ceb3 Signed-off-by: Jonathan Neuschäfer Reviewed-on: https://review.coreboot.org/21688 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich --- src/arch/riscv/include/vm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/arch/riscv') diff --git a/src/arch/riscv/include/vm.h b/src/arch/riscv/include/vm.h index 0db5313580..1a8f7ad6e0 100644 --- a/src/arch/riscv/include/vm.h +++ b/src/arch/riscv/include/vm.h @@ -73,7 +73,7 @@ void flush_tlb(void); "csrs mstatus, %1\n" \ STRINGIFY(insn) " %0, 0(%2)\n" \ "csrc mstatus, %1\n" \ - : "=r"(value) : "r"(mprv), "r"(p) : "memory" \ + : "=&r"(value) : "r"(mprv), "r"(p) : "memory" \ ); \ return value; \ } -- cgit v1.2.3