aboutsummaryrefslogtreecommitdiff
path: root/sim
AgeCommit message (Collapse)AuthorFilesLines
2021-08-22sim: m32r: add __linux__ hack for non-Linux hostsMike Frysinger1-0/+8
The m32r Linux syscall emulation logic assumes the host environment directly matches -- it's being run on 32-bit little endian Linux. This breaks building for non-Linux systems, so put all the code in __linux__ ifdef checks. This code needs a lot of love to make it work everywhere, but let's at least unbreak it for non-Linux hosts.
2021-08-19sim: nltvals: switch output mode to a directoryMike Frysinger3-9/+10
In preparation for this script generating more files, change the output argument to specify a directory. This drops the stdout behavior, but since no one really runs this tool directly, it's not a big deal.
2021-08-17sim: nltvals: localize TARGET_<ERRNO> definesMike Frysinger2-17/+11
Code should not be using these directly, instead they should be resolving these dynamically via cb_host_to_target_errno maps. Fix the Blackfin code and remove the defines out of the header so no new code can rely on them.
2021-08-17sim: rename ChangeLog files to ChangeLog-2021Mike Frysinger66-2168/+2170
Now that ChangeLog entries are no longer used for sim patches, this commit renames all relevant sim ChangeLog to ChangeLog-2021, similar to what we would do in the context of the "Start of New Year" procedure. The purpose of this change is to avoid people merging ChangeLog entries by mistake when applying existing commits that they are currently working on. Also throw in a .gitignore entry to keep people from adding new ChangeLog files anywhere in the sim tree.
2021-07-08sim: erc32: use libsim.a for common objectsMike Frysinger1-2/+2
We're starting to move more objects to the common build that sis did not need before, so linking them is causing problems (when common objects end up needing symbols from non-common objects). Switch it to the libsim.a archive which will allow the link to pull out only what it needs.
2021-07-06sim: ppc: add missing empty targetsDan Streetman1-0/+12
These are copied from sim/common/Make-common.in. On ppc the build fails without at least the 'info' target, e.g.: Making info in ppc make[4]: Entering directory '/<<BUILDDIR>>/gdb-10.2.2974.g5b45e89f56d+21.10.20210510155809/build/default/sim/ppc' make[4]: *** No rule to make target 'info'. Stop.
2021-07-01sim: unify reserved instruction bits settingsMike Frysinger33-140/+100
Move these options up to the common dir so we only test & export them once across all ports. The setting only affects igen based ports, and they were turning this on by default, so keep the default in place.
2021-07-01sim: m32r: merge with common configure scriptMike Frysinger8-2902/+35
Now that the traps code has been unified, the configure script has no unique logic in it, so it can be merged into the single common one.
2021-07-01sim: m32r: reformat linux traps codeMike Frysinger2-1067/+1067
Do this as a sep commit to try and make the history easier to review.
2021-07-01sim: m32r: unify ELF & Linux traps logicMike Frysinger8-1385/+1207
This makes the simulator work the same regardless of the target (bare metal m32r-elf or Linux m32r-linux-gnu) by unifying the traps code. It was mostly already the same with the only difference being support for trap #2 reserved for Linux syscalls. We can move that logic to runtime by checking the current environment operating mode instead.
2021-07-01sim: m32r: replace custom endian helpers with sim-endianMike Frysinger2-107/+90
This improves the logic a bit by making the host<->target translations a bit more clear. The structs still bleed way too much between the two worlds, but let's fix one thing at a time.
2021-07-01sim: m32r: fix virtual environment with Linux targetsMike Frysinger5-8/+15
We don't want to handle Linux syscalls when in the virtual environment, just the user environment, so adjust the Linux traps logic to check for that specifically (instead of just skipping the operating environment). Also tweak some testcases to explicitly specify the environment they run under rather than relying on the default matching their needs. This gets the tests passing for all m32r targets.
2021-07-01sim: m32r: namespace Linux syscall tableMike Frysinger3-370/+377
The use of __NR_ defines in here conflicts a lot with the standard host syscalls, sometimes leading to build errors (when the numbers happen to be the same we get duplicate case handlers), and other times leading to misbehavior (where the m32r syscall # is not what is actually checked). Namespace these using the standard that we already use: change the __NR_ to TARGET_LINUX_SYS_ with a simple `sed`. Also add a few missing includes so the code at least compiles.
2021-07-01cgen: split GUILE setting outMike Frysinger2-1/+7
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-06-30sim: ppc: unify (most) compiler warnings with common codeMike Frysinger3-5/+73
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-30sim: cris/frv/iq2000/lm32: merge with common configure scriptMike Frysinger21-11650/+185
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-30sim: unify scache settingsMike Frysinger45-254/+109
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-30sim: frv: scope the unique configure flagMike Frysinger4-29/+41
This will make it possible to merge into the common configure by making sure we never collide with other arches.
2021-06-30sim: move scache init to dynamic modules.cMike Frysinger4-7/+12
Use the new modules.c framework to find & initialize this module.
2021-06-30sim: move profile init to dynamic modules.cMike Frysinger4-8/+11
Use the new modules.c framework to find & initialize this module.
2021-06-30sim: move trace init to dynamic modules.cMike Frysinger4-8/+11
Use the new modules.c framework to find & initialize this module.
2021-06-30sim: move engine init to dynamic modules.cMike Frysinger4-6/+10
Use the new modules.c framework to find & initialize this module.
2021-06-30sim: bfin: merge with common configure scriptMike Frysinger8-2912/+43
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-30sim: delete unused model settingsMike Frysinger2-23/+6
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-30sim: move default model to the runtime sim stateMike Frysinger62-298/+120
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-30sim: namespace sim_machsMike Frysinger35-46/+167
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-29sim: ppc: fix printf warningsMike Frysinger3-2/+16
This code hits some format-zero-length warnings, so hack the code like we did in the common layers.
2021-06-29sim: use -Wunused-but-set-parameterMike Frysinger3-12/+25
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-29sim: fix arch Makefile regen when unifiedMike Frysinger2-1/+7
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-29sim: use -Wno-error=maybe-uninitializedMike Frysinger3-0/+9
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-29sim: callback: add check for HAVE_KILLMike Frysinger2-0/+9
Fix building on systems w/out a kill function (e.g. Windows).
2021-06-29sim: cris: remove cgen-ops.h include hackMike Frysinger2-4/+5
This has been upstreamed into cgen itself.
2021-06-29sim: model: constify sim_machs storageMike Frysinger21-15/+60
The array of pointers is never modified, so mark it const so it ends up in the read-only data section.
2021-06-29sim: io: add printf attributes to vprintf funcs tooMike Frysinger2-2/+9
The compiler can still do basic format checks with vprintf style funcs, so add the printf attribute to these.
2021-06-29sim: callback: add printf attributesMike Frysinger2-1/+7
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-29sim: callback: drop unused printf helpersMike Frysinger3-66/+8
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-29sim: cgen: require long long supportMike Frysinger3-29/+6
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-28sim: bpf: enable -Werror usageMike Frysinger2-3/+4
Now that all bpf warnings have been cleaned up, turn on -Werror.
2021-06-28sim: bpf: fix printf warnings on 32-bit systemsMike Frysinger2-1/+5
Use PRI macros to display 64-bit types instead of assuming long is a 64-bit type itself.
2021-06-28sim: cgen: delete unused record_trace_results functionsMike Frysinger17-80/+31
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-27sim: frv: add missing const typeMike Frysinger2-1/+5
2021-06-27sim: frv: fix engine hookMike Frysinger2-1/+5
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-27sim: frv: fix up various missing prototype warningsMike Frysinger6-1/+22
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-27sim: frv: fix some printf type mismatch warningsMike Frysinger3-2/+7
The %p usage was a real bug that would probably cause a crash.
2021-06-27sim: frv: fix uninitialized variable warningMike Frysinger2-2/+6
This variable isn't set anywhere, so pass down NULL_CIA to indicate we don't have a pc to pass.
2021-06-27sim: frv: fix return type for post_wait_for funcsMike Frysinger3-19/+31
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-27sim: frv: fix ambiguous else compiler warningsMike Frysinger4-25/+43
Add explicit braces to if bodies when the body is another if/else to fix a bunch of compiler warnings.
2021-06-27sim: bpf/cris: include cgen-mem in decodersMike Frysinger6-0/+16
These arches use cgen memory functions, so make sure to include the header in the modules.
2021-06-27sim: bpf: include more local headers & fix broken funcsMike Frysinger5-10/+25
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-27sim: cgen: suppress trace non-literal printf warningMike Frysinger2-0/+10
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.