diff options
-rw-r--r-- | sim/common/ChangeLog | 11 | ||||
-rw-r--r-- | sim/common/cgen-utils.c | 53 | ||||
-rw-r--r-- | sim/common/genmloop.sh | 4 |
3 files changed, 55 insertions, 13 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index c4b4ab9..ff5c131 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,5 +1,16 @@ Thu May 1 10:40:47 1997 Doug Evans <dje@canuck.cygnus.com> + * 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 964e16b..03b4913 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 e97878c..c5e5c1c 100644 --- a/sim/common/genmloop.sh +++ b/sim/common/genmloop.sh @@ -161,6 +161,8 @@ cat <<EOF engine_halt (current_cpu, EXEC_STATE_STOPPED, SIM_SIGTRAP); } while (keep_running); + /* If the loop exists, engine_stop was called. */ + engine_halt (current_cpu, EXEC_STATE_STOPPED, SIM_SIGINT); #undef FAST } else @@ -180,6 +182,8 @@ cat <<EOF ++insn_count; } while (keep_running); + /* If the loop exists, engine_stop was called. */ + engine_halt (current_cpu, EXEC_STATE_STOPPED, SIM_SIGINT); } } EOF |