sim/erc32: Use memory_iread() function for instruction fetching.
[deliverable/binutils-gdb.git] / sim / erc32 / interf.c
index e2db44ea7fbf4e3f5e617e85d52ba313834ef934..59fb635b9e981cee1b577cb161fdb571b90177f0 100644 (file)
@@ -24,7 +24,6 @@
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <time.h>
 #include <sys/fcntl.h>
 #include "sis.h"
 #include "libiberty.h"
@@ -76,8 +75,10 @@ run_sim(sregs, icount, dis)
        (*sim_callback->printf_filtered) (sim_callback, "resuming at %x\n",
                                          sregs->pc);
    init_stdio();
-   sregs->starttime = time(NULL);
+   sregs->starttime = get_time();
    irq = 0;
+   if ((sregs->pc != 0) && (ebase.simtime == 0))
+       boot_init();
    while (!sregs->err_mode & (icount > 0)) {
 
        sregs->fhold = 0;
@@ -94,9 +95,8 @@ run_sim(sregs, icount, dis)
             if (sregs->pc == 0 || sregs->npc == 0)
                 printf ("bogus pc or npc\n");
 #endif
-        mexc = memory_read(sregs->asi, sregs->pc, &sregs->inst,
-                           2, &sregs->hold);
-#if 1  /* DELETE ME! for debugging purposes only */
+        mexc = memory_iread (sregs->pc, &sregs->inst, &sregs->hold);
+#if 0  /* DELETE ME! for debugging purposes only */
         if (sis_verbose > 2)
             printf("pc %x, np %x, sp %x, fp %x, wm %x, cw %x, i %08x\n",
                    sregs->pc, sregs->npc,
@@ -124,7 +124,7 @@ run_sim(sregs, icount, dis)
                         sim_halt();
                        restore_stdio();
                        clearerr(stdin);
-                       return (BPT_HIT);
+                       return BPT_HIT;
                    } else
                        dispatch_instruction(sregs);
                }
@@ -141,37 +141,24 @@ run_sim(sregs, icount, dis)
        }
     }
     sim_halt();
-    sregs->tottime += time(NULL) - sregs->starttime;
+    sregs->tottime += get_time() - sregs->starttime;
     restore_stdio();
     clearerr(stdin);
     if (sregs->err_mode)
        error_mode(sregs->pc);
     if (sregs->err_mode)
-       return (ERROR);
+       return ERROR;
     if (sregs->bphit) {
        if (sis_verbose)
            (*sim_callback->printf_filtered) (sim_callback,
                                              "HW BP hit at %x\n", sregs->pc);
-       return (BPT_HIT);
+       return BPT_HIT;
     }
     if (ctrl_c) {
        ctrl_c = 0;
-       return (CTRL_C);
+       return CTRL_C;
     }
-    return (TIME_OUT);
-}
-
-void
-sim_set_callbacks (ptr)
-     host_callback *ptr;
-{
-  sim_callback = ptr;
-}
-
-void
-sim_size (memsize)
-     int memsize;
-{
+    return TIME_OUT;
 }
 
 SIM_DESC
@@ -290,7 +277,7 @@ sim_close(sd, quitting)
 SIM_RC
 sim_load(sd, prog, abfd, from_tty)
      SIM_DESC sd;
-     char *prog;
+     const char *prog;
      bfd *abfd;
      int from_tty;
 {
@@ -355,7 +342,7 @@ sim_write(sd, mem, buf, length)
     const unsigned char  *buf;
     int             length;
 {
-    return (sis_memory_write(mem, buf, length));
+    return sis_memory_write (mem, buf, length);
 }
 
 int
@@ -365,7 +352,7 @@ sim_read(sd, mem, buf, length)
      unsigned char *buf;
      int length;
 {
-    return (sis_memory_read(mem, buf, length));
+    return sis_memory_read (mem, buf, length);
 }
 
 void
@@ -467,19 +454,10 @@ sim_resume(SIM_DESC sd, int step, int siggnal)
     if (sis_gdb_break) flush_windows ();
 }
 
-int
-sim_trace (sd)
-     SIM_DESC sd;
-{
-  /* FIXME: unfinished */
-  sim_resume (sd, 0, 0);
-  return 1;
-}
-
 void
 sim_do_command(sd, cmd)
      SIM_DESC sd;
-    char           *cmd;
+     const char *cmd;
 {
     exec_cmd(&sregs, cmd);
 }
This page took 0.025245 seconds and 4 git commands to generate.