target: cortex_a: fix segfault when SPSR is not properly handled
OpenOCD doesn't (yet) know how to handle HYP mode properly so spsr register is not getting initialised when OpenOCD connects to a target stopped in this mode. Reported on IRC by thinkfat and nearffxx. Change-Id: I4bda9ba0c582c8e9cacefe708cc4a3d947151f84 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/3906 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de> Reviewed-by: Chengyu Zheng <chengyu.zheng@polimi.it>
This commit is contained in:
parent
ee4f11dd68
commit
d491b88dd9
|
@ -1241,6 +1241,7 @@ static int cortex_a_debug_entry(struct target *target)
|
||||||
reg->dirty = reg->valid;
|
reg->dirty = reg->valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (arm->spsr) {
|
||||||
/* read Saved PSR */
|
/* read Saved PSR */
|
||||||
retval = cortex_a_dap_read_coreregister_u32(target, &spsr, 17);
|
retval = cortex_a_dap_read_coreregister_u32(target, &spsr, 17);
|
||||||
/* store current spsr */
|
/* store current spsr */
|
||||||
|
@ -1251,6 +1252,7 @@ static int cortex_a_debug_entry(struct target *target)
|
||||||
buf_set_u32(reg->value, 0, 32, spsr);
|
buf_set_u32(reg->value, 0, 32, spsr);
|
||||||
reg->valid = 1;
|
reg->valid = 1;
|
||||||
reg->dirty = 0;
|
reg->dirty = 0;
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* TODO, Move this */
|
/* TODO, Move this */
|
||||||
|
|
Loading…
Reference in New Issue