* mn10200.h (MN10200_OPERAND_NOCHECK): Define.
[deliverable/binutils-gdb.git] / gdb / sparc-nat.c
index 5fcdb92aad27b564a51c6ae4f4f811267c57a3c4..4c21c35730fdcc2cbef184f5b9b0de00d8f37a26 100644 (file)
@@ -1,5 +1,5 @@
-/* Functions specific to running gdb native on a Sun 4 running sunos4.
-   Copyright (C) 1989, 1992, Free Software Foundation, Inc.
+/* Functions specific to running gdb native on a SPARC running SunOS4.
+   Copyright 1989, 1992, 1993, 1994, 1996 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -15,16 +15,18 @@ 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, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
 #include "inferior.h"
 #include "target.h"
+#include "gdbcore.h"
 
 #include <signal.h>
 #include <sys/ptrace.h>
 #include <sys/wait.h>
 #include <machine/reg.h>
+#include <sys/user.h>
 
 /* We don't store all registers immediately when requested, since they
    get sent over in large chunks anyway.  Instead, we accumulate most
@@ -36,6 +38,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #define        STACK_REGS      2
 #define        FP_REGS         4
 
+static void
+fetch_core_registers PARAMS ((char *, unsigned int, int, CORE_ADDR));
+
 /* Fetch one or more registers from the inferior.  REGNO == -1 to get
    them all.  We actually fetch more than requested, when convenient,
    marking them as valid so we won't fetch them again.  */
@@ -85,12 +90,13 @@ fetch_inferior_registers (regno)
         all the regs every time it is called!  FIXME.  */
       register_valid[WIM_REGNUM] = 1;  /* Not true yet, FIXME */
       register_valid[TBR_REGNUM] = 1;  /* Not true yet, FIXME */
-      register_valid[FPS_REGNUM] = 1;  /* Not true yet, FIXME */
       register_valid[CPS_REGNUM] = 1;  /* Not true yet, FIXME */
     }
 
   /* Floating point registers */
-  if (regno == -1 || (regno >= FP0_REGNUM && regno <= FP0_REGNUM + 31))
+  if (regno == -1 ||
+      regno == FPS_REGNUM ||
+      (regno >= FP0_REGNUM && regno <= FP0_REGNUM + 31))
     {
       if (0 != ptrace (PTRACE_GETFPREGS, inferior_pid,
                       (PTRACE_ARG3_TYPE) &inferior_fp_registers,
@@ -153,6 +159,8 @@ store_inferior_registers (regno)
          wanna_store = INT_REGS + STACK_REGS;
        else if (regno < L0_REGNUM || regno > I7_REGNUM)
          wanna_store = INT_REGS;
+       else if (regno == FPS_REGNUM)
+         wanna_store = FP_REGS;
        else
          wanna_store = STACK_REGS;
       }
@@ -222,20 +230,10 @@ store_inferior_registers (regno)
   if (wanna_store & FP_REGS)
     {
       if (!register_valid[FP0_REGNUM+9]) abort();
-      /* Initialize inferior_fp_registers members that gdb doesn't set
-        by reading them from the inferior.  This may not be needed
-        any more, now that we set Fpu_fsr.  */
-      if (0 !=
-        ptrace (PTRACE_GETFPREGS, inferior_pid,
-                (PTRACE_ARG3_TYPE) &inferior_fp_registers, 0))
-        perror("ptrace_getfpregs");
-
       memcpy (&inferior_fp_registers, &registers[REGISTER_BYTE (FP0_REGNUM)],
              sizeof inferior_fp_registers.fpu_fr);
-
       memcpy (&inferior_fp_registers.Fpu_fsr, 
              &registers[REGISTER_BYTE (FPS_REGNUM)], sizeof (FPU_FSR_TYPE));
-
       if (0 !=
         ptrace (PTRACE_SETFPREGS, inferior_pid,
                 (PTRACE_ARG3_TYPE) &inferior_fp_registers, 0))
@@ -244,12 +242,12 @@ store_inferior_registers (regno)
 }
 
 
-void
+static void
 fetch_core_registers (core_reg_sect, core_reg_size, which, ignore)
   char *core_reg_sect;
   unsigned core_reg_size;
   int which;
-  unsigned int ignore; /* reg addr, unused in this version */
+  CORE_ADDR ignore;    /* reg addr, unused in this version */
 {
 
   if (which == 0) {
@@ -302,3 +300,25 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, ignore)
   }
 }
 
+int
+kernel_u_size ()
+{
+  return (sizeof (struct user));
+}
+
+\f
+/* Register that we are able to handle sparc core file formats.
+   FIXME: is this really bfd_target_unknown_flavour? */
+
+static struct core_fns sparc_core_fns =
+{
+  bfd_target_unknown_flavour,
+  fetch_core_registers,
+  NULL
+};
+
+void
+_initialize_core_sparc ()
+{
+  add_core_fns (&sparc_core_fns);
+}
This page took 0.033875 seconds and 4 git commands to generate.