cortexa: Redirect read of PC through r0. MCR is unpredictable for r15.

This commit is contained in:
Gareth McMullin 2016-06-23 10:27:43 +12:00
parent eb1904247e
commit 90c0c28327
1 changed files with 4 additions and 1 deletions

View File

@ -380,9 +380,12 @@ static void cortexa_regs_read_internal(target *t)
{
struct cortexa_priv *priv = (struct cortexa_priv *)t->priv;
/* Read general purpose registers */
for (int i = 0; i < 16; i++) {
for (int i = 0; i < 15; i++) {
priv->reg_cache.r[i] = read_gpreg(t, i);
}
/* Read PC, via r0. MCR is UNPREDICTABLE for Rt = r15. */
apb_write(t, DBGITR, 0xe1a0000f); /* mov r0, pc */
priv->reg_cache.r[15] = read_gpreg(t, 0);
/* Read CPSR */
apb_write(t, DBGITR, 0xE10F0000); /* mrs r0, CPSR */
priv->reg_cache.cpsr = read_gpreg(t, 0);