target:armv8: aarch32 do not try to restore same EL
commit0bb0056abc269ed14b04cbb1d768fb0281e64225
authorJulien Massot <julien.massot@iot.bzh>
Wed, 12 Jan 2022 13:10:36 +0000 (12 14:10 +0100)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sun, 30 Apr 2023 14:44:52 +0000 (30 14:44 +0000)
treebdca9d222238e4436c096ea3bc7f85e1aa0d3d3d
parent91bd4313444c5a949ce49d88ab487608df7d6c37
target:armv8: aarch32 do not try to restore same EL

While debugging a Cortex-R52 OpenOCD fail to restore context
on line
retval = dpm->instr_write_data_r0(dpm,
ARMV8_MSR_GP_xPSR_T1(1, 0, 15), cpsr);

which trigger this exception:

aarch64.c:1206 aarch64_restore_context(): r8a779a0.r52
armv8_dpm.c:560 armv8_dpm_modeswitch(): restoring mode, cpsr = 0x0000011f
1262753 armv8_dpm.c:598 armv8_dpm_modeswitch(): target_el = 1, last_el = 1
armv8_dpm.c:611 armv8_dpm_modeswitch(): SPSR = 0x0000011f
armv8_dpm.c:260 dpmv8_exec_opcode(): Opcode 0x8f00f390, DSCR.ERR=1, DSCR.EL=1

and finally OpenOCD doesn't succeed to restore the processor.

This check 'dpm->last_el != target_el' exist for aarch64,
so might be correct for aarch32 too.

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
Change-Id: I41d1006233251dcaf6d69bda580488b204b7eb63
Reviewed-on: https://review.openocd.org/c/openocd/+/6807
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
src/target/armv8_dpm.c