]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Add LMA_P and DO_WRITE arguments to sim/common/sim-load.c:sim_load_file().
authorAndrew Cagney <cagney@redhat.com>
Wed, 22 Oct 1997 05:26:27 +0000 (05:26 +0000)
committerAndrew Cagney <cagney@redhat.com>
Wed, 22 Oct 1997 05:26:27 +0000 (05:26 +0000)
Update all simulators.
Clarify behavour of sim_load in remote-sim.h

include/remote-sim.h
sim/arm/ChangeLog
sim/arm/wrapper.c
sim/common/ChangeLog
sim/d10v/ChangeLog
sim/d10v/interp.c
sim/h8300/ChangeLog
sim/h8300/compile.c
sim/mn10300/ChangeLog
sim/sh/ChangeLog

index dc4997032bdd21851b6d3dfe4e4de8d55b9f0d08..d1ded53ea827d5853cc88ae9ddcda3e48232ba67 100644 (file)
@@ -121,14 +121,21 @@ void sim_close PARAMS ((SIM_DESC sd, int quitting));
    If ABFD is non-NULL, the bfd for the file has already been opened.
    The result is a return code indicating success.
 
-   Hardware simulator: A call to this function should not effect the
-   state of the processor registers.  Multiple calls to this function
-   are permitted and have an accumulative effect.
+   Hardware simulator: Normally, each program section is written into
+   memory according to that sections LMA using physical (direct)
+   addressing.  The exception being systems, such as PPC/CHRP, which
+   support more complicated program loaders.  A call to this function
+   should not effect the state of the processor registers.  Multiple
+   calls to this function are permitted and have an accumulative
+   effect.
 
    Process simulator: Calls to this function may be ignored.
 
-   FIXME: Some hardware targets, before a loaded program can be
-   executed, require the manipulation of VM registers and tables.
+   FIXME: Most hardware simulators load the image at the VMA using
+   virtual addressing.
+
+   FIXME: For some hardware targets, before a loaded program can be
+   executed, it requires the manipulation of VM registers and tables.
    Such manipulation should probably (?) occure in
    sim_create_inferior. */
 
index 2686fbfea33bc10d899d4ac40e9b39f6cd00dc38..5f11bb348cb2a21586667d1b6b3eb84ec8db149e 100644 (file)
@@ -1,3 +1,16 @@
+Wed Oct 22 14:43:00 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * wrapper.c (sim_load): Pass lma_p and sim_write args to
+       sim_load_file.
+
+Fri Oct  3 09:28:00 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Wed Sep 24 17:38:57 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * configure: Regenerated to track ../common/aclocal.m4 changes.
+
 Tue Sep 23 11:04:38 1997  Andrew Cagney  <cagney@b1.cygnus.com>
 
        * configure: Regenerated to track ../common/aclocal.m4 changes.
index 86be8c672b3350e3e684e563b777e72dc51c4d90..5c2eea0cfc4c132b7eb2b5261c258669fc70b24c 100644 (file)
@@ -175,11 +175,16 @@ sim_resume (sd, step, siggnal)
 }
 
 SIM_RC
-sim_create_inferior (sd, argv, env)
+sim_create_inferior (sd, abfd, argv, env)
      SIM_DESC sd;
+     struct _bfd *abfd;
      char **argv;
      char **env;
 {
+  if (abfd != NULL)
+    ARMul_SetPC (state, bfd_get_start_address (abfd));
+  else
+    ARMul_SetPC (state, 0); /* ??? */
   return SIM_RC_OK;
 }
 
@@ -290,10 +295,10 @@ sim_load (sd, prog, abfd, from_tty)
   bfd *prog_bfd;
 
   prog_bfd = sim_load_file (sd, myname, sim_callback, prog, abfd,
-                           sim_kind == SIM_OPEN_DEBUG);
+                           sim_kind == SIM_OPEN_DEBUG,
+                           0, sim_write);
   if (prog_bfd == NULL)
     return SIM_RC_FAIL;
-  ARMul_SetPC (state, bfd_get_start_address (prog_bfd));
   if (abfd == NULL)
     bfd_close (prog_bfd);
   return SIM_RC_OK;
index 77d62e4e43413801f2b822b48e1637622e075fdd..8e7f462ded7068bcfd96a5c743f5b7293998573c 100644 (file)
@@ -1,3 +1,10 @@
+Wed Oct 22 14:18:38 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * sim-hload.c (sim_load): Pass lma_p==0 and do_load=sim_load.
+
+       * sim-utils.h, sim-load.c (sim_load_file): Add lma_p and do_load
+       arguments.
+
 Tue Oct 21 18:37:57 1997  Doug Evans  <devans@canuck.cygnus.com>
 
        * nrun.c (main): Remove useless test of name != NULL.
index 3ee29c9bb4effea2909f597cd4eed3a4eb7132fa..bee6a0cfaaa9f6c7896998a982fb3ae78ed4bb7d 100644 (file)
@@ -1,3 +1,11 @@
+Wed Oct 22 14:43:00 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * interp.c (sim_write_phys): New function, write to physical
+       instead of virtual memory.
+       
+       * wrapper.c (sim_load): Pass lma_p and sim_write_phys to
+       sim_load_file.
+
 Mon Oct 13 10:55:07 1997  Fred Fish  <cygnus.com>
 
        * simops.c (OP_6A01): Change OP_POSTDEC to OP_POSTINC and move
index 5dfb100ab2613954284d6b0bdcd0f6177aea0c0d..76bb438a95098f41fa27d2b7749810f007886b07 100644 (file)
@@ -432,6 +432,16 @@ xfer_mem (addr, buffer, size, write)
 }
 
 
+static int
+sim_write_phys (sd, addr, buffer, size)
+     SIM_DESC sd;
+     SIM_ADDR addr;
+     unsigned char *buffer;
+     int size;
+{
+  return xfer_mem( addr, buffer, size, 1);
+}
+
 int
 sim_write (sd, addr, buffer, size)
      SIM_DESC sd;
@@ -439,6 +449,7 @@ sim_write (sd, addr, buffer, size)
      unsigned char *buffer;
      int size;
 {
+  /* FIXME: this should be performing a virtual transfer */
   return xfer_mem( addr, buffer, size, 1);
 }
 
@@ -449,6 +460,7 @@ sim_read (sd, addr, buffer, size)
      unsigned char *buffer;
      int size;
 {
+  /* FIXME: this should be performing a virtual transfer */
   return xfer_mem( addr, buffer, size, 0);
 }
 
@@ -600,6 +612,9 @@ pc_addr()
       return 0;
     }
 
+  /* Discard upper bit(s) of PC in case IMAP1 selects unified memory. */
+  pc &= (1 << UMEM_SIZE) - 1;
+
   return State.umem[imap & 0xff] + pc;
 }
 
@@ -664,7 +679,10 @@ sim_resume (sd, step, siggnal)
        {
          RPT_C -= 1;
          if (RPT_C == 0)
-           State.RP = 0;
+           {
+             State.RP = 0;
+             PC++;
+           }
          else
            PC = RPT_S;
        }
@@ -926,7 +944,8 @@ sim_load (sd, prog, abfd, from_tty)
   if (prog_bfd != NULL && prog_bfd_was_opened_p)
     bfd_close (prog_bfd);
   prog_bfd = sim_load_file (sd, myname, d10v_callback, prog, abfd,
-                           sim_kind == SIM_OPEN_DEBUG);
+                           sim_kind == SIM_OPEN_DEBUG,
+                           0, sim_write_phys);
   if (prog_bfd == NULL)
     return SIM_RC_FAIL;
   prog_bfd_was_opened_p = abfd == NULL;
index daefa6e267c6873323334f702674a6a9db0f695a..61ba892a79846711bd9137bef669ccb49beb0d8f 100644 (file)
@@ -1,3 +1,16 @@
+Wed Oct 22 14:43:00 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * wrapper.c (sim_load): Pass lma_p and sim_write args to
+       sim_load_file.
+
+Fri Oct  3 09:28:00 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Wed Sep 24 17:38:57 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * configure: Regenerated to track ../common/aclocal.m4 changes.
+
 Tue Sep 23 11:04:38 1997  Andrew Cagney  <cagney@b1.cygnus.com>
 
        * configure: Regenerated to track ../common/aclocal.m4 changes.
index 08dbbccd69edc2489d65bd4d656ce2bbb4a83c62..12f9d2910cdba8b0b03911ec5319d3f76e9c37fe 100644 (file)
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
+#ifdef HAVE_SYS_PARAM_H
 #include <sys/param.h>
+#endif
 #include "wait.h"
 #include "ansidecl.h"
 #include "bfd.h"
 #include "callback.h"
 #include "remote-sim.h"
 
+#ifndef SIGTRAP
+# define SIGTRAP 5
+#endif
+
 int debug;
 
 host_callback *sim_callback;
@@ -1269,7 +1275,10 @@ sim_resume (sd, step, siggnal)
          goto next;
 
        case O (O_SYSCALL, SB):
-         printf ("%c", cpu.regs[2]);
+         {
+           char c = cpu.regs[2];
+           sim_callback->write_stdout (sim_callback, &c, 1);
+         }
          goto next;
 
          ONOT (O_NOT, rd = ~rd; v = 0;);
@@ -1714,9 +1723,9 @@ sim_resume (sd, step, siggnal)
       ;
       /*      if (cpu.regs[8] ) abort(); */
 
-      if (poll_count++ > 100)
+      if (--poll_count < 0)
        {
-         poll_count = 0;
+         poll_count = 100;
          if ((*sim_callback->poll_quit) != NULL
              && (*sim_callback->poll_quit) (sim_callback))
            sim_stop (sd);
@@ -2108,7 +2117,8 @@ sim_load (sd, prog, abfd, from_tty)
   cpu.mask = memory_size - 1;
 
   if (sim_load_file (sd, myname, sim_callback, prog, prog_bfd,
-                    sim_kind == SIM_OPEN_DEBUG)
+                    sim_kind == SIM_OPEN_DEBUG,
+                    0, sim_write)
       == NULL)
     {
       /* Close the bfd if we opened it.  */
index 97170375072fef8bf1e83aa8fefbcdf9498763da..b90138ab0a24d3da0cdb58ff760c81de7d75e9d9 100644 (file)
@@ -1,3 +1,8 @@
+Wed Oct 22 14:43:00 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * wrapper.c (sim_load): Pass lma_p and sim_write args to
+       sim_load_file.
+
 Tue Oct 21 10:12:03 1997  Jeffrey A Law  (law@cygnus.com)
 
        * simops.c: Correctly handle register restores for "ret" and "retf"
index d4f2a7cb52537950bd1a420a44f5d157e680a2e2..546a90fabe5026b44b30da439ae6db640b1ccb18 100644 (file)
@@ -1,3 +1,16 @@
+Wed Oct 22 14:43:00 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * wrapper.c (sim_load): Pass lma_p and sim_write args to
+       sim_load_file.
+
+Fri Oct  3 09:28:00 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Wed Sep 24 17:38:57 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * configure: Regenerated to track ../common/aclocal.m4 changes.
+
 Tue Sep 23 11:04:38 1997  Andrew Cagney  <cagney@b1.cygnus.com>
 
        * configure: Regenerated to track ../common/aclocal.m4 changes.