diff options
author | vpalatin <vpalatin@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2008-02-22 16:43:13 +0000 |
---|---|---|
committer | vpalatin <vpalatin@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2008-02-22 16:43:13 +0000 |
commit | 3c58540e0283a452a7606ba22e693df10d746d54 (patch) | |
tree | 8134e5d39e4291defe26f0932a50befc3762ad4b /src/target | |
parent | 34bc9457e9190f2a3ec9c3ec4c6888ef1aa7ac63 (diff) | |
download | openocd+libswd-3c58540e0283a452a7606ba22e693df10d746d54.tar.gz openocd+libswd-3c58540e0283a452a7606ba22e693df10d746d54.tar.bz2 openocd+libswd-3c58540e0283a452a7606ba22e693df10d746d54.tar.xz openocd+libswd-3c58540e0283a452a7606ba22e693df10d746d54.zip |
- fix read/write size for small unaligned accesses (thanks Michael Bruck)
git-svn-id: svn://svn.berlios.de/openocd/trunk@318 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/target')
-rw-r--r-- | src/target/target.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/target/target.c b/src/target/target.c index 8901cd11..ce2d0856 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -772,6 +772,9 @@ int target_write_buffer(struct target_s *target, u32 address, u32 size, u8 *buff { int unaligned = 4 - (address % 4); + if (unaligned > size) + unaligned = size; + if ((retval = target->type->write_memory(target, address, 1, unaligned, buffer)) != ERROR_OK) return retval; @@ -833,6 +836,9 @@ int target_read_buffer(struct target_s *target, u32 address, u32 size, u8 *buffe { int unaligned = 4 - (address % 4); + if (unaligned > size) + unaligned = size; + if ((retval = target->type->read_memory(target, address, 1, unaligned, buffer)) != ERROR_OK) return retval; |