aboutsummaryrefslogtreecommitdiff
path: root/sim/tic80
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>1997-08-27 04:44:41 +0000
committerAndrew Cagney <cagney@redhat.com>1997-08-27 04:44:41 +0000
commitfafce69ab16b45fb1ac6bd2ec5afc8e8dbed0374 (patch)
treeeaab2b03e17f79cd61e73a0b510942da3f20dcc3 /sim/tic80
parent9f64f00adaa7fb89b13ed291a778a262260dc409 (diff)
downloadgdb-fafce69ab16b45fb1ac6bd2ec5afc8e8dbed0374.zip
gdb-fafce69ab16b45fb1ac6bd2ec5afc8e8dbed0374.tar.gz
gdb-fafce69ab16b45fb1ac6bd2ec5afc8e8dbed0374.tar.bz2
Add ABFD argument to sim_create_inferior. Document.
Add file sim-hload.c - generic load for hardware only simulators. Review each simulators sim_open, sim_load, sim_create_inferior so that they more closely match required behavour.
Diffstat (limited to 'sim/tic80')
-rw-r--r--sim/tic80/ChangeLog10
-rw-r--r--sim/tic80/Makefile.in1
-rw-r--r--sim/tic80/sim-calls.c41
3 files changed, 29 insertions, 23 deletions
diff --git a/sim/tic80/ChangeLog b/sim/tic80/ChangeLog
index 76c95b7..2d18e39 100644
--- a/sim/tic80/ChangeLog
+++ b/sim/tic80/ChangeLog
@@ -1,6 +1,14 @@
-Tue Aug 26 10:42:13 1997 Andrew Cagney <cagney@b1.cygnus.com>
+Wed Aug 27 13:41:24 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * sim-calls.c (sim_open): Add call to sim_analyze_program, update
+ call to sim_config.
* sim-calls.c (sim_kill): Delete.
+ (sim_create_inferior): Add ABFD argument. Initialize PC from ABFD
+ and not SD.
+ (sim_load): Delete, use sim-hload.c.
+
+ * Makefile.in (SIM_OBJS): Add sim-hload.o module.
Mon Aug 25 17:50:22 1997 Andrew Cagney <cagney@b1.cygnus.com>
diff --git a/sim/tic80/Makefile.in b/sim/tic80/Makefile.in
index 605418f..570f208 100644
--- a/sim/tic80/Makefile.in
+++ b/sim/tic80/Makefile.in
@@ -15,6 +15,7 @@ SIM_OBJS = sim-endian.o sim-bits.o sim-config.o \
sim-calls.o \
sim-events.o \
sim-core.o \
+ sim-hload.o \
sim-io.o \
sim-utils.o \
sim-load.o \
diff --git a/sim/tic80/sim-calls.c b/sim/tic80/sim-calls.c
index b6f6620..095ddf1 100644
--- a/sim/tic80/sim-calls.c
+++ b/sim/tic80/sim-calls.c
@@ -74,8 +74,19 @@ sim_open (SIM_OPEN_KIND kind,
return 0;
}
- /* establish the simulator configuration */
- if (sim_config (sd, abfd) != SIM_RC_OK)
+ /* check for/establish the a reference program image */
+ if (sim_analyze_program (sd,
+ (STATE_PROG_ARGV (sd) != NULL
+ ? *STATE_PROG_ARGV (sd)
+ : NULL),
+ abfd) != SIM_RC_OK)
+ {
+ sim_module_uninstall (sd);
+ return 0;
+ }
+
+ /* establish any remaining configuration options */
+ if (sim_config (sd) != SIM_RC_OK)
{
sim_module_uninstall (sd);
return 0;
@@ -126,24 +137,6 @@ sim_close (SIM_DESC sd, int quitting)
}
-SIM_RC
-sim_load (SIM_DESC sd, char *prog, bfd *abfd, int from_tty)
-{
- bfd *prog_bfd;
-
- prog_bfd = sim_load_file (sd, STATE_MY_NAME (sd),
- STATE_CALLBACK (sd),
- prog,
- /* pass NULL for abfd, we always open our own */
- NULL,
- STATE_OPEN_KIND (sd) == SIM_OPEN_DEBUG);
- if (prog_bfd == NULL)
- return SIM_RC_FAIL;
- sim_analyze_program (sd, prog_bfd);
- return SIM_RC_OK;
-}
-
-
int
sim_read (SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length)
{
@@ -217,11 +210,15 @@ sim_info (SIM_DESC sd, int verbose)
SIM_RC
sim_create_inferior (SIM_DESC sd,
+ struct _bfd *abfd,
char **argv,
char **envp)
{
- STATE_CPU (sd, 0)->cia.ip = STATE_START_ADDR(sd);
- STATE_CPU (sd, 0)->cia.dp = (STATE_START_ADDR(sd)
+ if (abfd != NULL)
+ STATE_CPU (sd, 0)->cia.ip = bfd_get_start_address (abfd);
+ else
+ STATE_CPU (sd, 0)->cia.ip = 0;
+ STATE_CPU (sd, 0)->cia.dp = (STATE_CPU (sd, 0)->cia.ip
+ sizeof (instruction_word));
STATE_CPU (sd, 0)->cr[IE_CR] |= IE_CR_IE;
STATE_CPU (sd, 0)->reg[1] = TIC80_MEM_START + TIC80_MEM_SIZE - 16;