diff options
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/aarch64-tdep.h | 28 | ||||
-rw-r--r-- | gdb/arch/aarch64.h | 47 | ||||
-rw-r--r-- | gdb/gdbserver/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/gdbserver/linux-aarch64-low.c | 41 |
5 files changed, 77 insertions, 52 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7c792a3..2107679 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2017-10-25 Alan Hayward <alan.hayward@arm.com> + + * aarch64-tdep.h (enum aarch64_regnum): Remove. + * arch/aarch64.h: New file. + 2017-10-24 Ulrich Weigand <uweigand@de.ibm.com> * dfp.h (decimal_from_string): Use const reference for argument. diff --git a/gdb/aarch64-tdep.h b/gdb/aarch64-tdep.h index 85c6a97..2597443 100644 --- a/gdb/aarch64-tdep.h +++ b/gdb/aarch64-tdep.h @@ -22,6 +22,8 @@ #ifndef AARCH64_TDEP_H #define AARCH64_TDEP_H +#include "arch/aarch64.h" + /* Forward declarations. */ struct gdbarch; struct regset; @@ -31,32 +33,6 @@ struct regset; #define AARCH64_DWARF_SP 31 #define AARCH64_DWARF_V0 64 -/* Register numbers of various important registers. */ -enum aarch64_regnum -{ - AARCH64_X0_REGNUM, /* First integer register */ - - /* Frame register in AArch64 code, if used. */ - AARCH64_FP_REGNUM = AARCH64_X0_REGNUM + 29, - AARCH64_LR_REGNUM = AARCH64_X0_REGNUM + 30, /* Return address */ - AARCH64_SP_REGNUM, /* Stack pointer */ - AARCH64_PC_REGNUM, /* Program counter */ - AARCH64_CPSR_REGNUM, /* Contains status register */ - AARCH64_V0_REGNUM, /* First floating point / vector register */ - - /* Last floating point / vector register */ - AARCH64_V31_REGNUM = AARCH64_V0_REGNUM + 31, - AARCH64_FPSR_REGNUM, /* Floating point status register */ - AARCH64_FPCR_REGNUM, /* Floating point control register */ - - /* Other useful registers. */ - - /* Last integer-like argument */ - AARCH64_LAST_X_ARG_REGNUM = AARCH64_X0_REGNUM + 7, - AARCH64_STRUCT_RETURN_REGNUM = AARCH64_X0_REGNUM + 8, - AARCH64_LAST_V_ARG_REGNUM = AARCH64_V0_REGNUM + 7 -}; - /* Size of integer registers. */ #define X_REGISTER_SIZE 8 #define B_REGISTER_SIZE 1 diff --git a/gdb/arch/aarch64.h b/gdb/arch/aarch64.h new file mode 100644 index 0000000..b527405 --- /dev/null +++ b/gdb/arch/aarch64.h @@ -0,0 +1,47 @@ +/* Common target-dependent functionality for AArch64. + + Copyright (C) 2017 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#ifndef ARCH_AARCH64_H +#define ARCH_AARCH64_H + +/* Register numbers of various important registers. */ +enum aarch64_regnum +{ + AARCH64_X0_REGNUM, /* First integer register. */ + AARCH64_FP_REGNUM = AARCH64_X0_REGNUM + 29, /* Frame register, if used. */ + AARCH64_LR_REGNUM = AARCH64_X0_REGNUM + 30, /* Return address. */ + AARCH64_SP_REGNUM, /* Stack pointer. */ + AARCH64_PC_REGNUM, /* Program counter. */ + AARCH64_CPSR_REGNUM, /* Current Program Status Register. */ + AARCH64_V0_REGNUM, /* First fp/vec register. */ + AARCH64_V31_REGNUM = AARCH64_V0_REGNUM + 31, /* Last fp/vec register. */ + AARCH64_FPSR_REGNUM, /* Floating Point Status Register. */ + AARCH64_FPCR_REGNUM, /* Floating Point Control Register. */ + + /* Other useful registers. */ + AARCH64_LAST_X_ARG_REGNUM = AARCH64_X0_REGNUM + 7, + AARCH64_STRUCT_RETURN_REGNUM = AARCH64_X0_REGNUM + 8, + AARCH64_LAST_V_ARG_REGNUM = AARCH64_V0_REGNUM + 7 +}; + +#define AARCH64_X_REGS_NUM 31 +#define AARCH64_V_REGS_NUM 32 +#define AARCH64_NUM_REGS AARCH64_FPCR_REGNUM + 1 + +#endif /* ARCH_AARCH64_H */ diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 757265d..b314076 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,11 @@ +2017-10-25 Alan Hayward <alan.hayward@arm.com> + + * linux-aarch64-low.c (aarch64_fill_gregset): Replace defines + with REGNO. + (aarch64_store_gregset): Likewise. + (aarch64_fill_fpregset): Likewise. + (aarch64_store_fpregset): Likewise. + 2017-10-21 Simon Marchi <simon.marchi@ericsson.com> * gdbthread.h (find_thread, for_each_thread): New functions. diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c index 6d5c4e5..b00d5c5 100644 --- a/gdb/gdbserver/linux-aarch64-low.c +++ b/gdb/gdbserver/linux-aarch64-low.c @@ -38,6 +38,7 @@ #include <sys/uio.h> #include "gdb_proc_service.h" +#include "arch/aarch64.h" /* Defined in auto-generated files. */ void init_registers_aarch64 (void); @@ -47,18 +48,6 @@ extern const struct target_desc *tdesc_aarch64; #include <sys/reg.h> #endif -#define AARCH64_X_REGS_NUM 31 -#define AARCH64_V_REGS_NUM 32 -#define AARCH64_X0_REGNO 0 -#define AARCH64_SP_REGNO 31 -#define AARCH64_PC_REGNO 32 -#define AARCH64_CPSR_REGNO 33 -#define AARCH64_V0_REGNO 34 -#define AARCH64_FPSR_REGNO (AARCH64_V0_REGNO + AARCH64_V_REGS_NUM) -#define AARCH64_FPCR_REGNO (AARCH64_V0_REGNO + AARCH64_V_REGS_NUM + 1) - -#define AARCH64_NUM_REGS (AARCH64_V0_REGNO + AARCH64_V_REGS_NUM + 2) - /* Per-process arch-specific data we want to keep. */ struct arch_process_info @@ -109,10 +98,10 @@ aarch64_fill_gregset (struct regcache *regcache, void *buf) int i; for (i = 0; i < AARCH64_X_REGS_NUM; i++) - collect_register (regcache, AARCH64_X0_REGNO + i, ®set->regs[i]); - collect_register (regcache, AARCH64_SP_REGNO, ®set->sp); - collect_register (regcache, AARCH64_PC_REGNO, ®set->pc); - collect_register (regcache, AARCH64_CPSR_REGNO, ®set->pstate); + collect_register (regcache, AARCH64_X0_REGNUM + i, ®set->regs[i]); + collect_register (regcache, AARCH64_SP_REGNUM, ®set->sp); + collect_register (regcache, AARCH64_PC_REGNUM, ®set->pc); + collect_register (regcache, AARCH64_CPSR_REGNUM, ®set->pstate); } static void @@ -122,10 +111,10 @@ aarch64_store_gregset (struct regcache *regcache, const void *buf) int i; for (i = 0; i < AARCH64_X_REGS_NUM; i++) - supply_register (regcache, AARCH64_X0_REGNO + i, ®set->regs[i]); - supply_register (regcache, AARCH64_SP_REGNO, ®set->sp); - supply_register (regcache, AARCH64_PC_REGNO, ®set->pc); - supply_register (regcache, AARCH64_CPSR_REGNO, ®set->pstate); + supply_register (regcache, AARCH64_X0_REGNUM + i, ®set->regs[i]); + supply_register (regcache, AARCH64_SP_REGNUM, ®set->sp); + supply_register (regcache, AARCH64_PC_REGNUM, ®set->pc); + supply_register (regcache, AARCH64_CPSR_REGNUM, ®set->pstate); } static void @@ -135,9 +124,9 @@ aarch64_fill_fpregset (struct regcache *regcache, void *buf) int i; for (i = 0; i < AARCH64_V_REGS_NUM; i++) - collect_register (regcache, AARCH64_V0_REGNO + i, ®set->vregs[i]); - collect_register (regcache, AARCH64_FPSR_REGNO, ®set->fpsr); - collect_register (regcache, AARCH64_FPCR_REGNO, ®set->fpcr); + collect_register (regcache, AARCH64_V0_REGNUM + i, ®set->vregs[i]); + collect_register (regcache, AARCH64_FPSR_REGNUM, ®set->fpsr); + collect_register (regcache, AARCH64_FPCR_REGNUM, ®set->fpcr); } static void @@ -148,9 +137,9 @@ aarch64_store_fpregset (struct regcache *regcache, const void *buf) int i; for (i = 0; i < AARCH64_V_REGS_NUM; i++) - supply_register (regcache, AARCH64_V0_REGNO + i, ®set->vregs[i]); - supply_register (regcache, AARCH64_FPSR_REGNO, ®set->fpsr); - supply_register (regcache, AARCH64_FPCR_REGNO, ®set->fpcr); + supply_register (regcache, AARCH64_V0_REGNUM + i, ®set->vregs[i]); + supply_register (regcache, AARCH64_FPSR_REGNUM, ®set->fpsr); + supply_register (regcache, AARCH64_FPCR_REGNUM, ®set->fpcr); } /* Enable miscellaneous debugging output. The name is historical - it |