2009-11-05 Sebastian Pop <sebastian.pop@amd.com>
[deliverable/binutils-gdb.git] / sim / d10v / interp.c
index 30239ab0247a778f7ccb9e267eb4d869fc4afdbc..9caec412890acf8d9e9f40841f11369126b236cf 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "d10v_sim.h"
 #include "gdb/sim-d10v.h"
+#include "gdb/signals.h"
 
 enum _leftright { LEFT_FIRST, RIGHT_FIRST };
 
@@ -49,7 +50,7 @@ static INLINE uint8 *map_memory (unsigned phys_addr);
 static long ui_loop_hook_counter = UI_LOOP_POLL_INTERVAL;
 
 /* Actual hook to call to run through gdb's gui event loop */
-extern int (*ui_loop_hook) PARAMS ((int signo));
+extern int (*deprecated_ui_loop_hook) PARAMS ((int signo));
 #endif /* NEED_UI_LOOP_HOOK */
 
 #ifndef INLINE
@@ -720,49 +721,39 @@ xfer_mem (SIM_ADDR virt,
          int size,
          int write_p)
 {
-  int xfered = 0;
-
-  while (0 < size)
-    {
-      uint8 *memory;
-      unsigned long phys;
-      int phys_size;
-      phys_size = sim_d10v_translate_addr (virt, size, &phys, NULL,
-                                          dmap_register, imap_register);
-      if (phys_size == 0)
-       return xfered;
+  uint8 *memory;
+  unsigned long phys;
+  int phys_size;
+  phys_size = sim_d10v_translate_addr (virt, size, &phys, NULL,
+                                      dmap_register, imap_register);
+  if (phys_size == 0)
+    return 0;
 
-      memory = map_memory (phys);
+  memory = map_memory (phys);
 
 #ifdef DEBUG
-      if ((d10v_debug & DEBUG_INSTRUCTION) != 0)
-       {
-         (*d10v_callback->printf_filtered)
-           (d10v_callback,
-            "sim_%s %d bytes: 0x%08lx (%s) -> 0x%08lx (%s) -> 0x%08lx (%s)\n",
+  if ((d10v_debug & DEBUG_INSTRUCTION) != 0)
+    {
+      (*d10v_callback->printf_filtered)
+       (d10v_callback,
+        "sim_%s %d bytes: 0x%08lx (%s) -> 0x%08lx (%s) -> 0x%08lx (%s)\n",
             (write_p ? "write" : "read"),
-            phys_size, virt, last_from,
-            phys, last_to,
-            (long) memory, last_segname);
-       }
+        phys_size, virt, last_from,
+        phys, last_to,
+        (long) memory, last_segname);
+    }
 #endif
 
-      if (write_p)
-       {
-         memcpy (memory, buffer, phys_size);
-       }
-      else
-       {
-         memcpy (buffer, memory, phys_size);
-       }
-
-      virt += phys_size;
-      buffer += phys_size;
-      xfered += phys_size;
-      size -= phys_size;
+  if (write_p)
+    {
+      memcpy (memory, buffer, phys_size);
     }
-
-  return xfered;
+  else
+    {
+      memcpy (buffer, memory, phys_size);
+    }
+  
+  return phys_size;
 }
 
 
@@ -1071,10 +1062,10 @@ sim_resume (sd, step, siggnal)
       SLOT_FLUSH ();
 
 #ifdef NEED_UI_LOOP_HOOK
-      if (ui_loop_hook != NULL && ui_loop_hook_counter-- < 0)
+      if (deprecated_ui_loop_hook != NULL && ui_loop_hook_counter-- < 0)
        {
          ui_loop_hook_counter = UI_LOOP_POLL_INTERVAL;
-         ui_loop_hook (0);
+         deprecated_ui_loop_hook (0);
        }
 #endif /* NEED_UI_LOOP_HOOK */
     }
@@ -1287,17 +1278,13 @@ sim_stop_reason (sd, reason, sigrc)
 
     case SIG_D10V_BUS:
       *reason = sim_stopped;
-#ifdef SIGBUS
-      *sigrc = SIGBUS;
-#else
-      *sigrc = SIGSEGV;
-#endif
+      *sigrc = TARGET_SIGNAL_BUS;
       break;
 
     default:                           /* some signal */
       *reason = sim_stopped;
       if (stop_simulator && !State.exception)
-       *sigrc = SIGINT;
+       *sigrc = TARGET_SIGNAL_INT;
       else
        *sigrc = State.exception;
       break;
This page took 0.024627 seconds and 4 git commands to generate.