From: Andrew Cagney Date: Wed, 22 Oct 1997 05:26:27 +0000 (+0000) Subject: Add LMA_P and DO_WRITE arguments to sim/common/sim-load.c:sim_load_file(). X-Git-Tag: gdb-4_18~4421 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9e03a68f136a021e7bfa9afb18ca4f170e949f80;p=thirdparty%2Fbinutils-gdb.git 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 --- diff --git a/include/remote-sim.h b/include/remote-sim.h index dc4997032bd..d1ded53ea82 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 2686fbfea33..5f11bb348cb 100644 --- a/sim/arm/ChangeLog +++ b/sim/arm/ChangeLog @@ -1,3 +1,16 @@ +Wed Oct 22 14:43:00 1997 Andrew Cagney + + * wrapper.c (sim_load): Pass lma_p and sim_write args to + sim_load_file. + +Fri Oct 3 09:28:00 1997 Andrew Cagney + + * configure: Regenerated to track ../common/aclocal.m4 changes. + +Wed Sep 24 17:38:57 1997 Andrew Cagney + + * configure: Regenerated to track ../common/aclocal.m4 changes. + Tue Sep 23 11:04:38 1997 Andrew Cagney * configure: Regenerated to track ../common/aclocal.m4 changes. diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c index 86be8c672b3..5c2eea0cfc4 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 77d62e4e434..8e7f462ded7 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,10 @@ +Wed Oct 22 14:18:38 1997 Andrew Cagney + + * 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 * nrun.c (main): Remove useless test of name != NULL. diff --git a/sim/d10v/ChangeLog b/sim/d10v/ChangeLog index 3ee29c9bb4e..bee6a0cfaaa 100644 --- a/sim/d10v/ChangeLog +++ b/sim/d10v/ChangeLog @@ -1,3 +1,11 @@ +Wed Oct 22 14:43:00 1997 Andrew Cagney + + * 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 * 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 5dfb100ab26..76bb438a950 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 daefa6e267c..61ba892a798 100644 --- a/sim/h8300/ChangeLog +++ b/sim/h8300/ChangeLog @@ -1,3 +1,16 @@ +Wed Oct 22 14:43:00 1997 Andrew Cagney + + * wrapper.c (sim_load): Pass lma_p and sim_write args to + sim_load_file. + +Fri Oct 3 09:28:00 1997 Andrew Cagney + + * configure: Regenerated to track ../common/aclocal.m4 changes. + +Wed Sep 24 17:38:57 1997 Andrew Cagney + + * configure: Regenerated to track ../common/aclocal.m4 changes. + Tue Sep 23 11:04:38 1997 Andrew Cagney * configure: Regenerated to track ../common/aclocal.m4 changes. diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c index 08dbbccd69e..12f9d2910cd 100644 --- a/sim/h8300/compile.c +++ b/sim/h8300/compile.c @@ -26,13 +26,19 @@ #ifdef HAVE_STDLIB_H #include #endif +#ifdef HAVE_SYS_PARAM_H #include +#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 97170375072..b90138ab0a2 100644 --- a/sim/mn10300/ChangeLog +++ b/sim/mn10300/ChangeLog @@ -1,3 +1,8 @@ +Wed Oct 22 14:43:00 1997 Andrew Cagney + + * 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 d4f2a7cb525..546a90fabe5 100644 --- a/sim/sh/ChangeLog +++ b/sim/sh/ChangeLog @@ -1,3 +1,16 @@ +Wed Oct 22 14:43:00 1997 Andrew Cagney + + * wrapper.c (sim_load): Pass lma_p and sim_write args to + sim_load_file. + +Fri Oct 3 09:28:00 1997 Andrew Cagney + + * configure: Regenerated to track ../common/aclocal.m4 changes. + +Wed Sep 24 17:38:57 1997 Andrew Cagney + + * configure: Regenerated to track ../common/aclocal.m4 changes. + Tue Sep 23 11:04:38 1997 Andrew Cagney * configure: Regenerated to track ../common/aclocal.m4 changes.