mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 02:03:56 -06:00
target/ppc: Implement watchpoint debug facility for v2.07S
ISA v2.07S introduced the watchpoint facility based on the DAWR0 and DAWRX0 SPRs. Implement this in TCG. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Cédric Le Goater <clg@kaod.org>
This commit is contained in:
parent
14192307ef
commit
d5ee641cfc
10 changed files with 147 additions and 3 deletions
|
@ -128,6 +128,65 @@ void ppc_store_ciabr(CPUPPCState *env, target_ulong val)
|
|||
env->spr[SPR_CIABR] = val;
|
||||
ppc_update_ciabr(env);
|
||||
}
|
||||
|
||||
void ppc_update_daw0(CPUPPCState *env)
|
||||
{
|
||||
CPUState *cs = env_cpu(env);
|
||||
target_ulong deaw = env->spr[SPR_DAWR0] & PPC_BITMASK(0, 60);
|
||||
uint32_t dawrx = env->spr[SPR_DAWRX0];
|
||||
int mrd = extract32(dawrx, PPC_BIT_NR(48), 54 - 48);
|
||||
bool dw = extract32(dawrx, PPC_BIT_NR(57), 1);
|
||||
bool dr = extract32(dawrx, PPC_BIT_NR(58), 1);
|
||||
bool hv = extract32(dawrx, PPC_BIT_NR(61), 1);
|
||||
bool sv = extract32(dawrx, PPC_BIT_NR(62), 1);
|
||||
bool pr = extract32(dawrx, PPC_BIT_NR(62), 1);
|
||||
vaddr len;
|
||||
int flags;
|
||||
|
||||
if (env->dawr0_watchpoint) {
|
||||
cpu_watchpoint_remove_by_ref(cs, env->dawr0_watchpoint);
|
||||
env->dawr0_watchpoint = NULL;
|
||||
}
|
||||
|
||||
if (!dr && !dw) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hv && !sv && !pr) {
|
||||
return;
|
||||
}
|
||||
|
||||
len = (mrd + 1) * 8;
|
||||
flags = BP_CPU | BP_STOP_BEFORE_ACCESS;
|
||||
if (dr) {
|
||||
flags |= BP_MEM_READ;
|
||||
}
|
||||
if (dw) {
|
||||
flags |= BP_MEM_WRITE;
|
||||
}
|
||||
|
||||
cpu_watchpoint_insert(cs, deaw, len, flags, &env->dawr0_watchpoint);
|
||||
}
|
||||
|
||||
void ppc_store_dawr0(CPUPPCState *env, target_ulong val)
|
||||
{
|
||||
env->spr[SPR_DAWR0] = val;
|
||||
ppc_update_daw0(env);
|
||||
}
|
||||
|
||||
void ppc_store_dawrx0(CPUPPCState *env, uint32_t val)
|
||||
{
|
||||
int hrammc = extract32(val, PPC_BIT_NR(56), 1);
|
||||
|
||||
if (hrammc) {
|
||||
/* This might be done with a second watchpoint at the xor of DEAW[0] */
|
||||
qemu_log_mask(LOG_UNIMP, "%s: DAWRX0[HRAMMC] is unimplemented\n",
|
||||
__func__);
|
||||
}
|
||||
|
||||
env->spr[SPR_DAWRX0] = val;
|
||||
ppc_update_daw0(env);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue