From a28fdee804981e2015b2aba299e57d635a6e32db Mon Sep 17 00:00:00 2001 From: oharboe Date: Tue, 12 May 2009 07:03:50 +0000 Subject: fix memory corruption introduce in 1730 git-svn-id: svn://svn.berlios.de/openocd/trunk@1753 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/target/arm7tdmi.c | 8 ++++---- src/target/arm9tdmi.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/target/arm7tdmi.c b/src/target/arm7tdmi.c index 44d9b0a5..93281ce5 100644 --- a/src/target/arm7tdmi.c +++ b/src/target/arm7tdmi.c @@ -244,9 +244,9 @@ void arm_endianness(u8 *tmp, void *in, int size, int be, int flip) } } -static int arm7endianness(u8 *in, jtag_callback_data_t size, jtag_callback_data_t be, jtag_callback_data_t dummy) +static int arm7endianness(u8 *in, jtag_callback_data_t size, jtag_callback_data_t be, jtag_callback_data_t captured) { - arm_endianness(in, in, (int)size, (int)be, 1); + arm_endianness((u8 *)captured, in, (int)size, (int)be, 1); return ERROR_OK; } @@ -274,11 +274,11 @@ int arm7tdmi_clock_data_in_endianness(arm_jtag_t *jtag_info, void *in, int size, fields[1].tap = jtag_info->tap; fields[1].num_bits = 32; fields[1].out_value = NULL; - fields[1].in_value = (u8 *)in; + jtag_alloc_in_value32(&fields[1]); jtag_add_dr_scan(2, fields, TAP_INVALID); - jtag_add_callback4(arm7endianness, in, (jtag_callback_data_t)size, (jtag_callback_data_t)be, (jtag_callback_data_t)NULL); + jtag_add_callback4(arm7endianness, in, (jtag_callback_data_t)size, (jtag_callback_data_t)be, (jtag_callback_data_t)fields[1].in_value); jtag_add_runtest(0, TAP_INVALID); diff --git a/src/target/arm9tdmi.c b/src/target/arm9tdmi.c index 0e2e1b46..4bcffd07 100644 --- a/src/target/arm9tdmi.c +++ b/src/target/arm9tdmi.c @@ -291,9 +291,9 @@ int arm9tdmi_clock_data_in(arm_jtag_t *jtag_info, u32 *in) extern void arm_endianness(u8 *tmp, void *in, int size, int be, int flip); -static int arm9endianness(u8 *in, jtag_callback_data_t size, jtag_callback_data_t be, jtag_callback_data_t dummy) +static int arm9endianness(u8 *in, jtag_callback_data_t size, jtag_callback_data_t be, jtag_callback_data_t captured) { - arm_endianness(in, in, (int)size, (int)be, 0); + arm_endianness((u8 *)captured, in, (int)size, (int)be, 0); return ERROR_OK; } @@ -317,7 +317,7 @@ int arm9tdmi_clock_data_in_endianness(arm_jtag_t *jtag_info, void *in, int size, fields[0].tap = jtag_info->tap; fields[0].num_bits = 32; fields[0].out_value = NULL; - fields[0].in_value = (u8 *)in; + jtag_alloc_in_value32(&fields[0]); fields[1].tap = jtag_info->tap; fields[1].num_bits = 3; @@ -331,7 +331,7 @@ int arm9tdmi_clock_data_in_endianness(arm_jtag_t *jtag_info, void *in, int size, jtag_add_dr_scan(3, fields, TAP_INVALID); - jtag_add_callback4(arm9endianness, in, (jtag_callback_data_t)size, (jtag_callback_data_t)be, 0); + jtag_add_callback4(arm9endianness, in, (jtag_callback_data_t)size, (jtag_callback_data_t)be, (jtag_callback_data_t)fields[0].in_value); jtag_add_runtest(0, TAP_INVALID); -- cgit v1.2.3