From nobody Thu Nov 13 22:08:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail header.i=@quicinc.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1582910166; cv=none; d=zohomail.com; s=zohoarc; b=d1MxWV6oHDgSkr/uzkge5xwjzK7EDyXO3CqcyNylcNmtuLtJbxbog1t1JxkCerq/fn9ntTien+/81vfeakZtsLsool+kgiYsWY2+ER/OTnMOjpWuoAkitX5VGoYmzrqRJGQ48T4uR95feD2y6D5n0rH2KUDC5mzukBnjEyUO6HY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582910166; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=DFiYq/TqpVVEyNz6Bpz3GlX93C54CgCm5kaxbuGCrBA=; b=kXT+JyBuM2xJPC6fFnOPgneGGLmmxMRmPPEcZevefNiFm1059yIYATedA9aQsCHZ7DEOGR+3v36cj/KHFgXL3J9ACAFz7yEkyOURZ7IT0QmIK/xTIx6dhKaoJSgx8WRAI7dHi+o8nIIIqio+HCi0vmyUnuKB0PAPHWrDwQ5Ok98= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail header.i=@quicinc.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1582910166913288.3425469306984; Fri, 28 Feb 2020 09:16:06 -0800 (PST) Received: from localhost ([::1]:51112 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j7jF6-0002NR-MT for importer@patchew.org; Fri, 28 Feb 2020 12:16:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58378) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j7im1-0005ax-0m for qemu-devel@nongnu.org; Fri, 28 Feb 2020 11:46:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j7ilz-00079p-Pv for qemu-devel@nongnu.org; Fri, 28 Feb 2020 11:46:00 -0500 Received: from alexa-out-sd-02.qualcomm.com ([199.106.114.39]:27026) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j7ilz-0005U4-GM for qemu-devel@nongnu.org; Fri, 28 Feb 2020 11:45:59 -0500 Received: from unknown (HELO ironmsg01-sd.qualcomm.com) ([10.53.140.141]) by alexa-out-sd-02.qualcomm.com with ESMTP; 28 Feb 2020 08:44:34 -0800 Received: from vu-tsimpson-aus.qualcomm.com (HELO vu-tsimpson1-aus.qualcomm.com) ([10.222.150.1]) by ironmsg01-sd.qualcomm.com with ESMTP; 28 Feb 2020 08:44:33 -0800 Received: by vu-tsimpson1-aus.qualcomm.com (Postfix, from userid 47164) id E515D1110; Fri, 28 Feb 2020 10:44:32 -0600 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1582908359; x=1614444359; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DFiYq/TqpVVEyNz6Bpz3GlX93C54CgCm5kaxbuGCrBA=; b=UP3xBp8Oew2St3TcWoHwUnD1Nl7+QmV+4LaKtx7BwdC10hY1f7S1J7aK +6p0iDbNu+eGd0/mQZACpUxSuI/wx0QaeS8fXIvx5HAvqeEKSQuRArYjQ fZ2RDw6wK8agqC9k7kBT5zQuQUBu7+djA7Nc9bdfvFWmEhBTB2Id9nxbe U=; From: Taylor Simpson To: qemu-devel@nongnu.org Subject: [RFC PATCH v2 55/67] Hexagon HVX support in gdbstub Date: Fri, 28 Feb 2020 10:43:51 -0600 Message-Id: <1582908244-304-56-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Signed-off-by: Taylor Simpson --- target/hexagon/gdbstub.c | 62 ++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 62 insertions(+) diff --git a/target/hexagon/gdbstub.c b/target/hexagon/gdbstub.c index e678aea..79a4f33 100644 --- a/target/hexagon/gdbstub.c +++ b/target/hexagon/gdbstub.c @@ -21,6 +21,28 @@ #include "cpu.h" #include "internal.h" =20 +static int gdb_get_vreg(CPUHexagonState *env, uint8_t *mem_buf, int n) +{ + int total =3D 0; + int i; + for (i =3D 0; i < MAX_VEC_SIZE_BYTES / 4; i++) { + total +=3D gdb_get_regl(mem_buf, env->VRegs[n].uw[i]); + mem_buf +=3D 4; + } + return total; +} + +static int gdb_get_qreg(CPUHexagonState *env, uint8_t *mem_buf, int n) +{ + int total =3D 0; + int i; + for (i =3D 0; i < MAX_VEC_SIZE_BYTES / 4 / 8; i++) { + total +=3D gdb_get_regl(mem_buf, env->QRegs[n].uw[i]); + mem_buf +=3D 4; + } + return total; +} + int hexagon_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n) { HexagonCPU *cpu =3D HEXAGON_CPU(cs); @@ -29,11 +51,41 @@ int hexagon_gdb_read_register(CPUState *cs, uint8_t *me= m_buf, int n) if (n < TOTAL_PER_THREAD_REGS) { return gdb_get_regl(mem_buf, env->gpr[n]); } + n -=3D TOTAL_PER_THREAD_REGS; + + if (n < NUM_VREGS) { + return gdb_get_vreg(env, mem_buf, n); + } + n -=3D NUM_VREGS; + + if (n < NUM_QREGS) { + return gdb_get_qreg(env, mem_buf, n); + } =20 g_assert_not_reached(); return 0; } =20 +static int gdb_put_vreg(CPUHexagonState *env, uint8_t *mem_buf, int n) +{ + int i; + for (i =3D 0; i < MAX_VEC_SIZE_BYTES / 4; i++) { + env->VRegs[n].uw[i] =3D ldtul_p(mem_buf); + mem_buf +=3D 4; + } + return MAX_VEC_SIZE_BYTES; +} + +static int gdb_put_qreg(CPUHexagonState *env, uint8_t *mem_buf, int n) +{ + int i; + for (i =3D 0; i < MAX_VEC_SIZE_BYTES / 4 / 8; i++) { + env->QRegs[n].uw[i] =3D ldtul_p(mem_buf); + mem_buf +=3D 4; + } + return MAX_VEC_SIZE_BYTES / 8; +} + int hexagon_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) { HexagonCPU *cpu =3D HEXAGON_CPU(cs); @@ -43,6 +95,16 @@ int hexagon_gdb_write_register(CPUState *cs, uint8_t *me= m_buf, int n) env->gpr[n] =3D ldtul_p(mem_buf); return sizeof(target_ulong); } + n -=3D TOTAL_PER_THREAD_REGS; + + if (n < NUM_VREGS) { + return gdb_put_vreg(env, mem_buf, n); + } + n -=3D NUM_VREGS; + + if (n < NUM_QREGS) { + return gdb_put_qreg(env, mem_buf, n); + } =20 g_assert_not_reached(); return 0; --=20 2.7.4