You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For AMO instructions, such as amoadd, we should prioritize checking the load/store address triggers because BreakPoint exception prior to load/store address misaligned or access fault according to the privileged spec.
However, in Spike, for AMO instructions, the store_slow_path function is called once with actually_store set to false before executing the load. This means that if the address is misaligned and also a trigger address, Spike will raise a Store/AMO address misaligned or Store/AMO access fault first, rather than a BreakPoint exception.
Similarly, for store conditional instructions, the check_load_reservation function is called first. For misaligned addresses, it calls the store_slow_path function with the actually_store parameter set to false. This results in the Store/AMO address misaligned or Store/AMO access fault being raised before the BreakPoint exception caused by store address trigger.
I think we can prioritize the address trigger check in the store_slow_path, like this:
This would allow the store conditional instruction to prioritize raising a BreakPoint exception for a misaligned trigger address, instead of a Store/AMO address misaligned or Store/AMO access fault.
Additionally, for AMO instructions, we also need to perform the load address trigger check before the load, like this:
--- a/riscv/mmu.h
+++ b/riscv/mmu.h
@@ -194,6 +194,11 @@ public:
template<typename T>
T amo_compare_and_swap(reg_t addr, T comp, T swap) {
convert_load_traps_to_store_traps({
+ xlate_flags_t xlate_flags = {};
+ auto access_info = generate_access_info(addr, LOAD, xlate_flags);
+ reg_t transformed_addr = access_info.transformed_vaddr;
+ check_triggers(triggers::OPERATION_LOAD, transformed_addr, access_info.effective_virt);
+
store_slow_path(addr, sizeof(T), nullptr, {}, false, true);
auto lhs = load<T>(addr);
if (lhs == comp)
This allows us to prioritize triggering the load/store address trigger for AMO instructions.
The text was updated successfully, but these errors were encountered:
For AMO instructions, such as
amoadd
, we should prioritize checking the load/store address triggers because BreakPoint exception prior to load/store address misaligned or access fault according to the privileged spec.However, in Spike, for AMO instructions, the
store_slow_path
function is called once withactually_store
set to false before executing the load. This means that if the address is misaligned and also a trigger address, Spike will raise a Store/AMO address misaligned or Store/AMO access fault first, rather than a BreakPoint exception.Similarly, for store conditional instructions, the
check_load_reservation
function is called first. For misaligned addresses, it calls thestore_slow_path
function with theactually_store
parameter set to false. This results in the Store/AMO address misaligned or Store/AMO access fault being raised before the BreakPoint exception caused by store address trigger.I think we can prioritize the address trigger check in the
store_slow_path
, like this:This would allow the store conditional instruction to prioritize raising a BreakPoint exception for a misaligned trigger address, instead of a Store/AMO address misaligned or Store/AMO access fault.
Additionally, for AMO instructions, we also need to perform the load address trigger check before the load, like this:
This allows us to prioritize triggering the load/store address trigger for AMO instructions.
The text was updated successfully, but these errors were encountered: