From 260b2c47c9132c5a78805bd347a868728e32b158 Mon Sep 17 00:00:00 2001 From: David Edelsohn Date: Thu, 1 May 1997 20:53:43 +0000 Subject: [PATCH] * configure: Regenerated. * cgen-sim.h (sim_signal_type): Add SIM_SIGINT. (cgen_state): New member run_fast_p. (cgen_init): Add prototype. (sim_disassemble_insn): New arg `cpu'. * cgen-trace.c (trace_insn): Update call to sim_disassemble_insn. * cgen-utils.c (cgen_init): New function. (sim_disassemble_insn): New arg `cpu'. Rewrite fetching of insn. * genmloop.sh: Call engine_halt if loop exits. --- sim/common/ChangeLog | 11 +++++++++ sim/common/cgen-utils.c | 53 +++++++++++++++++++++++++++++++---------- sim/common/genmloop.sh | 4 ++++ 3 files changed, 55 insertions(+), 13 deletions(-) diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index c4b4ab9222f..ff5c131c199 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,5 +1,16 @@ Thu May 1 10:40:47 1997 Doug Evans + * configure: Regenerated. + + * cgen-sim.h (sim_signal_type): Add SIM_SIGINT. + (cgen_state): New member run_fast_p. + (cgen_init): Add prototype. + (sim_disassemble_insn): New arg `cpu'. + * cgen-trace.c (trace_insn): Update call to sim_disassemble_insn. + * cgen-utils.c (cgen_init): New function. + (sim_disassemble_insn): New arg `cpu'. Rewrite fetching of insn. + * genmloop.sh: Call engine_halt if loop exits. + * Makefile.in (sim-options_h): Define. (sim-{module,options,trace,profile,utils}.o): Clean up dependencies. (sim-model.o): Add new rule. diff --git a/sim/common/cgen-utils.c b/sim/common/cgen-utils.c index 964e16be2b0..03b49132193 100644 --- a/sim/common/cgen-utils.c +++ b/sim/common/cgen-utils.c @@ -47,6 +47,38 @@ const char *mode_names[] = { "TF", }; +/* Initialize cgen things. + This is called after sim_post_argv_init. */ + +void +cgen_init (SIM_DESC sd) +{ + int i, c; + int run_fast_p = 1; + + /* If no profiling or tracing has been enabled, run in fast mode. */ + for (c = 0; c < MAX_NR_PROCESSORS; ++c) + { + sim_cpu *cpu = STATE_CPU (sd, c); + + for (i = 0; i < MAX_PROFILE_VALUES; ++i) + if (CPU_PROFILE_FLAGS (cpu) [i]) + { + run_fast_p = 0; + break; + } + for (i = 0; i < MAX_TRACE_VALUES; ++i) + if (CPU_TRACE_FLAGS (cpu) [i]) + { + run_fast_p = 0; + break; + } + if (! run_fast_p) + break; + } + STATE_RUN_FAST_P (sd) = run_fast_p; +} + void engine_halt (cpu, reason, sigrc) sim_cpu *cpu; @@ -183,11 +215,8 @@ disasm_sprintf VPARAMS ((SFILE *f, const char *format, ...)) } void -sim_disassemble_insn (insn, abuf, pc, buf) - const struct cgen_insn *insn; - const struct argbuf *abuf; - PCADDR pc; - char *buf; +sim_disassemble_insn (SIM_CPU *cpu, const struct cgen_insn *insn, + const struct argbuf *abuf, PCADDR pc, char *buf) { int length; unsigned long insn_value; @@ -195,28 +224,26 @@ sim_disassemble_insn (insn, abuf, pc, buf) struct cgen_fields fields; SFILE sfile; char insn_buf[20]; - STATE state = current_state; + SIM_DESC sd = CPU_STATE (cpu); sfile.buffer = sfile.current = buf; INIT_DISASSEMBLE_INFO (disasm_info, (FILE *) &sfile, (fprintf_ftype) disasm_sprintf); disasm_info.endian = - (bfd_big_endian (STATE_PROG_BFD (state)) ? BFD_ENDIAN_BIG - : bfd_little_endian (STATE_PROG_BFD (state)) ? BFD_ENDIAN_LITTLE + (bfd_big_endian (STATE_PROG_BFD (sd)) ? BFD_ENDIAN_BIG + : bfd_little_endian (STATE_PROG_BFD (sd)) ? BFD_ENDIAN_LITTLE : BFD_ENDIAN_UNKNOWN); -/* (*STATE_MEM_READ (state)) (state, pc, insn_buf, abuf->length);*/ - switch (abuf->length) { case 1 : - insn_value = insn_buf[0]; + insn_value = sim_core_read_1 (CPU_STATE (cpu), sim_core_read_map, pc); break; case 2 : - insn_value = disasm_info.endian == BFD_ENDIAN_BIG ? bfd_getb16 (insn_buf) : bfd_getl16 (insn_buf); + insn_value = sim_core_read_2 (CPU_STATE (cpu), sim_core_read_map, pc); break; case 4 : - insn_value = disasm_info.endian == BFD_ENDIAN_BIG ? bfd_getb32 (insn_buf) : bfd_getl32 (insn_buf); + insn_value = sim_core_read_4 (CPU_STATE (cpu), sim_core_read_map, pc); break; default: abort (); diff --git a/sim/common/genmloop.sh b/sim/common/genmloop.sh index e97878ca9c2..c5e5c1c45a9 100644 --- a/sim/common/genmloop.sh +++ b/sim/common/genmloop.sh @@ -161,6 +161,8 @@ cat <