summaryrefslogtreecommitdiff
path: root/src/target/cortex_a8.c
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2010-02-21 14:34:33 -0800
committerDavid Brownell <dbrownell@users.sourceforge.net>2010-02-21 14:34:33 -0800
commit1aac72d24339380f6e98c50dec4c96ab30537749 (patch)
treeefd8b83082f072d807f168eabf415e1002cf5425 /src/target/cortex_a8.c
parenta299371a9ec109da3851cb43aed3e9157d095358 (diff)
downloadopenocd+libswd-1aac72d24339380f6e98c50dec4c96ab30537749.tar.gz
openocd+libswd-1aac72d24339380f6e98c50dec4c96ab30537749.tar.bz2
openocd+libswd-1aac72d24339380f6e98c50dec4c96ab30537749.tar.xz
openocd+libswd-1aac72d24339380f6e98c50dec4c96ab30537749.zip
ARM: keep a handle to the PC
Keep a handle to the PC in "struct arm", and use it. This register is used a fair amount, so this is a net minor code shrink (other than some line length fixes), but mostly it's to make things more readable. For XScale, fix a dodgy sequence while stepping. It was initializing a variable to a non-NULL value, then updating it to handle the step-over-active-breakpoint case, and then later testing for non-NULL to see if it should reverse that step-over-active logic. It should have done like ARM7/ARM9 does: init to NULL. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Diffstat (limited to 'src/target/cortex_a8.c')
-rw-r--r--src/target/cortex_a8.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/target/cortex_a8.c b/src/target/cortex_a8.c
index bcdb5260..050238ce 100644
--- a/src/target/cortex_a8.c
+++ b/src/target/cortex_a8.c
@@ -695,9 +695,7 @@ static int cortex_a8_resume(struct target *target, int current,
#endif
/* current = 1: continue on current pc, otherwise continue at <address> */
- resume_pc = buf_get_u32(
- armv4_5->core_cache->reg_list[15].value,
- 0, 32);
+ resume_pc = buf_get_u32(armv4_5->pc->value, 0, 32);
if (!current)
resume_pc = address;
@@ -721,10 +719,9 @@ static int cortex_a8_resume(struct target *target, int current,
return ERROR_FAIL;
}
LOG_DEBUG("resume pc = 0x%08" PRIx32, resume_pc);
- buf_set_u32(armv4_5->core_cache->reg_list[15].value,
- 0, 32, resume_pc);
- armv4_5->core_cache->reg_list[15].dirty = 1;
- armv4_5->core_cache->reg_list[15].valid = 1;
+ buf_set_u32(armv4_5->pc->value, 0, 32, resume_pc);
+ armv4_5->pc->dirty = 1;
+ armv4_5->pc->valid = 1;
cortex_a8_restore_context(target, handle_breakpoints);
@@ -869,7 +866,7 @@ static int cortex_a8_debug_entry(struct target *target)
regfile[ARM_PC] -= 8;
}
- reg = armv4_5->core_cache->reg_list + 15;
+ reg = armv4_5->pc;
buf_set_u32(reg->value, 0, 32, regfile[ARM_PC]);
reg->dirty = reg->valid;
}
@@ -952,7 +949,7 @@ static int cortex_a8_step(struct target *target, int current, uint32_t address,
}
/* current = 1: continue on current pc, otherwise continue at <address> */
- r = armv4_5->core_cache->reg_list + 15;
+ r = armv4_5->pc;
if (!current)
{
buf_set_u32(r->value, 0, 32, address);