aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>1997-10-22 05:26:27 +0000
committerAndrew Cagney <cagney@redhat.com>1997-10-22 05:26:27 +0000
commit9e03a68f136a021e7bfa9afb18ca4f170e949f80 (patch)
tree78c37915fae5528e6e3cba233bbecbd7c368fa39
parent2328ef1c9815f27863ca176608f87cd4c2ba3665 (diff)
downloadgdb-9e03a68f136a021e7bfa9afb18ca4f170e949f80.zip
gdb-9e03a68f136a021e7bfa9afb18ca4f170e949f80.tar.gz
gdb-9e03a68f136a021e7bfa9afb18ca4f170e949f80.tar.bz2
Add LMA_P and DO_WRITE arguments to sim/common/sim-load.c:sim_load_file().
Update all simulators. Clarify behavour of sim_load in remote-sim.h
-rw-r--r--include/remote-sim.h17
-rw-r--r--sim/arm/ChangeLog13
-rw-r--r--sim/arm/wrapper.c11
-rw-r--r--sim/common/ChangeLog7
-rw-r--r--sim/d10v/ChangeLog8
-rw-r--r--sim/d10v/interp.c23
-rw-r--r--sim/h8300/ChangeLog13
-rw-r--r--sim/h8300/compile.c18
-rw-r--r--sim/mn10300/ChangeLog5
-rw-r--r--sim/sh/ChangeLog13
10 files changed, 114 insertions, 14 deletions
diff --git a/include/remote-sim.h b/include/remote-sim.h
index dc49970..d1ded53 100644
--- a/include/remote-sim.h
+++ b/include/remote-sim.h
@@ -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. */
diff --git a/sim/arm/ChangeLog b/sim/arm/ChangeLog
index 2686fbf..5f11bb3 100644
--- a/sim/arm/ChangeLog
+++ b/sim/arm/ChangeLog
@@ -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.
diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c
index 86be8c6..5c2eea0 100644
--- a/sim/arm/wrapper.c
+++ b/sim/arm/wrapper.c
@@ -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;
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 77d62e4..8e7f462 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -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.
diff --git a/sim/d10v/ChangeLog b/sim/d10v/ChangeLog
index 3ee29c9..bee6a0c 100644
--- a/sim/d10v/ChangeLog
+++ b/sim/d10v/ChangeLog
@@ -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
diff --git a/sim/d10v/interp.c b/sim/d10v/interp.c
index 5dfb100..76bb438 100644
--- a/sim/d10v/interp.c
+++ b/sim/d10v/interp.c
@@ -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;
diff --git a/sim/h8300/ChangeLog b/sim/h8300/ChangeLog
index daefa6e..61ba892 100644
--- a/sim/h8300/ChangeLog
+++ b/sim/h8300/ChangeLog
@@ -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.
diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c
index 08dbbcc..12f9d29 100644
--- a/sim/h8300/compile.c
+++ b/sim/h8300/compile.c
@@ -26,13 +26,19 @@
#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. */
diff --git a/sim/mn10300/ChangeLog b/sim/mn10300/ChangeLog
index 9717037..b90138a 100644
--- a/sim/mn10300/ChangeLog
+++ b/sim/mn10300/ChangeLog
@@ -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"
diff --git a/sim/sh/ChangeLog b/sim/sh/ChangeLog
index d4f2a7c..546a90f 100644
--- a/sim/sh/ChangeLog
+++ b/sim/sh/ChangeLog
@@ -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.