aboutsummaryrefslogtreecommitdiff
path: root/riscv/triggers.h
AgeCommit message (Collapse)AuthorFilesLines
2023-09-13triggers: refactor: icount: breakdown detect_icount_match() into ↵YenHaoChen1-2/+4
detect_icount_fire() and detect_icount_decrement()
2023-05-24triggers: Fix etrigger match on exceptionsAtul Khare1-1/+1
The etrigger match on exceptions doesn't work properly in cases like the following: 1) M-mode delegates ECALLs to S-mode 2) A CPU hardware point mechanism is used to place a breakpoint on the Umode instruction that executes the ECALL from Umode to Smode. In effect, this creates a breakpoint etrigger based on Umode. In the above, the expectation is that #2 will first cause an exit to the Smode handler (stvec), and the hardware breakpoint exception will be triggered following an entry into the handler. However, since etrigger currently checks the current privilege mode, we will never get a match on conditions like #2. The patch attempts to address the issue by using the stashed version of the previous privilege mode for the etrigger match. cc: YenHaoChen <howard25336284@gmail.com> Signed-off-by: Atul Khare <atulkhare@rivosinc.com>
2023-05-24Enhance mode_match() functionalityAtul Khare1-1/+1
The current version of mode_match() is based on the current privilege level. This adds an explicit privilege and virtual mode parameters in anticipation of an upcoming patch for matching trap triggers.
2023-05-11Plumb in effective virtual bit to take_trigger_action()rbuchner1-2/+3
2023-04-26triggers: native triggers (action=0) should prevent causing a breakpoint ↵YenHaoChen1-0/+1
exception while already in a trap handler This commit implements Debug Specification Section 5.4 Native Triggers. The specification allows two solutions for solving the reentrancy problem. This commit chooses the first solution because the second one targets implementations without S-mode.
2023-04-04Initialize all fields of icount_tScott Johnson1-5/+5
According to table in debug spec. This has no visible effect, because every time we instantiate an icount_t (in triggers::module_t::tdata1_write) we immediately call tdata1_write() which sets these values, but it's cleaner this way.
2023-01-30triggers: optimize icount_t::icount_check_needed()YenHaoChen1-1/+1
2023-01-30triggers: add detect_icount_match()YenHaoChen1-2/+8
2023-01-30triggers: force to slow path with icount triggersYenHaoChen1-0/+2
2023-01-30triggers: add icount_t and update tinfoYenHaoChen1-0/+16
2023-01-13triggers: refactor: use static and remove const for legalize_action()YenHaoChen1-1/+1
Since this method does not use 'this', we turn this method into static.
2023-01-13triggers: refactor: use static and remove const for legalize_match()YenHaoChen1-1/+1
Since this method no longer use 'this', we turn this method into static.
2023-01-13triggers: refactor: remove legalization_action()'s dependency on dmodeYenHaoChen1-1/+1
avoid breaking functionality by reordering statements in tdata1.write()
2023-01-13triggers: legalize timing=1(after) for load data triggerYenHaoChen1-1/+1
As recommended in the debug spec table "Suggested Trigger Timings", to avoid the footgun of replaying a load (which may have side effects) when the breakpoint trap handler returns. reference: https://github.com/riscv-software-src/riscv-isa-sim/pull/1208#issuecomment-1373035906 ----------------------------------------------------------------------- The legalize_timing() depends on select, execution, load, and store, which are updated in the same function tdata1_write(). As a result, reordering statements in the tdata1_write() may break the functionality. Passing those variables as parameters to legalize_timing() does not solve the problem. Thus, we give the original write value and the masks of the variables to the legalize_timing(). This makes the legalization function independent of the updating variables and resolves the issue. reference: https://github.com/riscv-software-src/riscv-isa-sim/pull/1214
2023-01-12triggers: refactor: add mcontrol_common_t::legalize_timing() functionYenHaoChen1-0/+1
2023-01-04triggers: refactor: move mode_match() and textra_match() to private for ↵YenHaoChen1-2/+2
protected
2023-01-04triggers: refactor: create trigger_t::common_match()YenHaoChen1-0/+1
2023-01-04triggers: refactor: move textra_match() to protected from publicYenHaoChen1-1/+1
2023-01-04triggers: refactor: move detect_trap_match() to trap_common_t from ↵YenHaoChen1-4/+2
itrigger_t/etrigger_t
2023-01-04triggers: refactor: create virtual function trap_common_t::simple_match()YenHaoChen1-2/+5
2023-01-04triggers: refactor: move get_action() to trap_common_t from ↵YenHaoChen1-4/+1
itrigger_t/etrigger_t
2023-01-04triggers: refactor: move get_dmode() to trap_common_t from itrigger_t/etrigger_tYenHaoChen1-2/+3
2023-01-04triggers: refactor: move action variable to trap_common_t from ↵YenHaoChen1-2/+1
itrigger_t/etrigger_t
2023-01-04triggers: refactor: move hit variable to trap_common_t from ↵YenHaoChen1-2/+1
itrigger_t/etrigger_t
2023-01-04triggers: refactor: move dmode variable to trap_common_t from ↵YenHaoChen1-2/+2
itrigger_t/etrigger_t
2023-01-04triggers: refactor: add empty parent trap_common_t class for itrigger_t and ↵YenHaoChen1-2/+5
etrigger_t
2023-01-04triggers: refactor: add bool etrigger_t::simple_match()YenHaoChen1-0/+1
2023-01-04triggers: refactor: add bool itrigger_t::simple_match()YenHaoChen1-0/+1
2022-12-21triggers: add mcontrol6 triggerYenHaoChen1-0/+6
2022-12-21triggers: refactor: add mcontrol_common_t::legalize_match() functionYenHaoChen1-0/+1
2022-12-21triggers: refactor: extract mcontrol_common_t from mcontrol_tYenHaoChen1-4/+8
2022-12-21triggers: refactor: add trigger_t::mode_match() functionYenHaoChen1-0/+1
2022-12-21triggers: refactor: move m/s/u/vs/vu to trigger_tYenHaoChen1-15/+6
2022-12-21triggers: refactor: add mcontrol.vs and mcontrol.vuYenHaoChen1-0/+2
2022-12-10Move mhselect_compare into mhselect_interpretationScott Johnson1-3/+3
2022-12-10Use interpret_mhselect() to decide textra compare modeScott Johnson1-1/+0
2022-12-10Interpret mhselect in centralized placeScott Johnson1-0/+26
And use that for legalize_mhselect(). Not using the second and third fields yet.
2022-12-10triggers: checking textra (tdata3); checking ASID and VMIDYenHaoChen1-0/+11
2022-12-09triggers: implement tdata3 CSR fieldsYenHaoChen1-0/+19
2022-12-09refactor: remove proc parameter from functions of module_tYenHaoChen1-5/+5
2022-12-01Remove unused constructor arg from match_result_tScott Johnson1-1/+1
2022-12-01Remove no-longer-used match_result_t.fireScott Johnson1-3/+1
2022-12-01Use std::optional for detect_trap_match in trigger_t hierarchyScott Johnson1-3/+3
Goal is to remove match_result_t.fire field to eliminate dont-care fields.
2022-12-01Convert triggers::module_t::detect_trap_match to std::optionalScott Johnson1-1/+1
Goal is to remove match_result_t.fire field to eliminate dont-care fields.
2022-12-01Use std::optional for detect_memory_access_match in trigger_t hierarchyScott Johnson1-3/+3
Goal is to remove match_result_t.fire field to eliminate dont-care fields.
2022-12-01Convert triggers::module_t::detect_memory_access_match to std::optionalScott Johnson1-1/+1
Goal is to remove match_result_t.fire field to eliminate dont-care fields when fire=false.
2022-12-01Extract common method for legalizing trigger action fieldScott Johnson1-0/+1
2022-12-01Add noexcept to trigger-matching functionsScott Johnson1-7/+7
To make it clear that breakpoint exceptions are not thrown in these methods.
2022-12-01Remove no-longer-useful trigger_with_tdata2_tScott Johnson1-7/+4
2022-12-01Move tdata2 into parent classScott Johnson1-8/+5
Since all triggers currently implemented have tdata2.