target/aarch64: Cleanup on exit

Restore target configuration on exit so that OpenOCD get correct values
when restarting.

Change-Id: I8cbba1fdae1d3c4a580197b7a97691443780ed06
Signed-off-by: Adrien Grassein <agrassein@nanoxplore.com>
Signed-off-by: Adrien Charruel <acharruel@nanoxplore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8654
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Adrien Grassein
2024-01-18 11:54:15 +01:00
committed by Antonio Borneo
parent a9fa339267
commit f885a8d76c

View File

@@ -2857,6 +2857,14 @@ static void aarch64_deinit_target(struct target *target)
struct aarch64_common *aarch64 = target_to_aarch64(target);
struct armv8_common *armv8 = &aarch64->armv8_common;
struct arm_dpm *dpm = &armv8->dpm;
uint64_t address;
if (target->state == TARGET_HALTED) {
// Restore the previous state of the target (gp registers, MMU, caches, etc)
int retval = aarch64_restore_one(target, true, &address, false, false);
if (retval != ERROR_OK)
LOG_TARGET_ERROR(target, "Failed to restore target state");
}
if (armv8->debug_ap)
dap_put_ap(armv8->debug_ap);