aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAntonio Borneo <borneo.antonio@gmail.com>2020-09-16 15:26:40 +0200
committerAntonio Borneo <borneo.antonio@gmail.com>2020-10-11 15:53:52 +0100
commit3ffa14b043225b9766132b1979db7ddb8d91ba5e (patch)
treec68358e8b8536483c758fc9afccfe41442c0c0ee /src
parent63d3640add4c024864b18d021f626fd377b1165c (diff)
downloadriscv-openocd-3ffa14b043225b9766132b1979db7ddb8d91ba5e.zip
riscv-openocd-3ffa14b043225b9766132b1979db7ddb8d91ba5e.tar.gz
riscv-openocd-3ffa14b043225b9766132b1979db7ddb8d91ba5e.tar.bz2
target/aarch64: fix use of 'target->private_config'
The function adiv5_jim_configure() casts the void pointer 'target->private_config' to a struct adiv5_private_config pointer. This is tricky in case of aarch64, where the private data are in a struct aarch64_private_config that has as first element the struct adiv5_private_config. While the current solution is working fine, it's not clean and requires special attention for any further code development. Override 'target->private_config' to the correct pointer while calling adiv5_jim_configure(). Change-Id: Ic2fc047dd1e57013943d96e6d5879a919d1eb7b3 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5847 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/target/aarch64.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/target/aarch64.c b/src/target/aarch64.c
index 8d23bca..d111a05 100644
--- a/src/target/aarch64.c
+++ b/src/target/aarch64.c
@@ -2504,8 +2504,13 @@ static int aarch64_jim_configure(struct target *target, Jim_GetOptInfo *goi)
* options, JIM_OK if it correctly parsed the topmost option
* and JIM_ERR if an error occurred during parameter evaluation.
* For JIM_CONTINUE, we check our own params.
+ *
+ * adiv5_jim_configure() assumes 'private_config' to point to
+ * 'struct adiv5_private_config'. Override 'private_config'!
*/
+ target->private_config = &pc->adiv5_config;
e = adiv5_jim_configure(target, goi);
+ target->private_config = pc;
if (e != JIM_CONTINUE)
return e;