diff options
author | Hui Li <lihui@loongson.cn> | 2024-01-25 16:32:35 +0800 |
---|---|---|
committer | Tiezhu Yang <yangtiezhu@loongson.cn> | 2024-02-06 18:40:02 +0800 |
commit | 1e9569f383a3d5a88ee07d0c2401bd95613c222e (patch) | |
tree | 987349cbcb070f5ec779c7f16a71df16fbc4f86f /gdbserver | |
parent | 60c95acdaca94eca79b81ec75bfab97826cc0271 (diff) | |
download | gdb-1e9569f383a3d5a88ee07d0c2401bd95613c222e.zip gdb-1e9569f383a3d5a88ee07d0c2401bd95613c222e.tar.gz gdb-1e9569f383a3d5a88ee07d0c2401bd95613c222e.tar.bz2 |
gdb: LoongArch: Add vector extensions support
Add LoongArch's vector extensions support, which including
128bit LSX (i.e., Loongson SIMD eXtension) and 256bit LASX
(i.e., Loongson Advanced SIMD eXtension). This patch support
gdb to fetch/store vector registers.
Signed-off-by: Hui Li <lihui@loongson.cn>
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Diffstat (limited to 'gdbserver')
-rw-r--r-- | gdbserver/linux-loongarch-low.cc | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/gdbserver/linux-loongarch-low.cc b/gdbserver/linux-loongarch-low.cc index c7328b2..f33c5a6 100644 --- a/gdbserver/linux-loongarch-low.cc +++ b/gdbserver/linux-loongarch-low.cc @@ -177,12 +177,64 @@ loongarch_store_fpregset (struct regcache *regcache, const void *buf) supply_register (regcache, LOONGARCH_FCSR_REGNUM, regbuf); } +/* Collect lsx regs from REGCACHE into BUF. */ + +static void +loongarch_fill_lsxregset (struct regcache *regcache, void *buf) +{ + elf_lsxregset_t *regset = (elf_lsxregset_t *) buf; + int i; + + for (i = 0; i < LOONGARCH_LINUX_NUM_LSXREGSET; i++) + collect_register (regcache, LOONGARCH_FIRST_LSX_REGNUM + i, *regset + i); +} + +/* Supply lsx regs from BUF into REGCACHE. */ + +static void +loongarch_store_lsxregset (struct regcache *regcache, const void *buf) +{ + const elf_lsxregset_t *regset = (const elf_lsxregset_t *) buf; + int i; + + for (i = 0; i < LOONGARCH_LINUX_NUM_LSXREGSET; i++) + supply_register (regcache, LOONGARCH_FIRST_LSX_REGNUM + i, *regset + i); +} + +/* Collect lasx regs from REGCACHE into BUF. */ + +static void +loongarch_fill_lasxregset (struct regcache *regcache, void *buf) +{ + elf_lasxregset_t *regset = (elf_lasxregset_t *) buf; + int i; + + for (i = 0; i < LOONGARCH_LINUX_NUM_LASXREGSET; i++) + collect_register (regcache, LOONGARCH_FIRST_LASX_REGNUM + i, *regset + i); +} + +/* Supply lasx regs from BUF into REGCACHE. */ + +static void +loongarch_store_lasxregset (struct regcache *regcache, const void *buf) +{ + const elf_lasxregset_t *regset = (const elf_lasxregset_t *) buf; + int i; + + for (i = 0; i < LOONGARCH_LINUX_NUM_LASXREGSET; i++) + supply_register (regcache, LOONGARCH_FIRST_LASX_REGNUM + i, *regset + i); +} + /* 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 }, + { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_LARCH_LSX, sizeof (elf_lsxregset_t), + OPTIONAL_REGS, loongarch_fill_lsxregset, loongarch_store_lsxregset }, + { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_LARCH_LASX, sizeof (elf_lasxregset_t), + OPTIONAL_REGS, loongarch_fill_lasxregset, loongarch_store_lasxregset }, NULL_REGSET }; |