Commit Graph

4325 Commits

Author SHA1 Message Date
Mike Frysinger
2fe36d31f9 cgen: split GUILE setting out
This makes it easier to override to point to an older version of guile.
The current cgen code doesn't work with guile-2, so need to point to an
older guile-1.8.
2021-07-01 18:05:40 -04:00
Mike Frysinger
79c4446067 sim: ppc: unify (most) compiler warnings with common code
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.
2021-06-30 14:41:25 -04:00
Mike Frysinger
408a44aac1 sim: cris/frv/iq2000/lm32: merge with common configure script
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.
2021-06-30 14:39:46 -04:00
Mike Frysinger
b79efe264f sim: unify scache settings
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.
2021-06-30 13:33:18 -04:00
Mike Frysinger
e7954ef5e5 sim: frv: scope the unique configure flag
This will make it possible to merge into the common configure by
making sure we never collide with other arches.
2021-06-30 13:11:12 -04:00
Mike Frysinger
6cf75d895a sim: move scache init to dynamic modules.c
Use the new modules.c framework to find & initialize this module.
2021-06-30 12:41:53 -04:00
Mike Frysinger
953fac6481 sim: move profile init to dynamic modules.c
Use the new modules.c framework to find & initialize this module.
2021-06-30 12:38:39 -04:00
Mike Frysinger
0ecdca38bc sim: move trace init to dynamic modules.c
Use the new modules.c framework to find & initialize this module.
2021-06-30 12:34:01 -04:00
Mike Frysinger
05d54a045c sim: move engine init to dynamic modules.c
Use the new modules.c framework to find & initialize this module.
2021-06-30 12:28:28 -04:00
Mike Frysinger
d8b04da736 sim: bfin: merge with common configure script
Now that the model logic has been migrated into the runtime, there's
nothing specific in the bfin configure code, so merge it into the
common one.
2021-06-30 03:01:46 -04:00
Mike Frysinger
faa09946fe sim: delete unused model settings
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.
2021-06-30 03:00:26 -04:00
Mike Frysinger
d414eb3e7f sim: move default model to the runtime sim state
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.
2021-06-30 02:57:45 -04:00
Mike Frysinger
1c636da093 sim: namespace sim_machs
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.
2021-06-30 01:52:51 -04:00
Mike Frysinger
f8261de1b2 sim: ppc: fix printf warnings
This code hits some format-zero-length warnings, so hack the code
like we did in the common layers.
2021-06-29 22:33:04 -04:00
Mike Frysinger
7f6fa74374 sim: use -Wunused-but-set-parameter
The code is already clean, so sync this over from gdb warning.m4.
Also shuffle the order of the flags a bit to match the current gdb
warning.m4 code.
2021-06-29 22:28:50 -04:00
Mike Frysinger
cc71756141 sim: fix arch Makefile regen when unified
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.
2021-06-29 22:27:16 -04:00
Mike Frysinger
3167423f07 sim: use -Wno-error=maybe-uninitialized
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.
2021-06-29 22:22:17 -04:00
Mike Frysinger
999b474b8a sim: callback: add check for HAVE_KILL
Fix building on systems w/out a kill function (e.g. Windows).
2021-06-29 20:12:57 -04:00
Mike Frysinger
c42ed5fca2 sim: cris: remove cgen-ops.h include hack
This has been upstreamed into cgen itself.
2021-06-29 20:09:17 -04:00
Mike Frysinger
ba9666525f sim: model: constify sim_machs storage
The array of pointers is never modified, so mark it const so it ends
up in the read-only data section.
2021-06-29 20:08:10 -04:00
Mike Frysinger
fda2f85e58 sim: io: add printf attributes to vprintf funcs too
The compiler can still do basic format checks with vprintf style
funcs, so add the printf attribute to these.
2021-06-29 02:20:28 -04:00
Mike Frysinger
a1d9117f94 sim: callback: add printf attributes
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.
2021-06-29 02:14:58 -04:00
Mike Frysinger
54e66d16e8 sim: callback: drop unused printf helpers
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.
2021-06-29 02:00:29 -04:00
Mike Frysinger
1fb164a112 sim: cgen: require long long support
We require C11 now, so we can assume & require long long exists.
Drop this old code that hasn't been used for a long long time.
2021-06-29 01:25:11 -04:00
Mike Frysinger
78484bcab9 sim: bpf: enable -Werror usage
Now that all bpf warnings have been cleaned up, turn on -Werror.
2021-06-28 11:30:47 -04:00
Mike Frysinger
f2ddf6e39d sim: bpf: fix printf warnings on 32-bit systems
Use PRI macros to display 64-bit types instead of assuming long is
a 64-bit type itself.
2021-06-28 11:26:09 -04:00
Mike Frysinger
ba4990f13f sim: cgen: delete unused record_trace_results functions
Since there are no callers of this anywhere, nor is the function
implemented by anyone, drop it across the board to cleanup warnings.
2021-06-28 11:25:21 -04:00
Mike Frysinger
dd5ef931df sim: frv: add missing const type 2021-06-27 23:36:56 -04:00
Mike Frysinger
520ca9a7be sim: frv: fix engine hook
This hook doesn't return a value, so don't define it to 0 to avoid
the compiler warning about it not being used.
2021-06-27 23:36:28 -04:00
Mike Frysinger
a9d200398a sim: frv: fix up various missing prototype warnings
Some of these were missing includes, some were unused funcs we can
cleanup, and some were missing prototypes for use in other files.
2021-06-27 23:35:46 -04:00
Mike Frysinger
2b83b95803 sim: frv: fix some printf type mismatch warnings
The %p usage was a real bug that would probably cause a crash.
2021-06-27 23:33:26 -04:00
Mike Frysinger
247867ebd3 sim: frv: fix uninitialized variable warning
This variable isn't set anywhere, so pass down NULL_CIA to indicate
we don't have a pc to pass.
2021-06-27 23:31:28 -04:00
Mike Frysinger
1415825a1b sim: frv: fix return type for post_wait_for funcs
These functions never return anything, so change the int return type
to void to fix a bunch of compiler warnings about missing return.
2021-06-27 23:30:01 -04:00
Mike Frysinger
ff68b4b5b1 sim: frv: fix ambiguous else compiler warnings
Add explicit braces to if bodies when the body is another if/else
to fix a bunch of compiler warnings.
2021-06-27 23:30:01 -04:00
Mike Frysinger
e0fd25e485 sim: bpf/cris: include cgen-mem in decoders
These arches use cgen memory functions, so make sure to include the
header in the modules.
2021-06-27 10:54:06 -04:00
Mike Frysinger
76f11310df sim: bpf: include more local headers & fix broken funcs
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.
2021-06-27 10:53:15 -04:00
Mike Frysinger
5db3a175cc sim: cgen: suppress trace non-literal printf warning
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.
2021-06-27 10:49:38 -04:00
Mike Frysinger
b69bd9e723 sim: cgen: add asserts to fix unused engine warnings
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.
2021-06-27 10:48:07 -04:00
Mike Frysinger
a7ffa88dc6 sim: cgen: add printf attributes in a few more calls
This helps the compiler process calls to these functions and emit
warnings about mismatched format arguments.
2021-06-27 10:46:27 -04:00
Mike Frysinger
ded82565c6 sim: cgen: constify trace strings
Shouldn't be any functional changes here.
2021-06-27 10:45:51 -04:00
Mike Frysinger
2d922d86ba sim: cgen: always leverage the mem prototypes
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.
2021-06-27 10:44:22 -04:00
Mike Frysinger
694d6fdba1 sim: cgen: always leverage the ops prototypes
This fixes missing prototype warnings, and guarantees the prototypes
stay in sync with the function definitions.
2021-06-27 10:42:51 -04:00
Mike Frysinger
5a4ce7aea0 sim: cgen: sync prototypes with implementation
These prototype blocks are not normally used, so they've fallen out
of sync with the actual function definitions.  Resync them all.
2021-06-27 10:41:02 -04:00
Mike Frysinger
44e88cd631 sim: bpf: add explicit casts when using explicit formats
Since the value variable usually has an incompatible type for the wide
variety of types it is printed as, add explicit casts to them all.
2021-06-27 10:37:37 -04:00
Mike Frysinger
cc9c19b030 sim: bpf: fix mixed decls & code warnings (and style) 2021-06-27 10:36:55 -04:00
Mike Frysinger
5d0b3088f7 sim: erc32: merge with common configure script
Move the unique library tests to the common code so we can delete
the erc32 configure logic entirely.
2021-06-27 01:21:47 -04:00
Mike Frysinger
d57b653328 sim: bfin: move pkg-config & SDL checks to common code
This reduces the unique logic in bfin/configure to make it easier to
(eventually) unify it entirely.
2021-06-27 01:18:22 -04:00
Mike Frysinger
a7cde6df40 sim: cris: fix a few missing prototype warnings
Add a stub prototype for the dump function meant to be called by devs
from gdb, and trim unused functions that aren't supposed to be used.
2021-06-24 23:52:06 -04:00
Mike Frysinger
bdedb2d21b sim: callback: extend syscall interface to handle 7 args
The Linux syscall interface, depending on architecture, handles up to
7 arguments.  Extend the callback API to handle those.
2021-06-24 23:51:16 -04:00
Mike Frysinger
2f631626f1 sim: syscall: handle killing the sim itself
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.
2021-06-23 20:11:45 -04:00