o Add modulo argument to sim_core_attach

o	Add sim-memopt module - memory option processing.
This commit is contained in:
Andrew Cagney
1997-09-04 03:47:39 +00:00
parent 600d83316c
commit a34abff813
18 changed files with 769 additions and 225 deletions

View File

@ -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

View File

@ -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 \

View File

@ -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