- 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
This commit is contained in:
parent
34bc9457e9
commit
3c58540e02
|
@ -772,6 +772,9 @@ int target_write_buffer(struct target_s *target, u32 address, u32 size, u8 *buff
|
||||||
{
|
{
|
||||||
int unaligned = 4 - (address % 4);
|
int unaligned = 4 - (address % 4);
|
||||||
|
|
||||||
|
if (unaligned > size)
|
||||||
|
unaligned = size;
|
||||||
|
|
||||||
if ((retval = target->type->write_memory(target, address, 1, unaligned, buffer)) != ERROR_OK)
|
if ((retval = target->type->write_memory(target, address, 1, unaligned, buffer)) != ERROR_OK)
|
||||||
return retval;
|
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);
|
int unaligned = 4 - (address % 4);
|
||||||
|
|
||||||
|
if (unaligned > size)
|
||||||
|
unaligned = size;
|
||||||
|
|
||||||
if ((retval = target->type->read_memory(target, address, 1, unaligned, buffer)) != ERROR_OK)
|
if ((retval = target->type->read_memory(target, address, 1, unaligned, buffer)) != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue