aboutsummaryrefslogtreecommitdiff
path: root/sim/tic80
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>1997-09-04 03:47:39 +0000
committerAndrew Cagney <cagney@redhat.com>1997-09-04 03:47:39 +0000
commita34abff813f4fdd5f289ea45de9e874e31e7edf3 (patch)
treef6d3be383893c3adaae166e570d5eccd71f08427 /sim/tic80
parent600d83316cfa68f72666d792244890789812b51a (diff)
downloadgdb-a34abff813f4fdd5f289ea45de9e874e31e7edf3.zip
gdb-a34abff813f4fdd5f289ea45de9e874e31e7edf3.tar.gz
gdb-a34abff813f4fdd5f289ea45de9e874e31e7edf3.tar.bz2
o Add modulo argument to sim_core_attach
o Add sim-memopt module - memory option processing.
Diffstat (limited to 'sim/tic80')
-rw-r--r--sim/tic80/ChangeLog11
-rw-r--r--sim/tic80/Makefile.in1
-rw-r--r--sim/tic80/sim-calls.c41
3 files changed, 34 insertions, 19 deletions
diff --git a/sim/tic80/ChangeLog b/sim/tic80/ChangeLog
index 0ac08b2..6a5102b 100644
--- a/sim/tic80/ChangeLog
+++ b/sim/tic80/ChangeLog
@@ -1,3 +1,14 @@
+Thu Sep 4 10:48:57 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * sim-calls.c (sim_open): Use sim_do_command to add memory, only
+ add memory if none already present.
+ (sim_open): Move init of registers from here.
+ (sim_create_inferior): To here. Init modules.
+
+ * Makefile.in (SIM_OBJS): Add sim-memopt.o module.
+
+ * sim-calls.c (sim_open): Add zero modulo arg to sim_core_attach.
+
Mon Sep 1 11:06:30 1997 Andrew Cagney <cagney@b1.cygnus.com>
* sim-calls.c (sim_open): Use sim_state_alloc
diff --git a/sim/tic80/Makefile.in b/sim/tic80/Makefile.in
index 570f208..f15b68f 100644
--- a/sim/tic80/Makefile.in
+++ b/sim/tic80/Makefile.in
@@ -19,6 +19,7 @@ SIM_OBJS = sim-endian.o sim-bits.o sim-config.o \
sim-io.o \
sim-utils.o \
sim-load.o \
+ sim-memopt.o \
sim-module.o \
sim-options.o \
sim-trace.o \
diff --git a/sim/tic80/sim-calls.c b/sim/tic80/sim-calls.c
index 32da79b..7d4c6a9 100644
--- a/sim/tic80/sim-calls.c
+++ b/sim/tic80/sim-calls.c
@@ -92,28 +92,22 @@ sim_open (SIM_OPEN_KIND kind,
return 0;
}
- /* Initialize the main processor */
- memset (&STATE_CPU (sd, 0)->reg, 0, sizeof STATE_CPU (sd, 0)->reg);
- memset (&STATE_CPU (sd, 0)->acc, 0, sizeof STATE_CPU (sd, 0)->acc);
- memset (&STATE_CPU (sd, 0)->cr, 0, sizeof STATE_CPU (sd, 0)->cr);
- STATE_CPU (sd, 0)->is_user_mode = 0;
- memset (&STATE_CPU (sd, 0)->cia, 0, sizeof STATE_CPU (sd, 0)->cia);
- CPU_STATE (STATE_CPU (sd, 0)) = sd;
-
#define TIC80_MEM_START 0x2000000
#define TIC80_MEM_SIZE 0x100000
- /* external memory */
- sim_core_attach(sd,
- NULL,
- attach_raw_memory,
- access_read_write_exec,
- 0, TIC80_MEM_START, TIC80_MEM_SIZE, NULL, NULL);
- sim_core_attach(sd,
- NULL,
- attach_raw_memory,
- access_read_write_exec,
- 0, 0, TIC80_MEM_SIZE, NULL, NULL);
+ if (!STATE_MEMOPT_P (sd))
+ {
+ char *buf;
+ /* main memory */
+ asprintf (&buf, "memory region 0x%lx,0x%lx",
+ TIC80_MEM_START, TIC80_MEM_SIZE);
+ sim_do_command (sd, buf);
+ free (buf);
+ /* interrupt memory */
+ sim_do_command (sd, "memory region 0x1010000,0x1000");
+ /* some memory at zero */
+ sim_do_command (sd, "memory region 0,0x100000");
+ }
/* FIXME: for now */
return sd;
@@ -206,6 +200,15 @@ sim_create_inferior (SIM_DESC sd,
char **argv,
char **envp)
{
+ /* clear all registers */
+ memset (&STATE_CPU (sd, 0)->reg, 0, sizeof (STATE_CPU (sd, 0)->reg));
+ memset (&STATE_CPU (sd, 0)->acc, 0, sizeof (STATE_CPU (sd, 0)->acc));
+ memset (&STATE_CPU (sd, 0)->cr, 0, sizeof (STATE_CPU (sd, 0)->cr));
+ STATE_CPU (sd, 0)->is_user_mode = 0;
+ memset (&STATE_CPU (sd, 0)->cia, 0, sizeof (STATE_CPU (sd, 0)->cia));
+ /* initialize any modules */
+ sim_module_init (sd);
+ /* set the stack-pointer/program counter */
if (abfd != NULL)
STATE_CPU (sd, 0)->cia.ip = bfd_get_start_address (abfd);
else