aboutsummaryrefslogtreecommitdiff
path: root/gdb/arm-tdep.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2002-06-12 21:19:43 +0000
committerAndrew Cagney <cagney@redhat.com>2002-06-12 21:19:43 +0000
commit26216b98222fd93bf11128859575552d180d0576 (patch)
treef3d46998c54fe5e44afa3f6e225222b1ccdadf36 /gdb/arm-tdep.c
parent9b17aab6276db153d0fb91e347ed74cc2586b06c (diff)
downloadgdb-26216b98222fd93bf11128859575552d180d0576.zip
gdb-26216b98222fd93bf11128859575552d180d0576.tar.gz
gdb-26216b98222fd93bf11128859575552d180d0576.tar.bz2
Add the file include/gdb/sim-arm.h defining an enum that specifies the
register numbering used by the GDB<->SIM interface.
Diffstat (limited to 'gdb/arm-tdep.c')
-rw-r--r--gdb/arm-tdep.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 1ce0a5b..f4b84fa 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -36,11 +36,14 @@
#include "solib-svr4.h"
#include "arm-tdep.h"
+#include "gdb/sim-arm.h"
#include "elf-bfd.h"
#include "coff/internal.h"
#include "elf/arm.h"
+#include "gdb_assert.h"
+
/* Each OS has a different mechanism for accessing the various
registers stored in the sigcontext structure.
@@ -1636,6 +1639,27 @@ arm_register_virtual_size (int regnum)
return STATUS_REGISTER_SIZE;
}
+/* Map GDB internal REGNUM onto the Arm simulator register numbers. */
+static int
+arm_register_sim_regno (int regnum)
+{
+ int reg = regnum;
+ gdb_assert (reg >= 0 && reg < NUM_REGS);
+
+ if (reg < NUM_GREGS)
+ return SIM_ARM_R0_REGNUM + reg;
+ reg -= NUM_GREGS;
+
+ if (reg < NUM_FREGS)
+ return SIM_ARM_FP0_REGNUM + reg;
+ reg -= NUM_FREGS;
+
+ if (reg < NUM_SREGS)
+ return SIM_ARM_FPS_REGNUM + reg;
+ reg -= NUM_SREGS;
+
+ internal_error (__FILE__, __LINE__, "Bad REGNUM %d", regnum);
+}
/* NOTE: cagney/2001-08-20: Both convert_from_extended() and
convert_to_extended() use floatformat_arm_ext_littlebyte_bigword.
@@ -2870,6 +2894,9 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_max_register_virtual_size (gdbarch, FP_REGISTER_VIRTUAL_SIZE);
set_gdbarch_register_virtual_type (gdbarch, arm_register_type);
+ /* Internal <-> external register number maps. */
+ set_gdbarch_register_sim_regno (gdbarch, arm_register_sim_regno);
+
/* Integer registers are 4 bytes. */
set_gdbarch_register_size (gdbarch, 4);
set_gdbarch_register_name (gdbarch, arm_register_name);