mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-09-09 00:07:57 -06:00
target/riscv: set tval for triggered watchpoints
According to privileged spec, if [sm]tval is written with a nonzero value when a breakpoint exception occurs, then [sm]tval will contain the faulting virtual address. Set tval to hit address when breakpoint exception is triggered by hardware watchpoint. Signed-off-by: Sergey Matyukevich <sergey.matyukevich@syntacore.com> Reviewed-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-Id: <20230131170955.752743-1-geomatsi@gmail.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
606a2439ba
commit
26934f9a95
2 changed files with 6 additions and 1 deletions
|
@ -1639,6 +1639,12 @@ void riscv_cpu_do_interrupt(CPUState *cs)
|
||||||
case RISCV_EXCP_VIRT_INSTRUCTION_FAULT:
|
case RISCV_EXCP_VIRT_INSTRUCTION_FAULT:
|
||||||
tval = env->bins;
|
tval = env->bins;
|
||||||
break;
|
break;
|
||||||
|
case RISCV_EXCP_BREAKPOINT:
|
||||||
|
if (cs->watchpoint_hit) {
|
||||||
|
tval = cs->watchpoint_hit->hitaddr;
|
||||||
|
cs->watchpoint_hit = NULL;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -761,7 +761,6 @@ void riscv_cpu_debug_excp_handler(CPUState *cs)
|
||||||
|
|
||||||
if (cs->watchpoint_hit) {
|
if (cs->watchpoint_hit) {
|
||||||
if (cs->watchpoint_hit->flags & BP_CPU) {
|
if (cs->watchpoint_hit->flags & BP_CPU) {
|
||||||
cs->watchpoint_hit = NULL;
|
|
||||||
do_trigger_action(env, DBG_ACTION_BP);
|
do_trigger_action(env, DBG_ACTION_BP);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue