diff options
author | Andrew Waterman <andrew@sifive.com> | 2022-10-19 17:21:11 -0700 |
---|---|---|
committer | Andrew Waterman <andrew@sifive.com> | 2022-10-19 21:12:25 -0700 |
commit | 905db657f56c86b5fb558e7a3a5ea04dafa46858 (patch) | |
tree | 24893efc910e55dffe589148dd183c461f81650d /riscv/insns | |
parent | 5746722334321b14c1937224f822cf47b1135b4e (diff) | |
download | riscv-isa-sim-905db657f56c86b5fb558e7a3a5ea04dafa46858.zip riscv-isa-sim-905db657f56c86b5fb558e7a3a5ea04dafa46858.tar.gz riscv-isa-sim-905db657f56c86b5fb558e7a3a5ea04dafa46858.tar.bz2 |
Fix imprecise exception on LR to MMIO space
The old implementation performed the load before checking whether the
memory region was valid for LR. So, for LR to MMIO, we would action
side effects before raising the exception, which is not precise.
Diffstat (limited to 'riscv/insns')
-rw-r--r-- | riscv/insns/lr_d.h | 4 | ||||
-rw-r--r-- | riscv/insns/lr_w.h | 4 |
2 files changed, 2 insertions, 6 deletions
diff --git a/riscv/insns/lr_d.h b/riscv/insns/lr_d.h index 6dd8d67..214daff 100644 --- a/riscv/insns/lr_d.h +++ b/riscv/insns/lr_d.h @@ -1,5 +1,3 @@ require_extension('A'); require_rv64; -auto res = MMU.load_int64(RS1, true); -MMU.acquire_load_reservation(RS1); -WRITE_RD(res); +WRITE_RD(MMU.load_reserved<int64_t>(RS1)); diff --git a/riscv/insns/lr_w.h b/riscv/insns/lr_w.h index 185be53..354590f 100644 --- a/riscv/insns/lr_w.h +++ b/riscv/insns/lr_w.h @@ -1,4 +1,2 @@ require_extension('A'); -auto res = MMU.load_int32(RS1, true); -MMU.acquire_load_reservation(RS1); -WRITE_RD(res); +WRITE_RD(MMU.load_reserved<int32_t>(RS1)); |