diff options
author | Richard Henderson <rth@twiddle.net> | 2016-04-05 11:41:48 -0700 |
---|---|---|
committer | Richard Henderson <rth@twiddle.net> | 2017-02-14 08:15:00 +1100 |
commit | 24c328521b19aff2559118809ddf0522d6dfaaea (patch) | |
tree | d8bd63c5a682fbc3aeb9d019195059928c482477 /target/openrisc/gdbstub.c | |
parent | a8000cb480c8cfb612b039bf0382c41b9d6c7d45 (diff) | |
download | qemu-24c328521b19aff2559118809ddf0522d6dfaaea.zip |
target/openrisc: Tidy ppc/npc implementation
The NPC SPR is really only supposed to be used for FPGA debugging.
It contains the same contents as PC, unless one plays games. Follow
the or1ksim implementation in flushing delayed branch state when it
is changed.
The PPC SPR need not be updated every instruction, merely when we
exit the TB or attempt to read its contents.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'target/openrisc/gdbstub.c')
-rw-r--r-- | target/openrisc/gdbstub.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/target/openrisc/gdbstub.c b/target/openrisc/gdbstub.c index 31ea013d8c..2a4821fe9b 100644 --- a/target/openrisc/gdbstub.c +++ b/target/openrisc/gdbstub.c @@ -34,8 +34,8 @@ int openrisc_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n) case 32: /* PPC */ return gdb_get_reg32(mem_buf, env->ppc); - case 33: /* NPC */ - return gdb_get_reg32(mem_buf, env->npc); + case 33: /* NPC (equals PC) */ + return gdb_get_reg32(mem_buf, env->pc); case 34: /* SR */ return gdb_get_reg32(mem_buf, cpu_get_sr(env)); @@ -68,8 +68,13 @@ int openrisc_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) env->ppc = tmp; break; - case 33: /* NPC */ - env->npc = tmp; + case 33: /* NPC (equals PC) */ + /* If setting PC to something different, + also clear delayed branch status. */ + if (env->pc != tmp) { + env->pc = tmp; + env->flags = 0; + } break; case 34: /* SR */ |