aboutsummaryrefslogtreecommitdiff
path: root/src/target/armv4_5.c
diff options
context:
space:
mode:
authorAntonio Borneo <borneo.antonio@gmail.com>2020-11-22 00:15:44 +0100
committerAntonio Borneo <borneo.antonio@gmail.com>2020-12-05 23:18:15 +0000
commit693b8501e5b1233b87420b1c9d5cbbb3b943b285 (patch)
treed42122c21ab1cba38af37732572311b0bb18d420 /src/target/armv4_5.c
parentba58d90f6fed652d94c8c6262a43e1d836241e00 (diff)
downloadriscv-openocd-693b8501e5b1233b87420b1c9d5cbbb3b943b285.zip
riscv-openocd-693b8501e5b1233b87420b1c9d5cbbb3b943b285.tar.gz
riscv-openocd-693b8501e5b1233b87420b1c9d5cbbb3b943b285.tar.bz2
armv4_5: fix segmentation fault in command 'arm reg'
Commit fed713104904 ("armv4_5: support weirdo ARMv6 secure monitor mode") introduces the secure mode 28 of ARMv6 as a synonymous of mode 22 (MON), but does not add it in the switch/case in command 'arm reg'. When command 'arm reg' scans the array arm_mode_data[] on targets without secure modes, it does not detect the new secure mode as not supported by the architecture, thus triggers a segmentation fault when it try to read the register's value from unallocated memory. Issue detected with target arm926ejs. Add the new mode in the switch/case and treat it as the mode MON. Change-Id: I2b72cc558e097879a7ee6ea601200bfda6b60270 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes: fed713104904 ("armv4_5: support weirdo ARMv6 secure monitor mode") Reviewed-on: http://openocd.zylin.com/5941 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Diffstat (limited to 'src/target/armv4_5.c')
-rw-r--r--src/target/armv4_5.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/target/armv4_5.c b/src/target/armv4_5.c
index 7da28e3..8ac4825 100644
--- a/src/target/armv4_5.c
+++ b/src/target/armv4_5.c
@@ -869,6 +869,7 @@ COMMAND_HANDLER(handle_armv4_5_reg_command)
continue;
/* FALLTHROUGH */
case ARM_MODE_MON:
+ case ARM_MODE_1176_MON:
if (arm->core_type != ARM_CORE_TYPE_SEC_EXT
&& arm->core_type != ARM_CORE_TYPE_VIRT_EXT)
continue;