Skip to content

Commit

Permalink
fix(sc): mcontrol6 addr trigger still match and fire for failed sc.
Browse files Browse the repository at this point in the history
If the sc instruction's addr is misaligned, it will check the addr trigger within
the function check_load_reservation(), and raise misalign fault or access fault if
addr trigger does not match.

However, for a properly aligned but failed sc instruction, spike does not execute
the store function at all and does not check the addr trigger.

This patch checks the addr trigger right at the start of the sc instruction even if
the sc instruction fails.
  • Loading branch information
NewPaulWalker authored and huxuan0307 committed Oct 31, 2024
1 parent c0b18d3 commit 74f254c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions riscv/mmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,11 @@ class mmu_t
template<typename T>
bool store_conditional(reg_t addr, T val)
{
xlate_flags_t xlate_flags = {};
auto access_info = generate_access_info(addr, STORE, xlate_flags);
reg_t transformed_addr = access_info.transformed_vaddr;
check_triggers(triggers::OPERATION_STORE, transformed_addr, access_info.effective_virt);

bool have_reservation = check_load_reservation(addr, sizeof(T));
if (have_reservation && sim->sc_failed) {
sim->difftest_log("The REF is forced to have an SC failure according to the DUT.");
Expand Down

0 comments on commit 74f254c

Please sign in to comment.