diff options
author | David Edelsohn <dje.gcc@gmail.com> | 1997-05-01 20:53:43 +0000 |
---|---|---|
committer | David Edelsohn <dje.gcc@gmail.com> | 1997-05-01 20:53:43 +0000 |
commit | 260b2c47c9132c5a78805bd347a868728e32b158 (patch) | |
tree | e10f3068495882670c20539c60e0ca785445c033 /sim/common/cgen-utils.c | |
parent | 968d32cc40bedf4312c27a1d39bd54c226c00095 (diff) | |
download | gdb-260b2c47c9132c5a78805bd347a868728e32b158.zip gdb-260b2c47c9132c5a78805bd347a868728e32b158.tar.gz gdb-260b2c47c9132c5a78805bd347a868728e32b158.tar.bz2 |
* 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.
Diffstat (limited to 'sim/common/cgen-utils.c')
-rw-r--r-- | sim/common/cgen-utils.c | 53 |
1 files changed, 40 insertions, 13 deletions
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 (); |