Commit Graph

3598 Commits

Author SHA1 Message Date
Mike Frysinger a348708291 sim: drop -DTRACE from configure
No code uses this anymore and the symbol conflicts with the new TRACE
helper.  Punt it from configure.
2015-06-12 10:40:46 -04:00
Mike Frysinger 5b064994f0 sim: msp430: use new common trace print helpers
Replace the "if (TRACE_xxx_P) trace_generic" form with "TRACE_xxx".
The output is the same, but the code is nicer to read.
2015-06-12 10:14:00 -04:00
Mike Frysinger 0054dcd7b6 sim: moxie: use new common trace defines
Now that there's common helpers for printing trace data, switch to that
to restore the insn tracing support for this target.
2015-06-12 06:57:44 -04:00
Mike Frysinger bb11f3ed2b sim: trace: add common macros for logging info
The Blackfin port had some TRACE_xxx macros for easily logging trace data.
Use these as a base for common ones that have a simple form and match the
existing sets of helper macros.
2015-06-12 06:34:20 -04:00
Mike Frysinger 29bc024d07 sim: mips: switch to common WITH_TRACE_ANY_P
We want to add new common trace helpers including "TRACE", so change the
mips one to the new WITH_TRACE_ANY_P macro since they do the same thing.
2015-06-12 06:28:17 -04:00
Mike Frysinger bffcfec8c3 sim: trace: add WITH_TRACE_ANY_P helper
We have STRACE_ANY_P and TRACE_ANY_P, so add WITH_TRACE_ANY_P to fill
out the API.  This lets us wrap the internal configure symbol.
2015-06-12 06:21:38 -04:00
Mike Frysinger 53d2389fd0 sim: moxie: rename TRACE to MOXIE_TRACE_INSN
We want to add new common trace helpers including "TRACE", so rename the
moxie one to MOXIE_TRACE_INSN.  This also matches what the code is doing.
2015-06-12 06:16:39 -04:00
Mike Frysinger db7858e227 sim: cgen: namespace custom trace functions
The cgen code declares some macros/funcs using the trace_xxx prefix, but
the code isn't generic and only works with cgen targets.  This is blocking
the creation of new common trace functions.

Let's blindly add cgen_xxx prefixes to all these symbols.  Some already
use this convention to avoid conflicts, so it makes sense to align them.
In the future we might want to move some to the common trace core, but
one thing at a time.
2015-06-12 04:19:45 -04:00
Mike Frysinger c1d8560ea5 sim: msp430: delete unused trace macros
These macros were copied from the Blackfin port but never used, so delete
them as part of the trace unification work.
2015-06-11 12:52:20 -04:00
Mike Frysinger 83034798de sim: trace: centralize the system tracing
First we convert the ETRACE_P to STRACE_EVENTS_P.  This means we move from
using the sim_events.trace storage to the common sim_state_base.trace_data
array.  With that deleted, the common trace init code can be simplified so
the sim state works the same as the sim cpu.
2015-06-11 10:39:43 -04:00
Mike Frysinger ce4eda4a58 sim: trace: add STRACE_xxx_P macros
These are the parallel to the TRACE_xxx_P macros and fill out the full
set to match the existing debug one.
2015-06-11 10:37:15 -04:00
Mike Frysinger a6c2a374e0 sim: trace: use existing defines for the useful mask
No point in duplicating the shift logic when we have macros already to
keep that all unified.
2015-06-11 10:29:44 -04:00
Mike Frysinger 9b9c712ceb sim: trace: create a common WITH_TRACE_P macro
This way we can use the IDX macros everywhere and not worry about the
encoding of the WITH_TRACE define in multiple places.
2015-06-11 10:28:58 -04:00
Mike Frysinger 66a19e2f81 sim: frv: drop custom debug mask
This is the only sim that sets up its own WITH_TRACE mask and it conflicts
with the user setting their own list at configure time.  Drop it to match
all the other sims.
2015-06-11 10:22:44 -04:00
Mike Frysinger 09896bd223 sim: m68hc11: delete unused interrupt_names
The interrupts.c file has a static/fuller definition that is used,
so drop this copy in interp.c.
2015-06-11 10:21:32 -04:00
Mike Frysinger a84f8df0e2 sim: m68hc11: switch to common sim_resume
This code already matched the common sim reusme logic, so we can simply
drop it and pull in the common code.
2015-06-11 10:17:54 -04:00
Mike Frysinger 926b1cd8cf sim: mn10300: delete unused memory code
Only one place used get_word/put_word, so inline the usage there.
All the rest is dead code so trim it.
2015-06-11 10:13:49 -04:00
Mike Frysinger 2cc78d4dd7 sim: mn10300: add missing static markings 2015-06-11 07:35:32 -04:00
Mike Frysinger 96eaf29ec4 sim: mn10300: delete unused exception/exited/debug state
The syscall path was the only code checking the custom exception state
after recent cleanups.  Once we change that to the common engine halt
function, we can delete that state entirely.

This also helps highlight some other dead code that we can cull.
2015-06-11 07:29:16 -04:00
Mike Frysinger b0e4c8a581 sim: mn10300: use common size types
No point in open coding this logic here when we have common size types
already that give the right answer.
2015-06-11 07:20:57 -04:00
Mike Frysinger 5d19c36612 sim: m68hc11/mn10300/v850: delete redundant INLINE defines
The sim-inline.h header already takes care of this for us, so punt
the local definitions.
2015-06-11 07:17:12 -04:00
Mike Frysinger 31557eccb2 sim: microblaze: switch to common sim_resume/sim_stop_reason
This allows us to use the common code for all exception handling.
2015-06-11 07:13:22 -04:00
Joel Brobecker bb9e16d4bb Fix latest sim/common/ChangeLog entry. 2015-06-09 14:29:09 -04:00
Joel Brobecker f419f52b9b Remove unnecessary empty line in sim/common/ChangeLog 2015-06-09 14:27:58 -04:00
Mike Stump 509c2f329a Fix spelling mistakes in sim/common/sim-events.c error messages.
sim/common/ChangeLog:

        * sim-events.c (sim_events_schedule_after_signal): Fix spelling
        mistake in call to sim_engine_abort.
        (sim_events_schedule_after_signal): Likewise.
2015-06-09 14:27:46 -04:00
Mike Frysinger 296730a52b sim: erc32: restore attribution 2015-05-17 17:15:36 +08:00
Joel Brobecker 17d88f73c0 Switch erc32 simulator copyright headers to FSF.
Permission was granted by Jiri Gaisler, who has a copyright assignment
on file for GDB.

sim/erc32/ChangeLog:

        * configure.ac: Add copyright header.
        * erc32.c: Change copyright holder to FSF.  Reformat.
        * exec.c, float.c, func.c, interf.c, sis.c, sis.h: Likewise.
        * help.c, startsim: Add copyright header.
2015-05-08 07:23:15 -07:00
DJ Delorie 0952813b0b Make RL78 disassembler and simulator respect ISA for mul/div
[gas]
	* config/rl78-defs.h (rl78_isa_g10): New.
	(rl78_isa_g13): New.
	(rl78_isa_g14): New.
	* config/rl78-parse.y (ISA_G10): New.
	(ISA_G13): New.
	(ISA_G14): New.
	(MULHU, MULH, MULU, DIVHU, DIVWU, MACHU, MACH): Use them.
	* config/tc-rl78.c (rl78_isa_g10): New.
	(rl78_isa_g13): New.
	(rl78_isa_g14): New.

[gdb]
	* rl78-tdep.c (rl78_analyze_prologue): Pass RL78_ISA_DEFAULT to
	rl78_decode_opcode

[include]
	* dis-asm.h (print_insn_rl78_g10): New.
	(print_insn_rl78_g13): New.
	(print_insn_rl78_g14): New.
	(rl78_get_disassembler): New.
	* opcode/rl78.h (RL78_Dis_Isa): New.
	(rl78_decode_opcode): Add ISA parameter.

[opcodes]
	* disassemble.c (disassembler): Choose suitable disassembler based
	on E_ABI.
	* rl78-decode.opc (rl78_decode_opcode): Take ISA parameter.  Use
	it to decode mul/div insns.
	* rl78-decode.c: Regenerate.
	* rl78-dis.c (print_insn_rl78): Rename to...
	(print_insn_rl78_common): ...this, take ISA parameter.
	(print_insn_rl78): New.
	(print_insn_rl78_g10): New.
	(print_insn_rl78_g13): New.
	(print_insn_rl78_g14): New.
	(rl78_get_disassembler): New.

[sim]
	* rl78/cpu.c (g14_multiply): New.
	* rl78/cpu.h (g14_multiply): New.
	* rl78/load.c (rl78_load): Decode ISA completely.
	* rl78/main.c (main): Expand -M to include other ISAs.
	* rl78/rl78.c (decode_opcode): Decode based on ISA.
	* rl78/trace.c (rl78_disasm_fn): New.
	(sim_disasm_init): Reset it.
	(sim_disasm_one): Get correct disassembler for ISA.
2015-04-30 15:25:49 -04:00
Nick Clifton 0a13382c8e Fix problems in the sim sources discovered by running the cppcheck static analysis tool.
erc32	PR 18273
	* sis.c (main): Remove unreachable code.

m68hc11	* gencode.c (gen_fetch_operands): Remove unreachable code.

ppc	* hw_htab.c (htab_map_binary): Fix overlap check.

common	* sim-fpu.c (INLINE_SIM_FPU): Fix static analysis warning by
	increasing parenthesis around casts to signed values.
2015-04-29 16:02:02 +01:00
Senthil Kumar Selvaraj 180d40b903 sim: avr: Fix 'multiple definition of sim_{read,write}'
This patch does whatever was done in
https://sourceware.org/ml/gdb-patches/2015-04/msg00437.html to fix
broken gdb build for the AVR target.
2015-04-27 09:54:37 -04:00
Nick Clifton de7669bfa5 Fix typos in sim sources exposed by static analysis.
bfin	PR 18273
	* bfin-sim.c (decode_dsp32alu_0): Remove spurious check for
	s == 1.

erc32	PR 18273
	* exec.c (add32): Fix typo in check for overflow.

igen	PR 18273
	* misc.c (a2i): Fix typos checking for uppercase letters.
2015-04-24 15:43:21 +01:00
Nick Clifton 63c72d1ae4 Fix typo in check for valid register number in RX sim.
PR sim/18273
	* reg.c (put_reg): Fix check for valid register number.
2015-04-24 15:31:36 +01:00
Mike Frysinger 43236bb255 sim: mcore: clean up printf warnings
These printf statements are showing "word" objects which are typedefed
from long, so make sure to use l with %x when printing them to avoid
warnings from gcc.
2015-04-21 03:10:16 -04:00
Mike Frysinger f63036b811 sim: mcore: convert to common memory/verbose functions
Re-use the existing memory core that handles reads/writes.

The verbose command is converted to the common --verbose flag
since only a few call sites use it now.
2015-04-21 03:10:16 -04:00
Mike Frysinger e53e5aab53 sim: mcore: drop watchpoint/dumpmem/clearstats support
In preparation for converting to the common memory framework, the custom
commands get in our way.  But when we realize that gdb support has been
dropped for mcore, it makes things a bit easier: the main runner does not
let you run arbitrary commands once simulation starts.

So lets disable watchpoint support until it can be converted to the common
watchpoint logic.  There's already an ifdef to let us do that.

We straight up drop support for the dumpmem command (no other sim supports
this, and if it's a feature people want, we can add a common func) and the
clearstats command (not a big deal -- just restart your simulation).

We leave in place the verbose check points as a follow up commit will cut
that over to common logic.
2015-04-21 03:10:16 -04:00
Mike Frysinger 767e68f1b9 sim: mcore: switch to common syscall handling
Now that libgloss has a header tracking the syscalls for this arch, we
can update the database to include it for the symbolic constants/maps.
Then we can switch the mcore syscall callbacks over to the common ones.
2015-04-21 03:10:16 -04:00
Mike Frysinger 248d23e82b sim: gennltvals.sh: handle split out newlib source tree
Since newlib no longer shares the same repo as binutils/gdb, we have to go
searching further afield to locate the sources.  We still look at the top
level for newlib, but if that is not found, we also try up one dir outside
of this source tree.  It sucks, but better than the status quo (no workie).
2015-04-21 03:10:16 -04:00
Jiri Gaisler d3e9b40afb sim/erc32: Switched emulated memory to host endian order.
Change data ordering in emulated memory from target order (big endian)
to host order. Improves performance and simplifies most memory
operations. Requires some byte twisting during stores on little
endian hosts (intel). Also removed support for little-endian binaries.
2015-04-19 02:29:44 -04:00
Mike Frysinger 3ebe2863f7 sim: clean up duplicate sim-engine hooks
Now that we've unified sim-cpu, we can delete the duplicate sim-engine
hooks -- these targets defined these only because they didn't fully
implement the sim-cpu callbacks.
2015-04-18 04:40:27 -04:00
Mike Frysinger e8d3a34fee sim: trim old USING_SIM_BASE_H define
This doesn't appear to have been used since 1998, but wasn't cleaned
up since.  So much for being "quick" ;).
2015-04-18 04:32:56 -04:00
Mike Frysinger 20bca71d82 sim: unify SIM_CPU definition
Since every target typedefs this the same way, move it to the common code.

We have to leave Blackfin behind here for now because of inter-dependencies
on types and headers: sim-base.h includes sim-model.h which needs types in
machs.h which needs types in bfim-sim.h which needs SIM_CPU.
2015-04-18 04:31:36 -04:00
Mike Frysinger 7e83aa92f2 sim: unify sim_cia definition
Almost every target defines sim_cia the same way -- either using the
address_word type directly, or a type of equivalent size.  The only
odd one out is sh64 (who has 32bit address_word and 64bit cia), and
even that case doesn't seem to make sense.  We'll put off clean up
though of sh64 and at least set up a sensible default for everyone.
2015-04-18 04:14:38 -04:00
Mike Frysinger c85fc61074 sim: microblaze: switch to common memory functions
Re-use the existing memory core that handles reads/writes.

This drops support for the dumpmem command, but gdb itself has
support for dumping memory regions.

The verbose command is converted to the common --verbose flag
since only two call sites use it now.

Support for the clearstats command is dropped entirely, but no
other sim really does this, and the same thing can be done by
reloading.  If it's important (clearing cycle stats) to someone,
we can add a common function for it.
2015-04-17 03:15:43 -04:00
Mike Frysinger 034685f9ce sim: replace CIA_{GET,SET} with CPU_PC_{GET,SET}
The CIA_{GET,SET} macros serve the same function as CPU_PC_{GET,SET}
except the latter adds a layer of indirection via the sim state.  This
lets models set up different functions at runtime and doesn't reach so
directly into the arch-specific cpu state.

It also doesn't make sense to have two sets of macros that do exactly
the same thing, so lets standardize on the one that gets us more.
2015-04-17 02:44:30 -04:00
Mike Frysinger 27b97b40bc sim: arm/cr16/d10v/h8300/microblaze/sh: fill out sim-cpu pc fetch/store helpers
This makes the common sim-cpu logic work.
2015-04-17 02:22:16 -04:00
Mike Frysinger 4c0cab1e21 sim: avr/mcore/moxie: fill out sim-cpu pc fetch/store helpers
This makes the common sim-cpu logic work.
2015-04-16 02:13:50 -04:00
Mike Frysinger 78e9aa70fe sim: unify sim-cpu usage
Now that all the targets are utilizing CPU_PC_{FETCH,STORE}, and the
cpu state is multicore, and the STATE_CPU defines match, we can move
it all to the common code.
2015-04-15 02:19:52 -04:00
Mike Frysinger f95f4ed2c4 sim: cris/frv/h8300/iq2000/lm32/m32r/sh64: standardize cpu state
This sets up the sim_state structure and the cpu member to match what we
do in most other sims, and what the common code suggests.  This is a step
to unifying on the sim-cpu.o object.
2015-04-15 01:25:32 -04:00
Mike Frysinger 887bddbcad sim: ppc: fix up version script
The common sim code has switched to using gdb directly; update the
ppc copy too.
2015-04-13 23:17:53 -04:00
Mike Frysinger bf12d44ee0 sim: fix the PKGVERSION define
This should be SIM, not GDB.
2015-04-13 02:41:10 -04:00