Copy most of the common build warning logic over from the common
code to help keep code behavior a bit consistent, and turn them
on by default. We disable a few flags for now until we can clean
the code up.
Now that the scache logic has been migrated into the common code,
there's nothing specific in these configure scripts, so merge them
into the common one.
The frv unique logic can be moved to a dedicated include and merged
in the common configure since the flag has been scoped to the arch.
The cgen scache module is enabled by every cgen port, and with the
same default value of 16k (which matches the common default value).
Let's pull this option out of the individual ports (via CPPFLAGS)
and into the common code (via config.h).
The object itself is compiled only for cgen ports atm, so that part
doesn't change. The scache code is initialized dynamically via the
modules.c logic. That's why the profile code needs an additional
CGEN_ARCH check.
This will allow us to collapse arch configure files more. Merging
the source files will require more future work, but integrating the
cgen & non-cgen worlds itself will take a lot.
These were never fully migrated from the psim to common code, and since
we've finished moving the logic into the runtime sim state, we won't ever
need these. So punt them.
This kills off another compile-time option by moving the setting to
the individual arch runtimes. This will allow dynamic selection by
the arch when doing a single build with multiple arches.
The sim_model_init rework is a little funky. In the past it was
disabled entirely if no default model was set. We maintain the
spirit of the logic by gating the fallback logic on whether the
port has defined any models.
We want to do a single build with all arches in one binary which means
we need to namespace sim_machs on a per-arch basis. Move it from a
global variable to the sim description structure so it can be setup at
runtime.
Changing the SIM_MODEL->num from an enum to an int is unfortunate, but
we specifically don't want to maintain a centralized list anymore, and
this was never used directly in common code, just passed to per-arch
callbacks.
The $(arch) variable is only setup for cgen ports, so calculate this
value dynamically. We also need to generate multiple inputs in order
to properly recreate the subdir Makefile, so list them all.
We have some code tripping this warning, but it depends on the gcc
version & optimization levels. We've added some hints to the code
so some versions of gcc work better, but still not all. Let's just
disable the warning like gdb does.
This helps these funcs get printf format checking coverage.
The sim-io.c hack as a result is a bit unfortunate, but the compiler
throws warnings when printing with empty strings. In this one case,
we actually want that due to the side-effect of the callback halting
execution for us.
These cover functions aren't used anywhere, so drop them. There was
one caller, but it's old DOS code that most likely hasn't been tested
in years, so just delete that too.
Various files were not including the relevant headers, or some funcs
were missing prototypes entirely, leading to mismatch between the
actual definition of the functions. Add includes to a few places and
fix the broken functions that are uncovered as a result. Fixing some
compile warnings (e.g. missing prototypes) often find real bugs.
The cgen trace macros are a bit ugly in that they specify a series of
format strings & arguments in a single call. This means we pass a
non-literal string to printf and the compiler warns about it. Use
the diagnostic macros to suppress that in this one place.
If the user passed in values outside the range of [0, MAX_NR_PROCESSORS),
it would cause the code to access out-of-bind engine function pointers.
Add some asserts to catch that and to fix the related compiler warnings.
This fixes missing prototype warnings, and guarantees the prototypes
stay in sync with the function definitions. One of the macros had
fallen out by declaring the wrong return type.
If code tries to send a signal to itself, the callback layer ignores
it and forces the caller to handle it. This allows the sim to turn
that into an engine halt rather than actually killing the sim.