From patchwork Tue Apr 14 20:06:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 185453 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp1845853ilf; Tue, 14 Apr 2020 13:22:53 -0700 (PDT) X-Google-Smtp-Source: APiQypJnorLT/Gc9LXgRyFy48f0hz68vw83/i9QQg/vla1PS863eWhgvE9KHGoYevNkYK1oPSBrv X-Received: by 2002:a37:48a:: with SMTP id 132mr23610994qke.390.1586895773640; Tue, 14 Apr 2020 13:22:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586895773; cv=none; d=google.com; s=arc-20160816; b=rus0gp91oUH1wANTBHHBx4pmz8ESHeaV2AV1TzgWKXCFSN7BHt6Z2dI7xbnm/oCCP3 w8oDK+Ca5NdJWBK6BUTV0kZiRvQ3C2vzU9+jro0P3QQoEKYAyEBSF6PhGPFWe7Q/VfW1 ndSX53t+j7TPFqoKqDtkFDp1gi6RnFM+ZGF8oASjzuNYcxd78dZPlSGcIdXYY6c3F8HD XDbKlk8BUOBensYUC63rdKr0ctfpo2YDecfOj5vAILz5NwSq6eYRt5/ozVrzuKKI+ApH /mNU/Y+UxggXOzZcbe3cgN06vZYsxQBsLKEZnBmiU/Zy56tFmH5nup7YNbFie8u29RLP PoZA== 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=3UWknvv+wdPtsXv26OjYUAVxV8/wuy9nynu7HohmC0w=; b=TieWl2Oad7kM0z+hlCIBg0rR7i5j7AzPtSfT4k3ivDD8ve5NQbvsD2Y2bZyOTv6OM/ dGn9mjHs7AG8X9mmWbwQ96m2R1k2vzCgv+6acRABpYHFEy5EcbDM2CicZmQXZ5uah35/ WNu3ekZECVzWvdlk4e9/7QFNcE/v1sjaeg8YImMefy4ZDKXLWj2b/5eUzPf/alj/05yB GYJYIYcThbYaAlSGoLnhOYmRzg7ihM2HRPCIpKii+vDUC8l8lwA+Q6AdH9KHlhPXX5TN v8gaAZ77ToGlSskrnUikty39HA9RVQJJhTGfHitgauE7JtdWTEScTyHDBUfwwKezQ5dj vyiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=PHCviFKd; 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=fail (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 h21si7924806qve.56.2020.04.14.13.22.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 Apr 2020 13:22:53 -0700 (PDT) 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=fail header.i=@linaro.org header.s=google header.b=PHCviFKd; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:38720 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jOS57-0003a4-6N for patch@linaro.org; Tue, 14 Apr 2020 16:22:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45924) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jORyj-00042g-IN for qemu-devel@nongnu.org; Tue, 14 Apr 2020 16:16:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jORyi-0001jM-Bh for qemu-devel@nongnu.org; Tue, 14 Apr 2020 16:16:17 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:52681) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jORyi-0001ik-4v for qemu-devel@nongnu.org; Tue, 14 Apr 2020 16:16:16 -0400 Received: by mail-wm1-x332.google.com with SMTP id o81so8958236wmo.2 for ; Tue, 14 Apr 2020 13:16:16 -0700 (PDT) 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=3UWknvv+wdPtsXv26OjYUAVxV8/wuy9nynu7HohmC0w=; b=PHCviFKd1hV0AsvNdCAwXWgDWrWM8XIaHkCpvzTa5wp7ih6mgcaiHoPqewJfOuTfZ6 hEaLhALhRKBTz7k7/fUtV0M9spzMOFsZX7Z99FZqjk8MXz2BLEmlxXsiOkG4zZ92PE19 9BAnhPz+Gl7JQzcvpN+L130pii2DI3n+650ZBJuQNs0c5NMh27xx+NyFyRHqjbF3qCqT dPESQiY4+5DSxxYXxrz20457bN+wmGMFLTCMv+jIKc9uB61Xb5bGHrZXcnMv0ULw9Oir 7yH/LpSYiVNr/Inl2leKT6137CRB9VSP2HmXOylEpsDwyN1IONMI8MNRPtjw4/OWGf5Z bapA== 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=3UWknvv+wdPtsXv26OjYUAVxV8/wuy9nynu7HohmC0w=; b=rlxYTXdqmNucbYGxyvVouLUaLkNC1LSeG4MNGTg+EdrBzGhZp78JmSGq4W++wJoUSr jQ2bLQdl3z1oFfNJWIvmgMQTES3K0Ez9X0+QKeDqvle0orn1he3FTZST/o6SS5qLwU6+ QDTCPNLW0834cbXY0rRUeOgh6dh2GpCWaHT23f/x8tRzqXEID+91BywMLir+lSm2v0ZX WBEJELo3PWotsnkZ65zmS5zCEXzbZD2hQHgaZy6CkdMBLWloCjThfY4OHxSKOdu7a3rJ yyjXo8uurfIPczzNnzDlYE239hGKYib59FYR+ACpN/zUS8P7LmaVBZ6IDogfbp4+7ob9 SLUg== X-Gm-Message-State: AGi0PuZWmzedRMOVpYLDD8Iv0+7dZfrWOoqgeX+nFlZwtvK7Bc1oIzKa qISV3eU9qkVpvn6DrfV6fQra5w== X-Received: by 2002:a05:600c:2112:: with SMTP id u18mr1627424wml.112.1586895375103; Tue, 14 Apr 2020 13:16:15 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id i17sm20105226wml.23.2020.04.14.13.16.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Apr 2020 13:16:11 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id DACC01FF9C; Tue, 14 Apr 2020 21:06:33 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 14/17] gdbstub: Introduce gdb_get_float64() to get 64-bit float registers Date: Tue, 14 Apr 2020 21:06:28 +0100 Message-Id: <20200414200631.12799-15-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200414200631.12799-1-alex.bennee@linaro.org> References: <20200414200631.12799-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::332 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: "open list:PowerPC TCG CPUs" , =?utf-8?q?Alex_Ben?= =?utf-8?q?n=C3=A9e?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier , David Gibson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé When converted to use GByteArray in commits 462474d760c and a010bdbe719, the call to stfq_p() was removed. This call serialize a float. Since we now use a GByteArray, we can not use stfq_p() directly. Introduce the gdb_get_float64() helper to load a float64 register. Fixes: 462474d760c ("target/m68k: use gdb_get_reg helpers") Fixes: a010bdbe719 ("extend GByteArray to read register helpers") Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Alex Bennée Message-Id: <20200414163853.12164-3-philmd@redhat.com> --- include/exec/gdbstub.h | 11 +++++++++++ target/m68k/helper.c | 3 ++- target/ppc/gdbstub.c | 4 ++-- target/ppc/translate_init.inc.c | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) -- 2.20.1 diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index 20e10726929..4a2b8e30893 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -134,6 +134,17 @@ static inline int gdb_get_float32(GByteArray *array, float32 val) return sizeof(buf); } + +static inline int gdb_get_float64(GByteArray *array, float64 val) +{ + uint8_t buf[sizeof(CPU_DoubleU)]; + + stfq_p(buf, val); + g_byte_array_append(array, buf, sizeof(buf)); + + return sizeof(buf); +} + static inline int gdb_get_zeroes(GByteArray *array, size_t len) { guint oldlen = array->len; diff --git a/target/m68k/helper.c b/target/m68k/helper.c index cad40838956..79b0b10ea9b 100644 --- a/target/m68k/helper.c +++ b/target/m68k/helper.c @@ -72,7 +72,8 @@ static int cf_fpu_gdb_get_reg(CPUM68KState *env, GByteArray *mem_buf, int n) { if (n < 8) { float_status s; - return gdb_get_reg64(mem_buf, floatx80_to_float64(env->fregs[n].d, &s)); + return gdb_get_float64(mem_buf, + floatx80_to_float64(env->fregs[n].d, &s)); } switch (n) { case 8: /* fpcontrol */ diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c index eb362dd9aec..5c11c88b2a8 100644 --- a/target/ppc/gdbstub.c +++ b/target/ppc/gdbstub.c @@ -130,7 +130,7 @@ int ppc_cpu_gdb_read_register(CPUState *cs, GByteArray *buf, int n) gdb_get_regl(buf, env->gpr[n]); } else if (n < 64) { /* fprs */ - gdb_get_reg64(buf, *cpu_fpr_ptr(env, n - 32)); + gdb_get_float64(buf, *cpu_fpr_ptr(env, n - 32)); } else { switch (n) { case 64: @@ -184,7 +184,7 @@ int ppc_cpu_gdb_read_register_apple(CPUState *cs, GByteArray *buf, int n) gdb_get_reg64(buf, env->gpr[n]); } else if (n < 64) { /* fprs */ - gdb_get_reg64(buf, *cpu_fpr_ptr(env, n - 32)); + gdb_get_float64(buf, *cpu_fpr_ptr(env, n - 32)); } else if (n < 96) { /* Altivec */ gdb_get_reg64(buf, n - 64); diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.c index e853164a865..d825cb59758 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -9881,7 +9881,7 @@ static int gdb_get_float_reg(CPUPPCState *env, GByteArray *buf, int n) { uint8_t *mem_buf; if (n < 32) { - gdb_get_reg64(buf, *cpu_fpr_ptr(env, n)); + gdb_get_float64(buf, *cpu_fpr_ptr(env, n)); mem_buf = gdb_get_reg_ptr(buf, 8); ppc_maybe_bswap_register(env, mem_buf, 8); return 8;