X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Ftarget%2Farm_semihosting.c;h=853e20fa3f54e9462166a39704552493f625d1af;hb=057e566097b41f9bfeee50e97ba6ef624189ae6a;hp=1e5b5e25206f9ce75fad57bafd8cbfdc8c436f51;hpb=20b29b7767097f999fe2eb4f7fb6c2917e9f66a6;p=fw%2Fopenocd diff --git a/src/target/arm_semihosting.c b/src/target/arm_semihosting.c index 1e5b5e252..853e20fa3 100644 --- a/src/target/arm_semihosting.c +++ b/src/target/arm_semihosting.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + /*************************************************************************** * Copyright (C) 2009 by Marvell Technology Group Ltd. * * Written by Nicolas Pitre * @@ -10,19 +12,6 @@ * * * Copyright (C) 2018 by Liviu Ionescu * * * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * ***************************************************************************/ /** @@ -315,7 +304,7 @@ int arm_semihosting(struct target *target, int *retval) return 0; } else if (arm->core_state == ARM_STATE_ARM) { r = arm->pc; - pc = buf_get_u32(arm->pc->value, 0, 32); + pc = buf_get_u32(r->value, 0, 32); /* A32 instruction => check for HLT 0xF000 (0xE10F0070) */ uint32_t insn = 0; @@ -330,7 +319,7 @@ int arm_semihosting(struct target *target, int *retval) return 0; } else if (arm->core_state == ARM_STATE_THUMB) { r = arm->pc; - pc = buf_get_u32(arm->pc->value, 0, 32); + pc = buf_get_u32(r->value, 0, 32); /* T32 instruction => check for HLT 0x3C (0xBABC) */ uint16_t insn = 0; @@ -367,10 +356,13 @@ int arm_semihosting(struct target *target, int *retval) } /* Check for ARM operation numbers. */ - if (semihosting->op >= 0 && semihosting->op <= 0x31) { + if ((semihosting->op >= 0 && semihosting->op <= 0x31) || + (semihosting->op >= 0x100 && semihosting->op <= 0x107)) { + *retval = semihosting_common(target); if (*retval != ERROR_OK) { - LOG_ERROR("Failed semihosting operation (0x%02X)", semihosting->op); + LOG_ERROR("Failed semihosting operation (0x%02X)", + semihosting->op); return 0; } } else {