From 65d4cadafd7d9d5bb84810cde98a8c3a007a0594 Mon Sep 17 00:00:00 2001 From: Alan Hayward Date: Mon, 11 Jun 2018 10:24:20 +0100 Subject: [PATCH] Add Aarch64 SVE dwarf regnums This is as per the spec: https://developer.arm.com/products/architecture/a-profile/docs/100985/0000 gdb/ * aarch64-tdep.c (aarch64_dwarf_reg_to_regnum): Add mappings. * aarch64-tdep.h (AARCH64_DWARF_SVE_VG): Add define. (AARCH64_DWARF_SVE_FFR): Likewise. (AARCH64_DWARF_SVE_P0): Likewise. (AARCH64_DWARF_SVE_Z0): Likewise. --- gdb/ChangeLog | 8 ++++++++ gdb/aarch64-tdep.c | 13 ++++++++++++- gdb/aarch64-tdep.h | 4 ++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3e51f87d055..635f02523b1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2018-06-11 Alan Hayward + + * aarch64-tdep.c (aarch64_dwarf_reg_to_regnum): Add mappings. + * aarch64-tdep.h (AARCH64_DWARF_SVE_VG): Add define. + (AARCH64_DWARF_SVE_FFR): Likewise. + (AARCH64_DWARF_SVE_P0): Likewise. + (AARCH64_DWARF_SVE_Z0): Likewise. + 2018-06-11 Alan Hayward * common/common-regcache.h (raw_compare): New function. diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 5380baab9e1..5120fffe776 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -1805,9 +1805,20 @@ aarch64_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg) if (reg >= AARCH64_DWARF_V0 && reg <= AARCH64_DWARF_V0 + 31) return AARCH64_V0_REGNUM + reg - AARCH64_DWARF_V0; + if (reg == AARCH64_DWARF_SVE_VG) + return AARCH64_SVE_VG_REGNUM; + + if (reg == AARCH64_DWARF_SVE_FFR) + return AARCH64_SVE_FFR_REGNUM; + + if (reg >= AARCH64_DWARF_SVE_P0 && reg <= AARCH64_DWARF_SVE_P0 + 15) + return AARCH64_SVE_P0_REGNUM + reg - AARCH64_DWARF_SVE_P0; + + if (reg >= AARCH64_DWARF_SVE_Z0 && reg <= AARCH64_DWARF_SVE_Z0 + 15) + return AARCH64_SVE_Z0_REGNUM + reg - AARCH64_DWARF_SVE_Z0; + return -1; } - /* Implement the "print_insn" gdbarch method. */ diff --git a/gdb/aarch64-tdep.h b/gdb/aarch64-tdep.h index 5a319551e6b..7e5031f0fd5 100644 --- a/gdb/aarch64-tdep.h +++ b/gdb/aarch64-tdep.h @@ -32,6 +32,10 @@ struct regset; #define AARCH64_DWARF_X0 0 #define AARCH64_DWARF_SP 31 #define AARCH64_DWARF_V0 64 +#define AARCH64_DWARF_SVE_VG 46 +#define AARCH64_DWARF_SVE_FFR 47 +#define AARCH64_DWARF_SVE_P0 48 +#define AARCH64_DWARF_SVE_Z0 96 /* Size of integer registers. */ #define X_REGISTER_SIZE 8 -- 2.30.2