aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Hayward <alan.hayward@arm.com>2017-10-25 09:06:41 +0100
committerAlan Hayward <alan.hayward@arm.com>2017-10-25 09:06:41 +0100
commitcc628f3dbb12c720dbc9ab714feeb197dc739944 (patch)
treedd2d0839d2b45b5a6c8078f72339039cc4f29ad0
parente601d38b7cc222345d4128f45db18529b9fb477b (diff)
downloadgdb-cc628f3dbb12c720dbc9ab714feeb197dc739944.zip
gdb-cc628f3dbb12c720dbc9ab714feeb197dc739944.tar.gz
gdb-cc628f3dbb12c720dbc9ab714feeb197dc739944.tar.bz2
Add common AARCH64 REGNUM defines
gdb/ * aarch64-tdep.h (enum aarch64_regnum): Remove. * arch/aarch64.h: New file. gdbserver/ * linux-aarch64-low.c (aarch64_fill_gregset): Replace defines with REGNO. (aarch64_store_gregset): Likewise. (aarch64_fill_fpregset): Likewise. (aarch64_store_fpregset): Likewise.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/aarch64-tdep.h28
-rw-r--r--gdb/arch/aarch64.h47
-rw-r--r--gdb/gdbserver/ChangeLog8
-rw-r--r--gdb/gdbserver/linux-aarch64-low.c41
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, &regset->regs[i]);
- collect_register (regcache, AARCH64_SP_REGNO, &regset->sp);
- collect_register (regcache, AARCH64_PC_REGNO, &regset->pc);
- collect_register (regcache, AARCH64_CPSR_REGNO, &regset->pstate);
+ collect_register (regcache, AARCH64_X0_REGNUM + i, &regset->regs[i]);
+ collect_register (regcache, AARCH64_SP_REGNUM, &regset->sp);
+ collect_register (regcache, AARCH64_PC_REGNUM, &regset->pc);
+ collect_register (regcache, AARCH64_CPSR_REGNUM, &regset->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, &regset->regs[i]);
- supply_register (regcache, AARCH64_SP_REGNO, &regset->sp);
- supply_register (regcache, AARCH64_PC_REGNO, &regset->pc);
- supply_register (regcache, AARCH64_CPSR_REGNO, &regset->pstate);
+ supply_register (regcache, AARCH64_X0_REGNUM + i, &regset->regs[i]);
+ supply_register (regcache, AARCH64_SP_REGNUM, &regset->sp);
+ supply_register (regcache, AARCH64_PC_REGNUM, &regset->pc);
+ supply_register (regcache, AARCH64_CPSR_REGNUM, &regset->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, &regset->vregs[i]);
- collect_register (regcache, AARCH64_FPSR_REGNO, &regset->fpsr);
- collect_register (regcache, AARCH64_FPCR_REGNO, &regset->fpcr);
+ collect_register (regcache, AARCH64_V0_REGNUM + i, &regset->vregs[i]);
+ collect_register (regcache, AARCH64_FPSR_REGNUM, &regset->fpsr);
+ collect_register (regcache, AARCH64_FPCR_REGNUM, &regset->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, &regset->vregs[i]);
- supply_register (regcache, AARCH64_FPSR_REGNO, &regset->fpsr);
- supply_register (regcache, AARCH64_FPCR_REGNO, &regset->fpcr);
+ supply_register (regcache, AARCH64_V0_REGNUM + i, &regset->vregs[i]);
+ supply_register (regcache, AARCH64_FPSR_REGNUM, &regset->fpsr);
+ supply_register (regcache, AARCH64_FPCR_REGNUM, &regset->fpcr);
}
/* Enable miscellaneous debugging output. The name is historical - it