From 60235e3816220eabc6f6e48d103889300d5547df Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Wed, 22 Aug 2018 14:07:45 -0700 Subject: [PATCH] Make IRQ_COP read-only/undelegable unless coprocessor is present --- riscv/processor.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/riscv/processor.cc b/riscv/processor.cc index 8bcd8e2..4a7d0ec 100644 --- a/riscv/processor.cc +++ b/riscv/processor.cc @@ -330,7 +330,8 @@ int processor_t::paddr_bits() void processor_t::set_csr(int which, reg_t val) { val = zext_xlen(val); - reg_t delegable_ints = MIP_SSIP | MIP_STIP | MIP_SEIP | (1 << IRQ_COP); + reg_t delegable_ints = MIP_SSIP | MIP_STIP | MIP_SEIP + | ((ext != NULL) << IRQ_COP); reg_t all_ints = delegable_ints | MIP_MSIP | MIP_MTIP; switch (which) { -- 2.30.2