Building the sim on a sparc-solaris 2.8 machine fails when configured
with no extra sim hardware:
> for hw in ; do \
> echo "extern const struct hw_descriptor
> dv_${hw}_descriptor[];" ; \
> done >> tmp-hw.h
> echo 'const char version[] = "'"`sed q
> /[...]/../../gdb/version.in`"'";'
> >> version.c-tmp
> /bin/sh: -c: line 1: syntax error near unexpected token `;'
> /bin/sh: -c: line 1: `for hw in ; do \'
> make[3]: *** [hw-config.h] Error 2
The same thing happens with the version of bash that we got from
Sun as well (which is very old: 2.03.0(1)-release).
The problems comes from the fact that both shells are buggy, and
reject the following script:
for hw in ; do
[...]
done
The above is what sim/common/Makefile.in tries to execute when
generating hw-config.h.
In order to allow users to build out of the box on these machines,
this patch works around this bug. It does rely on the fact that
none of the tokens in SIM_HW contain whitespaces.
sim/common/ChangeLog:
* Make-common.in (hw-config.h): Work around bug in Solaris 2.8
system bourne shell.
Parsing target addresses is hard if not generally useless, so use the new
cb_get_string function to lookup the associated strings as well. Now the
trace output is quickly useful instead of just marginally so.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
The common sim code provides a useful "get_string" function which reads
a C string out of the target's memory space. So rename and export it
for other people to use.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Lift the code that GDB is using to generate dependencies on the fly and
port it over to the sim. Now people shouldn't have to manually maintain
these in their Makefile's.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Some systems (like OS X) do not have posix_fallocate. Add a configure
check for it before we try to use it. This is less work than trying
to support old systems.
URL: http://sourceware.org/bugzilla/show_bug.cgi?id=13161
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Automake likes to dump macros automatically used into the aclocal.m4
file, but the common/aclocal.m4 naming prevents that. So rename it
to the more normal "acinclude.m4" so the aclocal tool can work.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Now that the sourceware tree generally requires autoconf-2.64, update
the sim tree to require that too.
This allows us to drop the long standing SIM_AC_COMMON/common.m4
workaround as autoconf 2.64+ seems to work for me.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
The dv-cfi code uses the bool type but doesn't include the stdbool.h
header. I didn't notice for Blackfin targets as the core Blackfin
header will include stdbool.h, but most targets don't do this.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
The "devices.h" header is Blackfin-specific, so trying to build dv-cfi
for any other target fails. Include the specific hw headers this file
needs directly.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Seems some fixes were added to the common.m4 file but not the
SIM_AC_COMMON macro. Keep the two in sync since they're supposed
to be the same thing.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
The VIT_MAX insns can be used in parallel, so we need to use the store
buffer so we don't clobber the output register before we get a chance
to do a memory store with it.
Reported-by: Kai Iskratsch <kai@stella.at>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
The sim_args_command prototype is in sim-options.h, so pull it in
directly rather than assuming a common header does it.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Shell code before AC_INIT will be silently culled, and since the common
aclocal.m4 includes inline shell code, the file cannot be included before
AC_INIT. So update the example to show people including the file after
that rather than before to avoid random breakage.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
The autoconf guys point out that our usage of AC_PROG_CC in the
SIM_AC_COMMON does not jive with their intended use.
http://www.gnu.org/software/autoconf/manual/autoconf.html#Expanded-Before-Required
So utilize AC_REQUIRE to make the warnings go away and generate
the correct code with different autoconf versions.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
The sim dir has 30 configure.ac files and 2 configure.in files.
So rename the minority to be consistent.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* gen.c (insn_field_cmp): Tweak comment about neither field
being an insn_field_string with a cond_eq-to-value condition.
(insns_bit_useless) <case insn_field_string, case
decode_find_mixed>: Handle cond_eq-to-value fields as
insn_field_int.
* gen-idecode.c (print_idecode_validate): Handle
insn_field_string cond-equal-to-value fields as insn_field_int.
* gen-icache.c (print_icache_body): Add comment why constant
string fields are handled.
Since sim_do_command for many people simply calls sim_args_command, start
a unified version of it. For people who handle their own options, they
could switch to this by using sim_add_option_table instead.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
The stat syscalls cannot work without a stat map, so declare one that
matches libgloss for virtual environments.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* iwmmxt.c (WCMPGT): Sign extend 32-bit values before performing a
signed compare.
(WMAC): Extend computed result before adding to result register.
(WRSA): Sign extend 32-bit values before shifting.
Now that the Blackfin libgloss code extracts the 2nd result and the
error code from the R1/R2 registers, have the sim fill them up.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
The LSHIFT/ASHIFT insns that work with accumulators lacked AV/AVS
handling in the ASTAT register, so add it to match the hardware.
Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
If we're shifting accumulators, we don't want to touch the V bit in
ASTAT, so add size checks to the ashiftrt/lshiftrt helpers.
Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
The logical shift insn does not sign extend before shifting, so
we shouldn't either.
Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This too should have been squashed into an earlier change. It covers
a few more cases in the V/VS saturation patch when working with TFU
and FU modes of dsp insns.
Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
When the shift magnitude exceeds 32 bits, the values rotate around (since
the hardware is actually a barrel shifter). So handle this edge case,
update the corresponding AV bit in ASTAT which was missing previously,
and tweak the AZ setting based on how the hardware behaves.
Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
The shift magnitude is a 5-bit signed value. When it is between 0 and
15, then we do the requested shift, but when it is outside of that, we
have to do the opposite.
That means we flip between lshift and ashiftrt to match the hardware.
Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This reverts the previous commit and does it right. This change got
lost in the shuffle of patches I have pending.
Basically the logic is to change the 32bit saturation (and then masked
to 16bits) to a proper 16bit saturation.
Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Some saturation cases with dsp mac insns were not setting the V flag.
So implement that part and split up the logic between the dual macs.
Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Our handling of the M_IU/M_TFU modes are missing signed saturation when
the MM flag is set, so add it to match the hardware behavior.
Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
After testing the hardware with all the different dsp flags, the MM flag
triggers sign extension in all modes. So drop the limited use of it, and
the local custom helper that was also extending unsigned values. We also
can see that the flag checks in the mult/mac insns have the same behavior
with sign extending, so add a helper func to keep the logic the same in
both places.
Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
When using the IH modifier, we need to first saturate the value before
rounding it, and then further saturate it a bit more. This makes the
sim match the hardware behavior with these insns.
Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>