diff options
author | YenHaoChen <howard25336284@gmail.com> | 2022-09-30 12:08:38 +0800 |
---|---|---|
committer | YenHaoChen <howard25336284@gmail.com> | 2022-09-30 12:18:39 +0800 |
commit | ab104011ba66fb3c88ce8405236908dc8700c679 (patch) | |
tree | d42b5f26946f28a71b4dfbe8685c90ef96614dda /riscv | |
parent | d52858f3a80d3f87bfedffbff1fec34245a63082 (diff) | |
download | spike-ab104011ba66fb3c88ce8405236908dc8700c679.zip spike-ab104011ba66fb3c88ce8405236908dc8700c679.tar.gz spike-ab104011ba66fb3c88ce8405236908dc8700c679.tar.bz2 |
Check trigger only with actually_store
The data value of the function store_slow_path() is meaningful only when
the actually_store=true. Otherwise, the data value is a hollow value of
0, which may result in unintended trigger matching.
Diffstat (limited to 'riscv')
-rw-r--r-- | riscv/mmu.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/riscv/mmu.cc b/riscv/mmu.cc index ede5722..9935ed2 100644 --- a/riscv/mmu.cc +++ b/riscv/mmu.cc @@ -170,11 +170,13 @@ void mmu_t::load_slow_path(reg_t addr, reg_t len, uint8_t* bytes, uint32_t xlate void mmu_t::store_slow_path(reg_t addr, reg_t len, const uint8_t* bytes, uint32_t xlate_flags, bool actually_store) { - if (!matched_trigger) { - reg_t data = reg_from_bytes(len, bytes); - matched_trigger = trigger_exception(triggers::OPERATION_STORE, addr, true, data); - if (matched_trigger) - throw *matched_trigger; + if (actually_store) { + if (!matched_trigger) { + reg_t data = reg_from_bytes(len, bytes); + matched_trigger = trigger_exception(triggers::OPERATION_STORE, addr, true, data); + if (matched_trigger) + throw *matched_trigger; + } } reg_t paddr = translate(addr, len, STORE, xlate_flags); |