* alpha-tdep.c (alpha_supply_int_regs, alpha_fill_int_regs,
[deliverable/binutils-gdb.git] / gdb / gdbserver / linux-arm-low.c
index c01f97ad8931fe8459b9f738a9d276ebb9788295..1267e1d8a000cd0d442ac7dac6769553c079e011 100644 (file)
@@ -1,7 +1,6 @@
 /* GNU/Linux/ARM specific low level interface, for the remote server for GDB.
    Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-   2006
-   Free Software Foundation, Inc.
+   2006, 2007 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 #define PTRACE_GET_THREAD_AREA 22
 #endif
 
+#ifndef PTRACE_GETWMMXREGS
+# define PTRACE_GETWMMXREGS 18
+# define PTRACE_SETWMMXREGS 19
+#endif
+
 #ifdef HAVE_SYS_REG_H
 #include <sys/reg.h>
 #endif
@@ -56,6 +60,60 @@ arm_cannot_fetch_register (int regno)
   return (regno >= arm_num_regs);
 }
 
+static void
+arm_fill_gregset (void *buf)
+{
+  int i;
+
+  for (i = 0; i < arm_num_regs; i++)
+    if (arm_regmap[i] != -1)
+      collect_register (i, ((char *) buf) + arm_regmap[i]);
+}
+
+static void
+arm_store_gregset (const void *buf)
+{
+  int i;
+  char zerobuf[8];
+
+  memset (zerobuf, 0, 8);
+  for (i = 0; i < arm_num_regs; i++)
+    if (arm_regmap[i] != -1)
+      supply_register (i, ((char *) buf) + arm_regmap[i]);
+    else
+      supply_register (i, zerobuf);
+}
+
+#ifdef __IWMMXT__
+
+static void
+arm_fill_wmmxregset (void *buf)
+{
+  int i;
+
+  for (i = 0; i < 16; i++)
+    collect_register (arm_num_regs + i, (char *) buf + i * 8);
+
+  /* We only have access to wcssf, wcasf, and wcgr0-wcgr3.  */
+  for (i = 0; i < 6; i++)
+    collect_register (arm_num_regs + i + 16, (char *) buf + 16 * 8 + i * 4);
+}
+
+static void
+arm_store_wmmxregset (const void *buf)
+{
+  int i;
+
+  for (i = 0; i < 16; i++)
+    supply_register (arm_num_regs + i, (char *) buf + i * 8);
+
+  /* We only have access to wcssf, wcasf, and wcgr0-wcgr3.  */
+  for (i = 0; i < 6; i++)
+    supply_register (arm_num_regs + i + 16, (char *) buf + 16 * 8 + i * 4);
+}
+
+#endif /* __IWMMXT__ */
+
 extern int debug_threads;
 
 static CORE_ADDR
@@ -131,6 +189,18 @@ ps_get_thread_area (const struct ps_prochandle *ph,
   return PS_OK;
 }
 
+struct regset_info target_regsets[] = {
+  { PTRACE_GETREGS, PTRACE_SETREGS, 18 * 4,
+    GENERAL_REGS,
+    arm_fill_gregset, arm_store_gregset },
+#ifdef __IWMMXT__
+  { PTRACE_GETWMMXREGS, PTRACE_SETWMMXREGS, 16 * 8 + 6 * 4,
+    EXTENDED_REGS,
+    arm_fill_wmmxregset, arm_store_wmmxregset },
+#endif
+  { 0, 0, -1, -1, NULL, NULL }
+};
+
 struct linux_target_ops the_low_target = {
   arm_num_regs,
   arm_regmap,
This page took 0.02523 seconds and 4 git commands to generate.