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
This commit is contained in:
Andrew Cagney 1997-10-22 05:26:27 +00:00
parent 2328ef1c98
commit 9e03a68f13
10 changed files with 114 additions and 14 deletions

View 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. */

View 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.

View 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;

View 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.

View 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

View 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;
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;

View 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.

View file

@ -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. */

View 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"

View 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.