public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Tiezhu Yang <yangtiezhu@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdbserver: LoongArch: Add floating-point support Date: Tue, 12 Jul 2022 12:16:19 +0000 (GMT) [thread overview] Message-ID: <20220712121619.B10A13857029@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3f6227c2f40a3e6009c60483f464e349d30145bb commit 3f6227c2f40a3e6009c60483f464e349d30145bb Author: Tiezhu Yang <yangtiezhu@loongson.cn> Date: Tue Jul 12 10:35:35 2022 +0800 gdbserver: LoongArch: Add floating-point support This commit adds floating-point support for LoongArch gdbserver. Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Diff: --- gdbserver/linux-loongarch-low.cc | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/gdbserver/linux-loongarch-low.cc b/gdbserver/linux-loongarch-low.cc index 91826b42361..7180f315b11 100644 --- a/gdbserver/linux-loongarch-low.cc +++ b/gdbserver/linux-loongarch-low.cc @@ -120,10 +120,42 @@ loongarch_store_gregset (struct regcache *regcache, const void *buf) supply_register (regcache, LOONGARCH_BADV_REGNUM, *regset + LOONGARCH_BADV_REGNUM); } +/* Collect FPRs from REGCACHE into BUF. */ + +static void +loongarch_fill_fpregset (struct regcache *regcache, void *buf) +{ + gdb_byte *regbuf = nullptr; + int fprsize = register_size (regcache->tdesc, LOONGARCH_FIRST_FP_REGNUM); + + for (int i = 0; i < LOONGARCH_LINUX_NUM_FPREGSET; i++) + { + regbuf = (gdb_byte *)buf + fprsize * i; + collect_register (regcache, LOONGARCH_FIRST_FP_REGNUM + i, regbuf); + } +} + +/* Supply FPRs from BUF into REGCACHE. */ + +static void +loongarch_store_fpregset (struct regcache *regcache, const void *buf) +{ + const gdb_byte *regbuf = nullptr; + int fprsize = register_size (regcache->tdesc, LOONGARCH_FIRST_FP_REGNUM); + + for (int i = 0; i < LOONGARCH_LINUX_NUM_FPREGSET; i++) + { + regbuf = (const gdb_byte *)buf + fprsize * i; + supply_register (regcache, LOONGARCH_FIRST_FP_REGNUM + i, regbuf); + } +} + /* LoongArch/Linux regsets. */ static struct regset_info loongarch_regsets[] = { { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PRSTATUS, sizeof (elf_gregset_t), GENERAL_REGS, loongarch_fill_gregset, loongarch_store_gregset }, + { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_FPREGSET, sizeof (elf_fpregset_t), + FP_REGS, loongarch_fill_fpregset, loongarch_store_fpregset }, NULL_REGSET };
reply other threads:[~2022-07-12 12:16 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220712121619.B10A13857029@sourceware.org \ --to=yangtiezhu@sourceware.org \ --cc=gdb-cvs@sourceware.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: linkBe 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 read-only IMAP folder(s) and NNTP newsgroup(s).