Fix PR gdb/778
[deliverable/binutils-gdb.git] / gdb / sparc-nat.c
index feee2cc22fe61e2e4b130812c585369fafc63adb..e892fe8fbda13478d0c314653454c57c0892af01 100644 (file)
@@ -25,6 +25,9 @@
 #include "gdbcore.h"
 #include "regcache.h"
 
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
 #include <signal.h>
 #include <sys/ptrace.h>
 #include <sys/wait.h>
@@ -45,8 +48,6 @@
 #define        STACK_REGS      2
 #define        FP_REGS         4
 
-static void fetch_core_registers (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.  */
@@ -122,15 +123,15 @@ fetch_inferior_registers (int regno)
      all (16 ptrace calls!) if we really need them.  */
   if (regno == -1)
     {
-      target_read_memory (*(CORE_ADDR *) & registers[REGISTER_BYTE (SP_REGNUM)],
-                         &registers[REGISTER_BYTE (L0_REGNUM)],
+      CORE_ADDR sp = *(unsigned int *) & registers[REGISTER_BYTE (SP_REGNUM)];
+      target_read_memory (sp, &registers[REGISTER_BYTE (L0_REGNUM)],
                          16 * REGISTER_RAW_SIZE (L0_REGNUM));
       for (i = L0_REGNUM; i <= I7_REGNUM; i++)
        register_valid[i] = 1;
     }
   else if (regno >= L0_REGNUM && regno <= I7_REGNUM)
     {
-      CORE_ADDR sp = *(CORE_ADDR *) & registers[REGISTER_BYTE (SP_REGNUM)];
+      CORE_ADDR sp = *(unsigned int *) & registers[REGISTER_BYTE (SP_REGNUM)];
       i = REGISTER_BYTE (regno);
       if (register_valid[regno])
        printf_unfiltered ("register %d valid and read\n", regno);
@@ -154,21 +155,23 @@ store_inferior_registers (int regno)
   /* First decide which pieces of machine-state we need to modify.  
      Default for regno == -1 case is all pieces.  */
   if (regno >= 0)
-    if (FP0_REGNUM <= regno && regno < FP0_REGNUM + 32)
-      {
-       wanna_store = FP_REGS;
-      }
-    else
-      {
-       if (regno == SP_REGNUM)
-         wanna_store = INT_REGS + STACK_REGS;
-       else if (regno < L0_REGNUM || regno > I7_REGNUM)
-         wanna_store = INT_REGS;
-       else if (regno == FPS_REGNUM)
+    {
+      if (FP0_REGNUM <= regno && regno < FP0_REGNUM + 32)
+       {
          wanna_store = FP_REGS;
-       else
-         wanna_store = STACK_REGS;
-      }
+       }
+      else
+       {
+         if (regno == SP_REGNUM)
+           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;
+       }
+    }
 
   /* See if we're forcing the stores to happen now, or deferring. */
   if (regno == -2)
@@ -192,7 +195,7 @@ store_inferior_registers (int regno)
 
   if (wanna_store & STACK_REGS)
     {
-      CORE_ADDR sp = *(CORE_ADDR *) & registers[REGISTER_BYTE (SP_REGNUM)];
+      CORE_ADDR sp = *(unsigned int *) & registers[REGISTER_BYTE (SP_REGNUM)];
 
       if (regno < 0 || regno == SP_REGNUM)
        {
This page took 0.024837 seconds and 4 git commands to generate.