aboutsummaryrefslogtreecommitdiff
path: root/gdb/alpha-linux-nat.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/alpha-linux-nat.c')
-rw-r--r--gdb/alpha-linux-nat.c80
1 files changed, 75 insertions, 5 deletions
diff --git a/gdb/alpha-linux-nat.c b/gdb/alpha-linux-nat.c
index 0186a94..8307a69 100644
--- a/gdb/alpha-linux-nat.c
+++ b/gdb/alpha-linux-nat.c
@@ -21,15 +21,85 @@
#include "defs.h"
#include "target.h"
#include "linux-nat.h"
-#include "gdbcore.h"
+
+#include "alpha-tdep.h"
+
+#include <sys/ptrace.h>
+#include <alpha/ptrace.h>
+
+#include <sys/procfs.h>
+#include "gregset.h"
+
+/* Given a pointer to either a gregset_t or fpregset_t, return a
+ pointer to the first register. */
+#define ALPHA_REGSET_BASE(regsetp) ((long *) (regsetp))
+
+/* Given a pointer to a gregset_t, locate the UNIQUE value. */
+#define ALPHA_REGSET_UNIQUE(regsetp) ((long *)(regsetp) + 32)
+
+/* The address of UNIQUE for ptrace. */
+#define ALPHA_UNIQUE_PTRACE_ADDR 65
+
+
+/*
+ * See the comment in m68k-tdep.c regarding the utility of these functions.
+ */
+
+void
+supply_gregset (gdb_gregset_t *gregsetp)
+{
+ long *regp = ALPHA_REGSET_BASE (gregsetp);
+ void *unique = ALPHA_REGSET_UNIQUE (gregsetp);
+
+ /* PC is in slot 32. */
+ alpha_supply_int_regs (-1, regp, regp + 31, unique);
+}
+
+void
+fill_gregset (gdb_gregset_t *gregsetp, int regno)
+{
+ long *regp = ALPHA_REGSET_BASE (gregsetp);
+ void *unique = ALPHA_REGSET_UNIQUE (gregsetp);
+
+ /* PC is in slot 32. */
+ alpha_fill_int_regs (regno, regp, regp + 31, unique);
+}
+
+/*
+ * Now we do the same thing for floating-point registers.
+ * Again, see the comments in m68k-tdep.c.
+ */
+
+void
+supply_fpregset (gdb_fpregset_t *fpregsetp)
+{
+ long *regp = ALPHA_REGSET_BASE (fpregsetp);
+
+ /* FPCR is in slot 32. */
+ alpha_supply_fp_regs (-1, regp, regp + 31);
+}
+
+void
+fill_fpregset (gdb_fpregset_t *fpregsetp, int regno)
+{
+ long *regp = ALPHA_REGSET_BASE (fpregsetp);
+
+ /* FPCR is in slot 32. */
+ alpha_fill_fp_regs (regno, regp, regp + 31);
+}
+
static CORE_ADDR
alpha_linux_register_u_offset (int regno)
{
- /* FIXME drow/2005-09-04: The hardcoded use of register_addr should go
- away. This requires disentangling the various definitions of it
- (particularly alpha-nat.c's). */
- return register_addr (regno, 0);
+ if (regno == PC_REGNUM)
+ return PC;
+ if (regno == ALPHA_UNIQUE_REGNUM)
+ return ALPHA_UNIQUE_PTRACE_ADDR;
+ if (regno < FP0_REGNUM)
+ return GPR_BASE + regno;
+ else
+ return FPR_BASE + regno - FP0_REGNUM;
}
void _initialialize_alpha_linux_nat (void);