Remove i386_elf_emit_arch_note
[deliverable/binutils-gdb.git] / sim / ppc / sim_calls.c
index 15df3c50d01e495a1e280d29a9c17e02cf0434d7..4e61335c2d4e5b7b48cb1381a58cded60d4e4491 100644 (file)
@@ -1,10 +1,10 @@
 /*  This file is part of the program psim.
 
 /*  This file is part of the program psim.
 
-    Copyright (C) 1994-1996,1998, Andrew Cagney <cagney@highland.com.au>
+    Copyright 1994, 1995, 1996, 1998, 2003 Andrew Cagney
 
     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
 
     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
+    the Free 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,
     (at your option) any later version.
 
     This program is distributed in the hope that it will be useful,
@@ -13,8 +13,7 @@
     GNU General Public License for more details.
  
     You should have received a copy of the GNU General Public License
     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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+    along with this program; if not, see <http://www.gnu.org/licenses/>.
  
     */
 
  
     */
 
 #endif
 #endif
 
 #endif
 #endif
 
-#include "defs.h"
+#include "libiberty.h"
 #include "bfd.h"
 #include "bfd.h"
-#include "callback.h"
-#include "remote-sim.h"
+#include "gdb/callback.h"
+#include "gdb/remote-sim.h"
+#include "gdb/signals.h"
 
 /* Define the rate at which the simulator should poll the host
    for a quit. */
 
 /* Define the rate at which the simulator should poll the host
    for a quit. */
@@ -55,31 +55,14 @@ static int poll_quit_count = POLL_QUIT_INTERVAL;
 
 /* Structures used by the simulator, for gdb just have static structures */
 
 
 /* Structures used by the simulator, for gdb just have static structures */
 
-static psim *simulator;
+psim *simulator;
 static device *root_device;
 static host_callback *callbacks;
 
 static device *root_device;
 static host_callback *callbacks;
 
-/* We use GDB's reg_names array to map GDB register numbers onto
-   names, which we can then look up in the register table.
-
-   We used to just use the REGISTER_NAMES macro, from GDB's
-   target-dependent header files.  That was kind of nice, because it
-   meant that libsim.a had only a compile-time dependency on GDB;
-   using reg_names directly means that there are now link-time and
-   run-time dependencies too.
-
-   However, the GDB PPC back-end now modifies the reg_names array when
-   the user runs the `set processor' command, which affects the
-   meanings of the register numbers.  So the sim needs to see the
-   register names GDB is actually using.
-
-   Perhaps the host_callback structure could contain a pointer to the
-   register name table; that would be cleaner.  */
-
 SIM_DESC
 sim_open (SIM_OPEN_KIND kind,
          host_callback *callback,
 SIM_DESC
 sim_open (SIM_OPEN_KIND kind,
          host_callback *callback,
-         struct _bfd *abfd,
+         struct bfd *abfd,
          char **argv)
 {
   callbacks = callback;
          char **argv)
 {
   callbacks = callback;
@@ -114,7 +97,7 @@ sim_close (SIM_DESC sd, int quitting)
 
 
 SIM_RC
 
 
 SIM_RC
-sim_load (SIM_DESC sd, char *prog, bfd *abfd, int from_tty)
+sim_load (SIM_DESC sd, const char *prog, bfd *abfd, int from_tty)
 {
   TRACE(trace_gdb, ("sim_load(prog=%s, from_tty=%d) called\n",
                    prog, from_tty));
 {
   TRACE(trace_gdb, ("sim_load(prog=%s, from_tty=%d) called\n",
                    prog, from_tty));
@@ -160,7 +143,7 @@ sim_read (SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length)
 
 
 int
 
 
 int
-sim_write (SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length)
+sim_write (SIM_DESC sd, SIM_ADDR mem, const unsigned char *buf, int length)
 {
   int result = psim_write_memory(simulator, MAX_NR_PROCESSORS,
                                 buf, mem, length,
 {
   int result = psim_write_memory(simulator, MAX_NR_PROCESSORS,
                                 buf, mem, length,
@@ -170,56 +153,6 @@ sim_write (SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length)
   return result;
 }
 
   return result;
 }
 
-
-int
-sim_fetch_register (SIM_DESC sd, int regno, unsigned char *buf, int length)
-{
-  char *regname;
-
-  if (simulator == NULL) {
-    return 0;
-  }
-
-  /* GDB will sometimes ask for the contents of a register named "";
-     we ignore such requests, and leave garbage in *BUF.  In
-     REG_NAMES, the empty string means "the register with this
-     number is not present in the currently selected architecture
-     variant."  That's following the kludge we're using for the MIPS
-     processors.  But there are loops that just walk through the
-     entire list of names and try to get everything.  */
-  regname = REGISTER_NAME (regno);
-  if (! regname || regname[0] == '\0')
-    return -1;
-
-  TRACE(trace_gdb, ("sim_fetch_register(regno=%d(%s), buf=0x%lx)\n",
-                   regno, regname, (long)buf));
-  psim_read_register(simulator, MAX_NR_PROCESSORS,
-                    buf, regname, raw_transfer);
-  return -1;
-}
-
-
-int
-sim_store_register (SIM_DESC sd, int regno, unsigned char *buf, int length)
-{
-  char *regname;
-
-  if (simulator == NULL)
-    return 0;
-
-  /* See comments in sim_fetch_register, above.  */
-  regname = REGISTER_NAME (regno);
-  if (! regname || regname[0] == '\0')
-    return -1;
-
-  TRACE(trace_gdb, ("sim_store_register(regno=%d(%s), buf=0x%lx)\n",
-                   regno, regname, (long)buf));
-  psim_write_register(simulator, MAX_NR_PROCESSORS,
-                     buf, regname, raw_transfer);
-  return -1;
-}
-
-
 void
 sim_info (SIM_DESC sd, int verbose)
 {
 void
 sim_info (SIM_DESC sd, int verbose)
 {
@@ -230,7 +163,7 @@ sim_info (SIM_DESC sd, int verbose)
 
 SIM_RC
 sim_create_inferior (SIM_DESC sd,
 
 SIM_RC
 sim_create_inferior (SIM_DESC sd,
-                    struct _bfd *abfd,
+                    struct bfd *abfd,
                     char **argv,
                     char **envp)
 {
                     char **argv,
                     char **envp)
 {
@@ -249,8 +182,8 @@ sim_create_inferior (SIM_DESC sd,
   psim_init(simulator);
   psim_stack(simulator, argv, envp);
 
   psim_init(simulator);
   psim_stack(simulator, argv, envp);
 
-  psim_write_register(simulator, -1 /* all start at same PC */,
-                     &entry_point, "pc", cooked_transfer);
+  ASSERT (psim_write_register(simulator, -1 /* all start at same PC */,
+                             &entry_point, "pc", cooked_transfer) > 0);
   return SIM_RC_OK;
 }
 
   return SIM_RC_OK;
 }
 
@@ -264,13 +197,13 @@ sim_stop_reason (SIM_DESC sd, enum sim_stop *reason, int *sigrc)
   case was_continuing:
     *reason = sim_stopped;
     if (status.signal == 0)
   case was_continuing:
     *reason = sim_stopped;
     if (status.signal == 0)
-      *sigrc = SIGTRAP;
+      *sigrc = GDB_SIGNAL_TRAP;
     else
       *sigrc = status.signal;
     break;
   case was_trap:
     *reason = sim_stopped;
     else
       *sigrc = status.signal;
     break;
   case was_trap:
     *reason = sim_stopped;
-    *sigrc = SIGTRAP;
+    *sigrc = GDB_SIGNAL_TRAP;
     break;
   case was_exited:
     *reason = sim_exited;
     break;
   case was_exited:
     *reason = sim_exited;
@@ -314,7 +247,7 @@ sim_resume (SIM_DESC sd, int step, int siggnal)
 }
 
 void
 }
 
 void
-sim_do_command (SIM_DESC sd, char *cmd)
+sim_do_command (SIM_DESC sd, const char *cmd)
 {
   TRACE(trace_gdb, ("sim_do_commands(cmd=%s) called\n",
                    cmd ? cmd : "(null)"));
 {
   TRACE(trace_gdb, ("sim_do_commands(cmd=%s) called\n",
                    cmd ? cmd : "(null)"));
@@ -325,6 +258,11 @@ sim_do_command (SIM_DESC sd, char *cmd)
   }
 }
 
   }
 }
 
+char **
+sim_complete_command (SIM_DESC sd, const char *text, const char *word)
+{
+  return NULL;
+}
 
 /* Polling, if required */
 
 
 /* Polling, if required */
 
@@ -435,6 +373,16 @@ sim_io_flush_stdoutput(void)
   }
 }
 
   }
 }
 
+void
+sim_io_error (SIM_DESC sd, const char *fmt, ...)
+{
+  va_list ap;
+  va_start(ap, fmt);
+  callbacks->evprintf_filtered (callbacks, fmt, ap);
+  va_end(ap);
+  callbacks->error (callbacks, "");
+}
+
 /****/
 
 void *
 /****/
 
 void *
@@ -446,8 +394,3 @@ zalloc(long size)
   memset(memory, 0, size);
   return memory;
 }
   memset(memory, 0, size);
   return memory;
 }
-
-void zfree(void *data)
-{
-  free(data);
-}
This page took 0.026776 seconds and 4 git commands to generate.