aboutsummaryrefslogtreecommitdiff
path: root/src/target/arm920t.c
diff options
context:
space:
mode:
authorAndreas Fritiofson <andreas.fritiofson@gmail.com>2013-10-05 00:19:08 +0200
committerSpencer Oliver <spen@spen-soft.co.uk>2013-10-15 20:41:08 +0000
commitff5ec942d80a34e20b5a3ca3328f7e6a55fb309b (patch)
tree1d5682ae57f84d16f136b27ee75a6158790fca3f /src/target/arm920t.c
parent8e6e7948de11e69fa53e7b7f306d35d6d4904b14 (diff)
arm7_9: Avoid infinite loops in bulk write dispatching
Add a mandatory field in struct arm7_9_common for regular, non-optimized memory writes. Together with the existing bulk_memory_write field, this allows variants to select any combination of implementations for regular and bulk writes, without risking infinite loops from accidentally using bulk writes for implementing bulk writes. ARM 7/9 targets may now select arm7_9_memory_write_opt as their target.write_memory implementation, which will dispatch to arm7_9_common.bulk_write_memory if possible, or fallback to arm7_9_common.write_memory otherwise. To avoid loops, bulk write implementations mustn't call any other functions than arm7_9_write_memory_no_opt() to write memory; it will unconditionally call arm7_9_common.write_memory. If they fail, they should simply return error to allow the caller to fallback to regular writes. Tested on a regular ARM7TDMI only. Change-Id: Iae42a6e093e2df68c4823c927d757ae8f42ef388 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1685 Tested-by: jenkins Reviewed-by: Sergey A. Borshch <sb-sf@users.sourceforge.net> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Diffstat (limited to 'src/target/arm920t.c')
-rw-r--r--src/target/arm920t.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/src/target/arm920t.c b/src/target/arm920t.c
index 98bd12f5..fbfa1703 100644
--- a/src/target/arm920t.c
+++ b/src/target/arm920t.c
@@ -740,17 +740,6 @@ int arm920t_write_memory(struct target *target, uint32_t address,
return ERROR_OK;
}
-int arm920t_write_memory_opt(struct target *target, uint32_t address,
- uint32_t size, uint32_t count, const uint8_t *buffer)
-{
- struct arm7_9_common *arm7_9 = target_to_arm7_9(target);
-
- if (size == 4 && count > 32 && arm7_9->bulk_write_memory)
- return arm7_9->bulk_write_memory(target, address, count, buffer);
- else
- return arm920t_write_memory(target, address, size, count, buffer);
-}
-
/* EXPORTED to FA256 */
int arm920t_soft_reset_halt(struct target *target)
{
@@ -1708,7 +1697,7 @@ struct target_type arm920t_target = {
.get_gdb_reg_list = arm_get_gdb_reg_list,
.read_memory = arm920t_read_memory,
- .write_memory = arm920t_write_memory_opt,
+ .write_memory = arm7_9_write_memory_opt,
.read_phys_memory = arm920t_read_phys_memory,
.write_phys_memory = arm920t_write_phys_memory,
.mmu = arm920_mmu,