Commit Graph

235 Commits

Author SHA1 Message Date
Christian Biesinger 07f1f3aa53 Fix spelling errors
seperate -> separate

bfd/ChangeLog:

2020-01-17  Christian Biesinger  <cbiesinger@google.com>

	* coff-arm.c: Fix spelling error (seperate).
	* elfxx-riscv.c (riscv_parse_sv_or_non_std_ext): Fix spelling
	error (seperate).
	* sysdep.h (strnlen): Fix spelling error (seperate).

opcodes/ChangeLog:

2020-01-17  Christian Biesinger  <cbiesinger@google.com>

	* opintl.h: Fix spelling error (seperate).

sim/arm/ChangeLog:

2020-01-17  Christian Biesinger  <cbiesinger@google.com>

	* iwmmxt.c: Fix spelling error (seperate).

Change-Id: I55e5f47bcf3cf3533d2acb7ad338f1be0d5f30f9
2020-01-17 12:34:03 -06:00
Luis Machado 851c0536ca [ARM, sim] Fix build error and warnings
Newer GCC's have switched to -fno-common by default, and this breaks the build
for the ARM sim, like this:

binutils-gdb.git~gdb-8.3-release/sim/arm/maverick.c:65: multiple definition of `DSPsc'; libsim.a(wrapper.o):binutils-gdb.git~gdb-8.3-release/sim/arm/wrapper.c:134: first defined here
binutils-gdb.git~gdb-8.3-release/sim/arm/maverick.c:64: multiple definition of `DSPacc'; libsim.a(wrapper.o):binutils-gdb.git~gdb-8.3-release/sim/arm/wrapper.c:133: first defined here
binutils-gdb.git~gdb-8.3-release/sim/arm/maverick.c:63: multiple definition of `DSPregs'; libsim.a(wrapper.o):binutils-gdb.git~gdb-8.3-release/sim/arm/wrapper.c:132: first defined here

I also noticed a few warnings due to mismatching types, as follows:

../../../../repos/binutils-gdb/sim/arm/wrapper.c: In function ‘sim_create_inferior’:
../../../../repos/binutils-gdb/sim/arm/wrapper.c:335:16: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
       for (arg = argv; *arg != NULL; arg++)
                ^
../../../../repos/binutils-gdb/sim/arm/wrapper.c:342:8: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
    arg = argv;
        ^
../../../../repos/binutils-gdb/sim/arm/wrapper.c:345:13: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
    for (arg = argv; *arg != NULL; arg++)
             ^
The following patch fixes both of the above.

sim/arm/ChangeLog:

2019-12-06  Luis Machado  <luis.machado@linaro.org>

	* armemu.c (isize): Move this declaration ...
	* arminit.c (isize): ... here.
	* maverick.h: New file.
	* wrapper.c: Include "maverick.h".
	(<struct maverick_regs>, <union maverick_acc_regs>): Remove and update
	comment.
	(sim_create_inferior): Cast variables to proper type.
	* maverick.c: Include "maverick.h".
	(<struct maverick_regs>, <union maverick_acc_regs>): Move
	declarations to maverick.h and update comment.
	(DSPsc, DSPacc, DSPregs): Adjust comment.

Change-Id: I21db699d3b61b2de8c44053e47be4387285af28f
2019-12-06 18:16:20 -03:00
Nick Clifton 43724d16be Fix compile time warning (in the ARM simulator) about a print statement with insufficient arguments.
PR 22663
	* maverick.c (DSPCDP4): Add missing parameter to debug print
	statement.
2018-01-02 17:15:16 +00:00
Yao Qi 88240b186d [SIM, ARM] Fix build failure
This patch fixes the build failure by using disassembler to get
disassemble function pointer, and do the disassembly, because
print_insn_little_arm is no longer visible outside opcodes/

binutils-gdb/sim/arm/wrapper.c:98:10: error: implicit declaration of function 'print_insn_little_arm' [-Werror=implicit-function-declaration]
   size = print_insn_little_arm (0, & info);
          ^

sim/arm:

2017-09-21  Yao Qi  <yao.qi@linaro.org>

	* wrapper.c (print_insn): Use disassembler instead of
	print_insn_little_arm.
2017-09-21 09:02:25 +01:00
John Baldwin 5c887dd5f6 Honor an existing CC_FOR_BUILD in the environment for sim.
This matches the equivalent bits in bfd/acinclude.m4

sim/ChangeLog:

	* configure.ac: Honor existing CC_FOR_BUILD in environment.
	* configure: Regenerate.

sim/aarch64/ChangeLog:

	* configure: Regenerate.

sim/arm/ChangeLog:

	* configure: Regenerate.

sim/avr/ChangeLog:

	* configure: Regenerate.

sim/bfin/ChangeLog:

	* configure: Regenerate.

sim/common/ChangeLog:

	* acinclude.m4 (SIM_AC_COMMON) Honor existing CC_FOR_BUILD in
	environment.

sim/cr16/ChangeLog:

	* configure: Regenerate.

sim/cris/ChangeLog:

	* configure: Regenerate.

sim/d10v/ChangeLog:

	* configure: Regenerate.

sim/erc32/ChangeLog:

	* configure: Regenerate.

sim/frv/ChangeLog:

	* configure: Regenerate.

sim/ft32/ChangeLog:

	* configure: Regenerate.

sim/h8300/ChangeLog:

	* configure: Regenerate.

sim/iq2000/ChangeLog:

	* configure: Regenerate.

sim/lm32/ChangeLog:

	* configure: Regenerate.

sim/m32c/ChangeLog:

	* configure: Regenerate.

sim/m32r/ChangeLog:

	* configure: Regenerate.

sim/m68hc11/ChangeLog:

	* configure: Regenerate.

sim/mcore/ChangeLog:

	* configure: Regenerate.

sim/microblaze/ChangeLog:

	* configure: Regenerate.

sim/mips/ChangeLog:

	* configure: Regenerate.

sim/mn10300/ChangeLog:

	* configure: Regenerate.

sim/moxie/ChangeLog:

	* configure: Regenerate.

sim/msp430/ChangeLog:

	* configure: Regenerate.

sim/rl78/ChangeLog:

	* configure: Regenerate.

sim/rx/ChangeLog:

	* configure: Regenerate.

sim/sh/ChangeLog:

	* configure: Regenerate.

sim/sh64/ChangeLog:

	* configure: Regenerate.

sim/v850/ChangeLog:

	* configure: Regenerate.
2017-09-06 10:16:12 -07:00
Mike Frysinger 13a590ca65 sim: use ARRAY_SIZE instead of ad-hoc sizeof calculations 2017-02-13 01:26:21 -05:00
Nick Clifton 7df94786e4 Small improvements to the ARM simulator to cope with illegal binaries.
* armemu.c (Multiply64): Only issue error messages about invalid
	arguments if debugging is enabled.
	* armos.c (ARMul_OSHandleSWI): Ignore invalid flags.
2016-07-14 10:38:07 +01:00
Mike Frysinger ce39bd3890 sim: move many common settings from CPPFLAGS to config.h
Rather than stuffing the command line with a bunch of -D flags, start
moving things to config.h which is managed by autoheader.  This makes
the makefile a bit simpler and the build output tighter, and it makes
the migration to automake easier as there are fewer vars to juggle.

We'll want to move the other options out too, but it'll take more work.
2016-01-10 18:54:41 -05:00
Mike Frysinger e19418e02e sim: drop unused SIM_AC_OPTION_PACKAGES
This was imported from the ppc sim, but that was only used to control
a single file, and that is already governed by the hw models.  There's
no need to have a sep configure option here, especially since none of
the other sims are using it.  Even when the code is enabled, there's
no runtime overhead.
2016-01-10 17:54:04 -05:00
Mike Frysinger 16f7876d71 sim: allow the environment configure option everywhere
Currently ports have to call SIM_AC_OPTION_ENVIRONMENT explicitly in
order to make the configure flag available.  There's no real reason
to not allow this flag for all ports, so move it to the common sim
macro.  This way we get standard behavior across all ports too.
2016-01-10 17:03:36 -05:00
Mike Frysinger 35656e9521 sim: allow the assert configure option everywhere
Currently ports have to call SIM_AC_OPTION_ASSERT explicitly in order
to make the configure flag available, which none of them do.  There's
no real reason to not allow this flag for all ports, so move it to the
common sim macro.  This way we get standard behavior across all ports.
2016-01-10 16:13:13 -05:00
Mike Frysinger 99d8e87993 sim: drop targ-vals.def->nltvals.def indirection
We don't have alternative nltvals.def files, so always symlinking
the targ-vals.def file to it doesn't gain us anything.  It does
make the build more complicated though and a pain to convert to
something newer (like automake).  Drop the symlinking entirely.

In the future, we'll want to explode this file anyways into the
respective arch dirs so things can be selected dynamically at
runtime, so it's not like we'll be bringing this back.
2016-01-10 04:01:16 -05:00
Mike Frysinger 347fe5bb86 sim: allow the inline configure option everywhere
Currently ports have to call SIM_AC_OPTION_INLINE explicitly in order
to make the configure flag available.  There's no real reason to not
allow this flag for all ports, so move it to the common sim macro.
This way we get standard behavior across all ports too.
2016-01-10 03:36:32 -05:00
Mike Frysinger 0dc73ef7c3 sim: drop --enable-sim-{regparm,stdcall} options
These options were never exposed for most sims (just the ppc one),
and they are really only useful on 32-bit x86 systems.  Considering
modern systems tend to be 64-bit x86_64 and how well modern compilers
are at optimizing code, these have outlived their usefulness.
2016-01-10 03:15:01 -05:00
Mike Frysinger 22be3fbeac sim: drop --enable-sim-cflags option
No other sub directory provides such a configuration option, so
drop it from the sim dir as well.  This cleans up a good bit of
code in the process.

If people want to use custom flags for just the sim, they can
still run configure+make by hand in the sim subdir and use the
normal CFLAGS settings.
2016-01-10 02:54:59 -05:00
Mike Frysinger 936df7568a sim: drop common/cconfig.h in favor of a single config.h
The common subdir sets up a cconfig.h file to hold checks for the common
code.  In practice, most files still end up using config.h instead which
just leads to confusion.

Merge all the configure checks that went into cconfig.h into SIM_AC_COMMON
so we can drop the cconfig.h file altogether.  Now there is only a single
config.h file like normal.
2016-01-09 03:52:30 -05:00
Mike Frysinger 2e3d4f4d5d sim: sim_{create_inferior,open,parse_args}: constify argv/env slightly
2016-01-03  Mike Frysinger  <vapier@gentoo.org>

	* sim-options.c (sim_parse_args): Mark argv array const.
	* sim-options.h (sim_parse_args): Likewise.
2016-01-06 21:48:59 -05:00
Mike Frysinger 9bbf6f91c6 sim: punt x86-specific bswap logic
The compiler/C library should produce reasonable code for htonl/ntohl,
and at least glibc tries pretty hard to always produce good code for
them.  This logic only had support for 32-bit x86 systems anymore, and
it's unlikely people were even opting into this, so drop it all.
2016-01-04 05:04:30 -05:00
Mike Frysinger 77cf2ef5dc sim: parse_args: display getopt error ourselves
Fix a long standing todo where we let getopt write directly to stderr
when an invalid option is passed.  Use the sim io funcs instead as they
go through the filtered callbacks that gdb wants.
2016-01-03 22:07:39 -05:00
Mike Frysinger 34fed69938 sim: use libiberty countargv in more places
A bunch of places open code the countargv implementation, or outright
duplicate it (as count_argc).  Replace all of those w/countargv.
2016-01-03 04:08:56 -05:00
Mike Frysinger 0cb8d8513c sim: drop host endian configure option
The --enable-sim-hostendian flag was purely so people had an escape route
for when cross-compiling.  This is because historically, AC_C_BIGENDIAN
did not work in those cases.  That was fixed a while ago though, so we can
require that macro everywhere now and simplify a good bit of code.
2016-01-03 00:52:51 -05:00
Mike Frysinger 1ac72f0659 sim: convert to bfd_endian
Rather than re-invent endian defines, as well as maintain our own list
of OS & arch-specific includes, punt all that logic in favor of the bfd
ones already set up and maintained elsewhere.  We already rely on the
bfd library, so leveraging the endian aspect should be fine.
2016-01-03 00:18:07 -05:00
Mike Frysinger e1211e5506 sim: arm/d10v/h8300/m68hc11/microblaze/mips/mn10300/moxie/sh/v850: convert to common sim_{fetch,store}_register 2015-12-30 03:30:25 -05:00
Mike Frysinger 5e744ef887 sim: unify sim-hload
Pretty much all targets are using this module already, so add it to the
common list of objects.  The only oddball out here is cris and that's
because it supports loading via an offset for all the phdrs.  We drop
support for that.
2015-12-27 00:54:41 -05:00
Mike Frysinger 1b393626ce sim: punt WITH_DEVICES & tconfig.h support
No arch is using this anymore, and we want all new ports using the
hardware framework instead.  Punt WITH_DEVICES and the two callbacks
device_io_{read,write}_buffer.

We can also punt the tconfig.h file as no port is using it anymore.
This fixes in-tree builds that get confused by picking up the wrong
one (common/ vs <port>/) caused by commit ae7d0cac8c.

Any port that needs to set up a global define can use their own
sim-main.h file that they must provide regardless.
2015-12-26 20:38:31 -05:00
Mike Frysinger 91d6df784d sim: arm: delete unused code
These vestiges of the 20 year old emulator are just getting in the way.
Punt all the dead code we either don't compile or don't use.
2015-12-25 03:09:01 -05:00
Dominik Vogt 1d19cae752 Fix invalid left shift of negative value
Fix occurrences of left-shifting negative constants in C code.

sim/arm/ChangeLog:

	* thumbemu.c (handle_T2_insn): Fix left shift of negative value.
	* armemu.c (handle_v6_insn): Likewise.

sim/avr/ChangeLog:

	* interp.c (sign_ext): Fix left shift of negative value.

sim/mips/ChangeLog:

	* micromips.igen (process_isa_mode): Fix left shift of negative
	value.

sim/msp430/ChangeLog:

	* msp430-sim.c (get_op, put_op): Fix left shift of negative value.

sim/v850/ChangeLog:

	* simops.c (v850_bins): Fix left shift of negative value.
2015-12-15 14:09:14 +01:00
Mike Frysinger 6e4f085c7f sim: sim-close: unify sim_close logic
Other than the nice advantage of all sims having to declare one fewer
common function, this also fixes leakage in pretty much every sim.
Many were not freeing any resources, and a few were inconsistent as
to the ones they did.  Now we have a single module that takes care of
all the logic for us.

Most of the non-cgen based ones could be deleted outright.  The cgen
ones required adding a callback to the arch-specific cleanup func.
The few that still have close callbacks are to manage their internal
state.

We do not convert erc32, m32c, ppc, rl78, or rx as they do not use
the common sim core.
2015-11-15 02:30:19 -05:00
H.J. Lu 72f4393d8c Remove leading/trailing white spaces in ChangeLog 2015-07-24 04:16:47 -07:00
Nick Clifton 454de2ee15 Remove extraneous whitespace from ARM sim sources.
* armcopro.c: Remove extraneous whitespace.
	* armdefs.h: Likewise.
	* armfpe.h: Likewise.
	* arminit.c: Likewise.
	* armopts.h: Likewise.
	* armos.c: Likewise.
	* armos.h: Likewise.
	* armrdi.c: Likewise.
	* armsupp.c: Likewise.
	* armvirt.c: Likewise.
	* bag.c: Likewise.
	* bag.h: Likewise.
	* communicate.c: Likewise.
	* communicate.h: Likewise.
	* dbg_conf.h: Likewise.
	* dbg_cp.h: Likewise.
	* dbg_hif.h: Likewise.
	* dbg_rdi.h: Likewise.
	* gdbhost.c: Likewise.
	* gdbhost.h: Likewise.
	* iwmmxt.c: Likewise.
	* iwmmxt.h: Likewise.
	* kid.c: Likewise.
	* main.c: Likewise.
	* maverick.c: Likewise.
	* parent.c: Likewise.
	* thumbemu.c: Likewise.
	* wrapper.c: Likewise.
2015-07-14 12:06:33 +01:00
Nick Clifton db49d3d041 Fix snafu with latest addition to the ARM sim.
* Makefile.in (SIM_EXTRA_CFLAGS): Revert previous delta.
	(SIM_EXTRA_LIBS): Add -lm.
2015-07-02 16:19:09 +01:00
Nick Clifton 73cb0348b2 Add support for ARM v6 instructions.
* Makefile.in (SIM_EXTRA_CFLAGS): Add -lm.
	* armdefs.h (ARMdval, ARMfval): New types.
	(ARM_VFP_reg): New union.
	(struct ARMul_State): Add VFP_Reg and FPSCR fields.
	(VFP_fval, VFP_uword, VFP_sword, VFP_dval, VFP_dword): Accessor
	macros for the new VFP_Reg field.
	* armemu.c (handle_v6_insn): Add code to handle MOVW, MOVT,
	QADD16, QASX, QSAX, QSUB16, QADD8, QSUB8, UADD16, USUB16, UADD8,
	USUB8, SEL, REV, REV16, RBIT, BFC, BFI, SBFX and UBFX
	instructions.
	(handle_VFP_move): New function.
	(ARMul_Emulate16): Add checks for newly supported v6
	instructions.  Add support for VMRS, VMOV and MRC instructions.
	(Multiply64): Allow nRdHi == nRm and/or nRdLo == nRm when
	operating in v6 mode.
	* armemu.h (t_resolved): Define.
	* armsupp.c: Include math.h.
	(handle_VFP_xfer): New function.  Handles VMOV, VSTM, VSTR, VPUSH,
	VSTM, VLDM and VPOP instructions.
	(ARMul_LDC): Test for co-processor 10 or 11 and pass call to the
	new handle_VFP_xfer function.
	(ARMul_STC): Likewise.
	(handle_VFP_op): New function.  Handles VMLA, VMLS, VNMLA, VNMLS,
	VNMUL, VMUL, VADD, VSUB, VDIV, VMOV, VABS, VNEG, VSQRT, VCMP,
	VCMPE and VCVT instructions.
	(ARMul_CDP): Test for co-processor 10 or 11 and pass call to the
	new handle_VFP_op function.
	* thumbemu.c (tBIT, tBITS, ntBIT, ntBITS): New macros.
	(test_cond): New function.  Tests a condition and returns non-zero
	if the condition has been met.
	(handle_IT_block): New function.
	(in_IT_block): New function.
	(IT_block_allow): New function.
	(ThumbExpandImm): New function.
	(handle_T2_insn): New function.  Handles T2 thumb instructions.
	(handle_v6_thumb_insn): Add next_instr and pc parameters.
	(ARMul_ThumbDecode): Add support for IT blocks.  Add support for
	v6 instructions.
	* wrapper.c (sim_create_inferior): Detect a thumb address and call
	SETT appropriately.
2015-06-28 19:14:36 +01:00
Mike Frysinger 8d0978fb4b sim: use AS_HELP_STRING everywhere
This helps standardize the configure --help output.
2015-06-23 15:02:08 -04:00
Mike Frysinger b50a153264 sim: assume recentish compiler/systems
Assume the build system supports stdint.h/stdarg.h as those have been
around long enough and we don't care about pre-stdc compilers anymore.
2015-06-23 14:04:49 -04:00
Mike Frysinger 306f4178ef sim: update configure.in->configure.ac docs
A few places still refer to the configure.in file; update them.
2015-06-12 12:11:21 -04:00
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 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 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 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 bf12d44ee0 sim: fix the PKGVERSION define
This should be SIM, not GDB.
2015-04-13 02:41:10 -04:00
Mike Frysinger e787f858a4 sim: arm/mips: fix sim_read/sim_write linkage errors
With sim-hrw.o being built & linked in the common list, some people are
getting linking errors now for these targets.  Move the main objects that
provide these functions before the common list to avoid that.
2015-04-12 05:47:39 -04:00
Mike Frysinger 122bbfb52a sim: move sim-engine.o/sim-hrw.o to the common list
This makes these two objects available to all sims by default.
2015-04-06 23:56:47 -04:00
Mike Frysinger 0fe84f3fbe sim: run: punt!
Now that all targets have been converted to nrun, we can finally punt
this old inconsistent interface.

A few stray references to the old run were sprinkled about; clean them
up in the process.

We leave behind the run(1) man page mostly so that we get it updated for
the new nrun interface.
2015-04-01 01:22:44 -04:00
Mike Frysinger aadc9410ba sim: update zlib handling
With zlib being mandatory, and the updated m4 configs, we need to regen
and use the new settings w/bfd to avoid linkage errors.
2015-04-01 01:07:57 -04:00
Mike Frysinger 49d62f8925 sim: arm: convert to nrun
A lot of cpu state is stored in global variables, as is memory handling.
The sim_size support needs unwinding at some point.  But at least this
is an improvement on the status quo.
2015-03-30 12:58:24 -04:00
Mike Frysinger dbf8e8afcd sim: arm: delete NEED_UI_LOOP_HOOK handling 2015-03-30 12:58:23 -04:00
Mike Frysinger 58b991b14e sim: arm: clean up misc warnings
Also delete a few unused funcs.
2015-03-30 12:58:23 -04:00
Mike Frysinger c4c9c44f57 sim: arm: use common configure options
In preparation for converting to nrun, call the common functions that
are needed.  This doesn't produce any new warnings, and the generated
code should be the same.
2015-03-30 12:58:23 -04:00