From patchwork Wed Feb 17 23:39:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 383940 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3221745jao; Wed, 17 Feb 2021 15:49:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJxuVmK73jND/EXZRoYcU69n5IHX+CneMGdiU+6i6h3x5OKSvyn25yQEUbd8y0nDye683tMr X-Received: by 2002:a25:d70b:: with SMTP id o11mr2714332ybg.471.1613605770952; Wed, 17 Feb 2021 15:49:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613605770; cv=none; d=google.com; s=arc-20160816; b=QwHnu4B8pLu7A2jfyks7anFOFd7aM+h2sd0jwxeFMqE8AcG0FyZvB3Pf/fMZPCdmKh G0k03LSM4WlFcTgohBEIMfDyHdmgUJOimbKeMWhTfdsiBkFrlQFVxqlefMMFAPEQ3u84 7bzvtLPfTfiO0TbUe5yDH2EX/lZ7X7t5gaZ/U7YLLx5lPYRiey5AEMwX6ZH23UwhKXrp GprSX6J7g1BF0FzIvAwz26cm3PhQDXO0DOlZZRXcBimFDX6he0sLXGnuAAVlgyvZny5j eqS1rpb0EXcWyGGR0lW6Z6fcOh0PQXLojEMjPE2Z58+d/0yqWvMIL+r7rYPa3JGq5Hgx ypMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=rT3fdfxLOBUZePBBIZU0/yFNFGueWion3u26dnymBfY=; b=tkGHaUUvjAzwjP0A93B6HoLXyyMs31s85HSbrbCtWoVIN9kttgd+9e2zXva6CcOyrn FlicBk7gYEdNsQrnqG0mYiSaDRTqzOvbXvVvmcZvfmSQlos1ESBdwE9fGD5Bd6snsPBo e+Vlnvvvb3g4FDX5Ido/11HA6nu+NwfRJltX3KgENJnyzkaUUkFborwFh0Y/azapRJh6 NxC/dFtjlwQh0W1IcvrETFSPmGIZiqI5eVawByR3F0tJ44JHvsmH3tS4CYjG5YrY/drM EWJ5HIhIui3RT2ESyui3cLPITJFDU1cSJtx2pCc5Wct99NAVlceByv16riSju12j4+Hb 0VVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OQYuTL8i; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u17si3655126ybj.429.2021.02.17.15.49.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Feb 2021 15:49:30 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OQYuTL8i; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:58736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCWZW-0001Sc-EK for patch@linaro.org; Wed, 17 Feb 2021 18:49:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50628) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCWRA-0008Ds-ES for qemu-devel@nongnu.org; Wed, 17 Feb 2021 18:40:52 -0500 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]:42627) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCWR7-0004ch-Rk for qemu-devel@nongnu.org; Wed, 17 Feb 2021 18:40:52 -0500 Received: by mail-pg1-x531.google.com with SMTP id o38so9502133pgm.9 for ; Wed, 17 Feb 2021 15:40:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rT3fdfxLOBUZePBBIZU0/yFNFGueWion3u26dnymBfY=; b=OQYuTL8isULqJrBXjgnJVlNqgNrk0eKil7Vjvhiq1Op/OM3W5pRGihovrKl1p22zVd 61APAvQhsOjnqWkKcjP/ZWPGzG//XaOFlB3NWuJiOQz9yYKffwKRhuxpZB9IwjikxDRv qBdSi5IwssUGT5BQFSQBs4nwu5tn76HH+sRo+dAUnwpw07urlfBvTw788GN/8uB81wzg m8X7qIfmRD/KZXz25QoARpN/7ySpJK3BiOUD6Q5Hq6vtt9Nl/rk4MDch60UFow77GvLY QnewiY42gVHGS9yoUmO1Pdr3J8yjtYwjwfQKoUd+qecWgZtRWjCtrCJGMTYUzTpYOKWu gn3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rT3fdfxLOBUZePBBIZU0/yFNFGueWion3u26dnymBfY=; b=k7Wj0HtqPx5DGGWaheO6fW/n1MQsuVDXswD/E2q+wUpJqs0hcnuB1CZcyO8b3kWcIP hJuhuqdeJP+sRRsXs66b8As4Kcf5Lp8KEt5isJdnGecINZYleT3tIcH3AEgguy1buHwm dI5+pJk/2l/cgaIMQEFs2H6jgI3upwTx+OI6YebKNnHyde9nzSTrYoM7/vWlVWevG+em d+zglp6+C0zreRawM1TLHOsBecS8g5OHglkaXjkHYVA26Jm7Rvaa6RaDnCvvefzapMOE 7Hc9VTuBNjwd4xU3RVBVv2BC5WENOIZI0Jqjc5WtzpigRY2S9F6u9rFD6A87vateBAeu 2j7A== X-Gm-Message-State: AOAM530/yXGFfHK6EgnuoXY7I3E0Bb9JSSIgiYzI2QCDCPzTkmKlYOZs 2UzQzMlEFG/4qOLG+bwq4V55pINECRKGAg== X-Received: by 2002:a62:2c50:0:b029:1b9:1846:b490 with SMTP id s77-20020a622c500000b02901b91846b490mr1551788pfs.76.1613605248196; Wed, 17 Feb 2021 15:40:48 -0800 (PST) Received: from localhost.localdomain (047-051-160-125.biz.spectrum.com. [47.51.160.125]) by smtp.gmail.com with ESMTPSA id c21sm3950355pgh.0.2021.02.17.15.40.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Feb 2021 15:40:47 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 09/35] Hexagon (target/hexagon) GDB Stub Date: Wed, 17 Feb 2021 15:39:57 -0800 Message-Id: <20210217234023.1742406-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217234023.1742406-1-richard.henderson@linaro.org> References: <20210217234023.1742406-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x531.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: peter.maydell@linaro.org, Taylor Simpson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Taylor Simpson GDB register read and write routines Signed-off-by: Taylor Simpson Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <1612763186-18161-9-git-send-email-tsimpson@quicinc.com> Signed-off-by: Richard Henderson --- target/hexagon/internal.h | 2 ++ target/hexagon/gdbstub.c | 47 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 target/hexagon/gdbstub.c -- 2.25.1 diff --git a/target/hexagon/internal.h b/target/hexagon/internal.h index c839796cd1..2da85c8606 100644 --- a/target/hexagon/internal.h +++ b/target/hexagon/internal.h @@ -28,6 +28,8 @@ #define HEX_DEBUG_LOG(...) do { } while (0) #endif +int hexagon_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg); +int hexagon_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); void hexagon_debug(CPUHexagonState *env); extern const char * const hexagon_regnames[TOTAL_PER_THREAD_REGS]; diff --git a/target/hexagon/gdbstub.c b/target/hexagon/gdbstub.c new file mode 100644 index 0000000000..9c8c04c961 --- /dev/null +++ b/target/hexagon/gdbstub.c @@ -0,0 +1,47 @@ +/* + * Copyright(c) 2019-2021 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, GByteArray *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(); +} + +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(); +}