X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Friscv-linux-tdep.c;h=919c7e56e4f86c3727fbb01658a32aa869e7e8af;hb=07b76c2f0baf197ce44d66a153184d33047e7ba0;hp=ece75dba47fd0f138b2b72824662e059c4404185;hpb=77c6f5fcdae65da0428ff75fa81059f1b5271cf0;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/riscv-linux-tdep.c b/gdb/riscv-linux-tdep.c index ece75dba47..919c7e56e4 100644 --- a/gdb/riscv-linux-tdep.c +++ b/gdb/riscv-linux-tdep.c @@ -1,5 +1,5 @@ /* Target-dependent code for GNU/Linux on RISC-V processors. - Copyright (C) 2018 Free Software Foundation, Inc. + Copyright (C) 2018-2020 Free Software Foundation, Inc. This file is part of GDB. @@ -25,6 +25,7 @@ #include "regset.h" #include "tramp-frame.h" #include "trad-frame.h" +#include "gdbarch.h" /* Define the general register mapping. The kernel puts the PC at offset 0, gdb puts it at offset 32. Register x0 is always 0 and can be ignored. @@ -37,6 +38,16 @@ static const struct regcache_map_entry riscv_linux_gregmap[] = { 0 } }; +/* Define the FP register mapping. The kernel puts the 32 FP regs first, and + then FCSR. */ + +static const struct regcache_map_entry riscv_linux_fregmap[] = +{ + { 32, RISCV_FIRST_FP_REGNUM, 0 }, + { 1, RISCV_CSR_FCSR_REGNUM, 0 }, + { 0 } +}; + /* Define the general register regset. */ static const struct regset riscv_linux_gregset = @@ -44,6 +55,13 @@ static const struct regset riscv_linux_gregset = riscv_linux_gregmap, regcache_supply_regset, regcache_collect_regset }; +/* Define the FP register regset. */ + +static const struct regset riscv_linux_fregset = +{ + riscv_linux_fregmap, regcache_supply_regset, regcache_collect_regset +}; + /* Define hook for core file support. */ static void @@ -54,8 +72,10 @@ riscv_linux_iterate_over_regset_sections (struct gdbarch *gdbarch, { cb (".reg", (32 * riscv_isa_xlen (gdbarch)), (32 * riscv_isa_xlen (gdbarch)), &riscv_linux_gregset, NULL, cb_data); - - /* TODO: Add FP register support. */ + /* The kernel is adding 8 bytes for FCSR. */ + cb (".reg2", (32 * riscv_isa_flen (gdbarch)) + 8, + (32 * riscv_isa_flen (gdbarch)) + 8, + &riscv_linux_fregset, NULL, cb_data); } /* Signal trampoline support. */