From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Song Gao <gaosong@loongson.cn>, qemu-devel@nongnu.org
Cc: alex.bennee@linaro.org, richard.henderson@linaro.org,
maobibo@loongson.cn
Subject: Re: [PATCH v2] target/loongarch/gdbstub: Add vector registers support
Date: Tue, 16 Jul 2024 23:30:58 +0200 [thread overview]
Message-ID: <61f65df7-d7cb-4b7d-8c72-6526b349e501@linaro.org> (raw)
In-Reply-To: <20240711024454.3075183-1-gaosong@loongson.cn>
On 11/7/24 04:44, Song Gao wrote:
> GDB already support LoongArch vector extension[1], QEMU gdb adds
> LoongArch vector registers support, so that users can use 'info all-registers'
> to get all vector registers values.
>
> [1]: https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=1e9569f383a3d5a88ee07d0c2401bd95613c222e
>
> Signed-off-by: Song Gao <gaosong@loongson.cn>
> ---
> based-on:
> https://patchew.org/QEMU/20240607035016.2975799-1-maobibo@loongson.cn/
>
> v2:
> - fix tab line wrapper issue.
> - Link to v1: https://patchew.org/QEMU/20240621065406.864232-1-gaosong@loongson.cn/
>
> configs/targets/loongarch64-linux-user.mak | 2 +-
> configs/targets/loongarch64-softmmu.mak | 2 +-
> target/loongarch/gdbstub.c | 70 +++++++++++++++++++++-
> gdb-xml/loongarch-lasx.xml | 60 +++++++++++++++++++
> gdb-xml/loongarch-lsx.xml | 59 ++++++++++++++++++
> 5 files changed, 189 insertions(+), 4 deletions(-)
> create mode 100644 gdb-xml/loongarch-lasx.xml
> create mode 100644 gdb-xml/loongarch-lsx.xml
> +static int loongarch_gdb_get_vec(CPUState *cs, GByteArray *mem_buf, int n, int vl)
> +{
> + LoongArchCPU *cpu = LOONGARCH_CPU(cs);
> + CPULoongArchState *env = &cpu->env;
> + int i, length = 0;
> +
> + if (0 <= n && n < 32) {
> + for (i = 0; i < vl / 64; i++) {
Preferably using FOO_PER_BAR definitions for 32 & 64 magic values,
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> + length += gdb_get_reg64(mem_buf, env->fpr[n].vreg.D(i));
> + }
> + }
> +
> + return length;
> +}
> +
> +static int loongarch_gdb_set_vec(CPUState *cs, uint8_t *mem_buf, int n, int vl)
> +{
> + LoongArchCPU *cpu = LOONGARCH_CPU(cs);
> + CPULoongArchState *env = &cpu->env;
> + int i, length = 0;
> +
> + if (0 <= n && n < 32) {
> + for (i = 0; i < vl / 64; i++) {
> + env->fpr[n].vreg.D(i) = ldq_le_p(mem_buf + 8 * i);
> + length += 8;
> + }
> + }
> +
> + return length;
> +}
prev parent reply other threads:[~2024-07-16 21:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-11 2:44 [PATCH v2] target/loongarch/gdbstub: Add vector registers support Song Gao
2024-07-16 3:54 ` gaosong
2024-07-16 6:16 ` maobibo
2024-07-16 21:30 ` Philippe Mathieu-Daudé [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=61f65df7-d7cb-4b7d-8c72-6526b349e501@linaro.org \
--to=philmd@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=gaosong@loongson.cn \
--cc=maobibo@loongson.cn \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).