From patchwork Fri Feb 28 16:43:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taylor Simpson X-Patchwork-Id: 11412989 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 25544138D for ; Fri, 28 Feb 2020 17:15:57 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F189D246A2 for ; Fri, 28 Feb 2020 17:15:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="yQOZ5i5U" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F189D246A2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=quicinc.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51114 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j7jEy-0002mK-3V for patchwork-qemu-devel@patchwork.kernel.org; Fri, 28 Feb 2020 12:15:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57640) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j7ikb-0002mK-Ek for qemu-devel@nongnu.org; Fri, 28 Feb 2020 11:44:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j7ikZ-0005W3-Ms for qemu-devel@nongnu.org; Fri, 28 Feb 2020 11:44:33 -0500 Received: from alexa-out-sd-02.qualcomm.com ([199.106.114.39]:27049) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j7ikZ-0005V5-Dt for qemu-devel@nongnu.org; Fri, 28 Feb 2020 11:44:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1582908271; x=1614444271; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=f1wurEAOGurKqRzrZ3zioPMbTJWRw9gHRkOaVFN0r5c=; b=yQOZ5i5UQTSstF5VRaSQtTEUbfZaLCTJuvAJD9WqrvfC2qk+AnedlG7M S1nZNTu0PSk+tM8btxoE4iaB6G6+f8J1eR0pIHeXScI2QexE4bjN9atFp Pxrd1LCkD4FUbeUaKCxdtiOlI6LUV4kncSkc5NdWN/MuX8WVEKyeT5FRo s=; Received: from unknown (HELO ironmsg04-sd.qualcomm.com) ([10.53.140.144]) by alexa-out-sd-02.qualcomm.com with ESMTP; 28 Feb 2020 08:44:28 -0800 Received: from vu-tsimpson-aus.qualcomm.com (HELO vu-tsimpson1-aus.qualcomm.com) ([10.222.150.1]) by ironmsg04-sd.qualcomm.com with ESMTP; 28 Feb 2020 08:44:27 -0800 Received: by vu-tsimpson1-aus.qualcomm.com (Postfix, from userid 47164) id 9C8A7F0B; Fri, 28 Feb 2020 10:44:27 -0600 (CST) From: Taylor Simpson To: qemu-devel@nongnu.org Subject: [RFC PATCH v2 08/67] Hexagon GDB Stub Date: Fri, 28 Feb 2020 10:43:04 -0600 Message-Id: <1582908244-304-9-git-send-email-tsimpson@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1582908244-304-1-git-send-email-tsimpson@quicinc.com> References: <1582908244-304-1-git-send-email-tsimpson@quicinc.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 199.106.114.39 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: riku.voipio@iki.fi, richard.henderson@linaro.org, laurent@vivier.eu, Taylor Simpson , philmd@redhat.com, aleksandar.m.mail@gmail.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" GDB register read and write routines Signed-off-by: Taylor Simpson --- target/hexagon/cpu.c | 3 +++ target/hexagon/gdbstub.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 target/hexagon/gdbstub.c diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c index 98d6bdc..576c566 100644 --- a/target/hexagon/cpu.c +++ b/target/hexagon/cpu.c @@ -288,6 +288,9 @@ static void hexagon_cpu_class_init(ObjectClass *c, void *data) cc->dump_state = hexagon_dump_state; cc->set_pc = hexagon_cpu_set_pc; cc->synchronize_from_tb = hexagon_cpu_synchronize_from_tb; + cc->gdb_core_xml_file = "hexagon-core.xml"; + cc->gdb_read_register = hexagon_gdb_read_register; + cc->gdb_write_register = hexagon_gdb_write_register; cc->gdb_num_core_regs = TOTAL_PER_THREAD_REGS; cc->gdb_stop_before_watchpoint = true; cc->disas_set_info = hexagon_cpu_disas_set_info; diff --git a/target/hexagon/gdbstub.c b/target/hexagon/gdbstub.c new file mode 100644 index 0000000..e678aea --- /dev/null +++ b/target/hexagon/gdbstub.c @@ -0,0 +1,49 @@ +/* + * Copyright(c) 2019-2020 Qualcomm Innovation Center, Inc. All Rights Reserved. + * + * 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 . + */ + +#include "qemu/osdep.h" +#include "qemu-common.h" +#include "exec/gdbstub.h" +#include "cpu.h" +#include "internal.h" + +int hexagon_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n) +{ + HexagonCPU *cpu = HEXAGON_CPU(cs); + CPUHexagonState *env = &cpu->env; + + if (n < TOTAL_PER_THREAD_REGS) { + return gdb_get_regl(mem_buf, env->gpr[n]); + } + + g_assert_not_reached(); + return 0; +} + +int hexagon_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) +{ + HexagonCPU *cpu = HEXAGON_CPU(cs); + CPUHexagonState *env = &cpu->env; + + if (n < TOTAL_PER_THREAD_REGS) { + env->gpr[n] = ldtul_p(mem_buf); + return sizeof(target_ulong); + } + + g_assert_not_reached(); + return 0; +}