diff options
author | Andrew Cagney <cagney@redhat.com> | 1997-09-01 03:26:31 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 1997-09-01 03:26:31 +0000 |
commit | 4b2a6aed8413d6e7d7b25d918896ae637266d9d5 (patch) | |
tree | fc0f49b0104f94778be3465dc74f0f206afef7aa /sim/common/sim-utils.c | |
parent | 9f3f3525396695352bffc5f9cda3ae542e3b83f7 (diff) | |
download | gdb-4b2a6aed8413d6e7d7b25d918896ae637266d9d5.zip gdb-4b2a6aed8413d6e7d7b25d918896ae637266d9d5.tar.gz gdb-4b2a6aed8413d6e7d7b25d918896ae637266d9d5.tar.bz2 |
Use sim_state_alloc to create common sim object.
Diffstat (limited to 'sim/common/sim-utils.c')
-rw-r--r-- | sim/common/sim-utils.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/sim/common/sim-utils.c b/sim/common/sim-utils.c index 9bcfffc..c72a1ab 100644 --- a/sim/common/sim-utils.c +++ b/sim/common/sim-utils.c @@ -53,7 +53,8 @@ with this program; if not, write to the Free Software Foundation, Inc., Set by sim_resume. */ struct sim_state *current_state; -/* Allocate zero filled memory with xmalloc. */ +/* Allocate zero filled memory with xmalloc - xmalloc aborts of the + allocation fails. */ void * zalloc (unsigned long size) @@ -72,10 +73,16 @@ zfree (void *data) /* Allocate a sim_state struct. */ SIM_DESC -sim_state_alloc (void) +sim_state_alloc (SIM_OPEN_KIND kind, + host_callback *callback) { - SIM_DESC sd = zalloc (sizeof (struct sim_state)); - sd->base.magic = SIM_MAGIC_NUMBER; + int cpu_nr; + SIM_DESC sd = ZALLOC (struct sim_state); + STATE_MAGIC (sd) = SIM_MAGIC_NUMBER; + STATE_CALLBACK (sd) = callback; + STATE_OPEN_KIND (sd) = kind; + for (cpu_nr = 0; cpu_nr < MAX_NR_PROCESSORS; cpu_nr++) + CPU_STATE (STATE_CPU (sd, cpu_nr)) = sd; return sd; } |