From patchwork Tue Apr 14 20:06:27 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: 185450 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp1840373ilf; Tue, 14 Apr 2020 13:16:40 -0700 (PDT) X-Google-Smtp-Source: APiQypKyxN9ERJzkexYPt8DLNGkB5210qxJmlwHYrlC6nRhWrkTvnpVYO99jMTtJXKkpeNoUjhS1 X-Received: by 2002:ac8:c84:: with SMTP id n4mr18137369qti.24.1586895400161; Tue, 14 Apr 2020 13:16:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586895400; cv=none; d=google.com; s=arc-20160816; b=pPE0EoAfGbAcZgSwUhqqIYDGGQlcniZheAlRKEfpfRHVikkEBMQO3mREVLEBG0uX7K qVQPSAgVO+bHie9Lf7idc/t6TS5XUDpXLFnML1/Y/fAEnMMkl4+rG8JNWlG34n/c3NjO tZaetADJtHKspsl1He6MrE9if/tp0cXZ0818ck0XJongcCP2dxoqmndztFmRJVWSCGdR Y514snI/YqfAjZ77cWjAnWKThf5uDD54Gauxj84JzJeUNdtLiDeNMjZqsHDzw3iFFHrh eTCiLOltnE+XzI6NqF+svMMaO715jQn7H+y3S3jhG6yOSxg1oX/pBmaaxX8woWuiwE5e 5Y5g== 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=Y41oariPSirC8NfMhDAA8Vm62k5I1+y4ZRfI3cHl76k=; b=yMs3I6Ze/dcIlCQeb8zzwpdNEfthyqu90hbRT8OSve5l4iTGOuZdxoMLnIai8eMURR dv4y3Mqr0VnN67yS3C+ZjlyjikvcAEt2RWxSkQ5FSyG80jbzf6aNG/Iw9BL7caIidDr4 BLSe+ux8PAIWk1IyohUxo3s5Qf8wdKwzOZ3MRw1cegs0Wbd0+gaNPHdPv5Hr+20FO0dm YXAT88XB9UnEchuanoFp3pS3P2sWem/fqQvnVBcbjUZEdFjbVvZiE58+9XVVDk+/bfXY JFB9NjDUyRbg57J63Vh4Z/HVeHLD2uU8ztmfsJdN6GU2Y18sJUDvVWEL5JxmIV/k55QQ d77w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YgfGVdkf; 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 y16si8993544qtn.345.2020.04.14.13.16.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 Apr 2020 13:16:40 -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=YgfGVdkf; 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]:38560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jORz4-0003Ym-KA for patch@linaro.org; Tue, 14 Apr 2020 16:16:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44597) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jORpf-0006Eu-4b for qemu-devel@nongnu.org; Tue, 14 Apr 2020 16:06:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jORpe-000627-3a for qemu-devel@nongnu.org; Tue, 14 Apr 2020 16:06:55 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:44212) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jORpd-00060K-Rk for qemu-devel@nongnu.org; Tue, 14 Apr 2020 16:06:54 -0400 Received: by mail-wr1-x42f.google.com with SMTP id d17so9089172wrg.11 for ; Tue, 14 Apr 2020 13:06:52 -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=Y41oariPSirC8NfMhDAA8Vm62k5I1+y4ZRfI3cHl76k=; b=YgfGVdkf//l7U+mJ+B5Z6iAPJUBTw6O2mNuPpXLZEA29xfYTZ+OcqUyigRwqEXLUAD YZRUmM9/fbl1DhPgfD+pYoX7x0TErvieLRGlVhJtOtj9HAmu7lDtILdp9Fh907bqD2wT 11VaE4LcsxutGRAEp38Z1BooO4y9oky49ENLw8OuIaGPtwYdyCqGFVjXlIlsvvKCC/EG jHUZOTe1KPGA/3Z932uOpZ+wYNScmq40cDeIc5wBo/Q6fEE0gfzXhbV6+PSOdUD99p40 E7fi9Yf5NwHkZs7TpneG5q6UWNuJKxSrounIi5KfAkhNMjC2xhJsVpNoLftZjJJZ5SJI jyAQ== 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=Y41oariPSirC8NfMhDAA8Vm62k5I1+y4ZRfI3cHl76k=; b=hnTnRle6ADKvp5C5X+bDM3Lt3xBH99pv/vyEjLeWE9nBDFozrhD9tTv8oIhKeSVj5T a1RljSqVEeELlY8gFwUJ/6wxQQmNh1GOyEbCbgXRzHQkM7DeV/2oFL6eZeJ1TtrMtM8O VqEXP/zPijHQO52u1xeb3FDzaOaCheCeGHHtei31QpbUQmoAal1C9JPuPyDOihPIQaUu kCVSC6GJBFQ0TmvO1JF+FlBUyQOMC0HXW1gOOJfNxuN1HDyB78NLARlDlTgZNo6gxOiL 2bDlu8ZvHfUNgtUAAIa/9ipIhfX0RH4fZ7XAABqjm9TXLIJh9pBQzls2vF4mgawJpk43 6MtA== X-Gm-Message-State: AGi0PuZtOMiEliouCXdHYd8QykeL0YalrB1L9ExRcLaPZfJD0tO9ebGZ K+DZ0JTiDPkVbg3uSMnP80hEZQ== X-Received: by 2002:a5d:4a42:: with SMTP id v2mr24248547wrs.333.1586894811402; Tue, 14 Apr 2020 13:06:51 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id t2sm13394364wmt.15.2020.04.14.13.06.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Apr 2020 13:06:44 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id AF3781FF7E; 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 13/17] gdbstub: Introduce gdb_get_float32() to get 32-bit float registers Date: Tue, 14 Apr 2020 21:06:27 +0100 Message-Id: <20200414200631.12799-14-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::42f 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: =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Aurelien Jarno Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Since we now use a GByteArray, we can not use stfl_p() directly. Introduce the gdb_get_float32() helper to load a float32 register. Fixes: a010bdbe719 ("extend GByteArray to read register helpers") Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Alex Bennée Message-Id: <20200414163853.12164-2-philmd@redhat.com> --- include/exec/gdbstub.h | 9 +++++++++ target/sh4/gdbstub.c | 6 ++---- 2 files changed, 11 insertions(+), 4 deletions(-) -- 2.20.1 Reviewed-by: Richard Henderson diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index 3c452fc50c0..20e10726929 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -125,6 +125,15 @@ static inline int gdb_get_reg128(GByteArray *buf, uint64_t val_hi, return 16; } +static inline int gdb_get_float32(GByteArray *array, float32 val) +{ + uint8_t buf[sizeof(CPU_FloatU)]; + + stfl_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/sh4/gdbstub.c b/target/sh4/gdbstub.c index 49fc4a0cc69..34ad3ca0508 100644 --- a/target/sh4/gdbstub.c +++ b/target/sh4/gdbstub.c @@ -58,11 +58,9 @@ int superh_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) return gdb_get_regl(mem_buf, env->fpscr); case 25 ... 40: if (env->fpscr & FPSCR_FR) { - stfl_p(mem_buf, env->fregs[n - 9]); - } else { - stfl_p(mem_buf, env->fregs[n - 25]); + return gdb_get_float32(mem_buf, env->fregs[n - 9]); } - return 4; + return gdb_get_float32(mem_buf, env->fregs[n - 25]); case 41: return gdb_get_regl(mem_buf, env->ssr); case 42: