2013-03-23 Joel Sherrill <joel.sherrill@oarcorp.com>
[external/binutils.git] / sim / erc32 / interf.c
index d0a781e..e2db44e 100644 (file)
@@ -6,7 +6,7 @@
  * 
  * This program is free software; you can redistribute it and/or modify it under
  * the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
+ * Software Foundation; either version 3 of the License, or (at your option)
  * any later version.
  * 
  * This program is distributed in the hope that it will be useful, but WITHOUT
  * 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.
+ * this program; if not, see <http://www.gnu.org/licenses/>.
  * 
  */
 
+#include "config.h"
 #include <signal.h>
 #include <string.h>
 #include <stdio.h>
 #include <time.h>
 #include <sys/fcntl.h>
 #include "sis.h"
+#include "libiberty.h"
 #include "bfd.h"
 #include <dis-asm.h>
 #include "sim-config.h"
 
-#include "remote-sim.h"
-
-#ifndef fprintf
-extern          fprintf();
-#endif
+#include "gdb/remote-sim.h"
+#include "gdb/signals.h"
 
 #define PSR_CWP 0x7
 
-#define        VAL(x)  strtol(x,(char **)NULL,0)
-
-extern char   **buildargv(char *input);
-
 extern struct disassemble_info dinfo;
 extern struct pstate sregs;
 extern struct estate ebase;
@@ -73,7 +67,7 @@ host_callback *sim_callback;
 int
 run_sim(sregs, icount, dis)
     struct pstate  *sregs;
-    unsigned int    icount;
+    uint64          icount;
     int             dis;
 {
     int             mexc, irq;
@@ -184,7 +178,7 @@ SIM_DESC
 sim_open (kind, callback, abfd, argv)
      SIM_OPEN_KIND kind;
      struct host_callback_struct *callback;
-     struct _bfd *abfd;
+     struct bfd *abfd;
      char **argv;
 {
 
@@ -238,8 +232,11 @@ sim_open (kind, callback, abfd, argv)
            } else
            if (strcmp(argv[stat], "-freq") == 0) {
                if ((stat + 1) < argc) {
-                   freq = VAL(argv[++stat]);
+                   freq = strtol(argv[++stat], (char **)NULL, 0);
                }
+           } else
+           if (strncmp(argv[stat], "--sysroot=", sizeof("--sysroot=") - 1) == 0) {
+               /* Ignore until we start to support this.  */
            } else {
                (*sim_callback->printf_filtered) (sim_callback,
                                                  "unknown option %s\n",
@@ -304,7 +301,7 @@ sim_load(sd, prog, abfd, from_tty)
 SIM_RC
 sim_create_inferior(sd, abfd, argv, env)
      SIM_DESC sd;
-     struct _bfd *abfd;
+     struct bfd *abfd;
      char **argv;
      char **env;
 {
@@ -336,7 +333,7 @@ sim_store_register(sd, regno, value, length)
        regval = (value[3] << 24) | (value[2] << 16)
                 | (value[1] << 8) | value[0];
     set_regi(&sregs, regno, regval);
-    return -1;
+    return length;
 }
 
 
@@ -355,7 +352,7 @@ int
 sim_write(sd, mem, buf, length)
      SIM_DESC sd;
     SIM_ADDR             mem;
-    unsigned char  *buf;
+    const unsigned char  *buf;
     int             length;
 {
     return (sis_memory_write(mem, buf, length));
@@ -391,16 +388,13 @@ sim_stop_reason(sd, reason, sigrc)
     switch (simstat) {
        case CTRL_C:
        *reason = sim_stopped;
-       *sigrc = SIGINT;
+       *sigrc = GDB_SIGNAL_INT;
        break;
     case OK:
     case TIME_OUT:
     case BPT_HIT:
        *reason = sim_stopped;
-#ifdef _WIN32
-#define SIGTRAP 5
-#endif
-       *sigrc = SIGTRAP;
+       *sigrc = GDB_SIGNAL_TRAP;
        break;
     case ERROR:
        *sigrc = 0;
@@ -468,7 +462,7 @@ flush_windows ()
 void
 sim_resume(SIM_DESC sd, int step, int siggnal)
 {
-    simstat = run_sim(&sregs, -1, 0);
+    simstat = run_sim(&sregs, UINT64_MAX, 0);
 
     if (sis_gdb_break) flush_windows ();
 }
@@ -490,6 +484,12 @@ sim_do_command(sd, cmd)
     exec_cmd(&sregs, cmd);
 }
 
+char **
+sim_complete_command (SIM_DESC sd, const char *text, const char *word)
+{
+  return NULL;
+}
+
 #if 0 /* FIXME: These shouldn't exist.  */
 
 int