aboutsummaryrefslogtreecommitdiff
path: root/sim/common
AgeCommit message (Collapse)AuthorFilesLines
2021-08-19sim: nltvals: switch output mode to a directoryMike Frysinger1-5/+8
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 Frysinger1-5/+1
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 Frysinger1-0/+0
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-01sim: unify reserved instruction bits settingsMike Frysinger2-2/+4
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-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: unify scache settingsMike Frysinger4-8/+8
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: 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: 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 Frysinger5-16/+21
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 Frysinger7-37/+67
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: 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: callback: add check for HAVE_KILLMike Frysinger2-0/+9
Fix building on systems w/out a kill function (e.g. Windows).
2021-06-29sim: model: constify sim_machs storageMike Frysinger3-6/+15
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-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.
2021-06-27sim: cgen: add asserts to fix unused engine warningsMike Frysinger2-1/+8
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-27sim: cgen: add printf attributes in a few more callsMike Frysinger2-2/+7
This helps the compiler process calls to these functions and emit warnings about mismatched format arguments.
2021-06-27sim: cgen: constify trace stringsMike Frysinger3-8/+17
Shouldn't be any functional changes here.
2021-06-27sim: cgen: always leverage the mem prototypesMike Frysinger2-14/+55
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-27sim: cgen: always leverage the ops prototypesMike Frysinger2-50/+50
This fixes missing prototype warnings, and guarantees the prototypes stay in sync with the function definitions.
2021-06-27sim: cgen: sync prototypes with implementationMike Frysinger2-17/+27
These prototype blocks are not normally used, so they've fallen out of sync with the actual function definitions. Resync them all.
2021-06-23sim: syscall: handle killing the sim itselfMike Frysinger2-2/+18
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-23sim: callback: add a kill interfaceMike Frysinger3-0/+35
This will make it easier to emulate the syscall. If the kill target is the sim itself, don't do anything. This forces the higher layers to make a decision as to how to handle this event: like halting the overall engine process.
2021-06-23sim: switch common srcdir to abs_srcdirMike Frysinger2-1/+5
We rewrite srcdir in subdir Makefiles that we generate from the common parent dir since it points to the parent dir. Since @srcdir@ can be a variety of formats (relative & absolute), switch to @abs_srcdir@ which is a lot easier to adjust. Our use of srcdir in here should handle it.
2021-06-22sim: callback: add missing cb_target_to_host_signalMike Frysinger2-0/+17
There's been a prototype for this forever, but the implementation was missing. Probably because there weren't any callers, but we'll start using it to implement the kill function.
2021-06-22sim: callback: generate signal mapMike Frysinger3-0/+36
We've been generating the syscall/errno/open maps, but not the signal map, even though we've been including them in the source constants.
2021-06-22sim: callback: add a getpid interfaceMike Frysinger3-1/+21
Rather than hit the OS interface directly, use the existing callback layer so the instantiator can decide behavior.
2021-06-22sim: drop configure scripts for simple portsMike Frysinger2-7/+20
These ports only use the pieces that have been unified, so we can merge them into the common configure script and get rid of their unique one entirely. We still compile & link separate run programs, and have dedicated subdir Makefiles, but the configure script portion is merged.
2021-06-21sim: unify hardware settingsMike Frysinger2-4/+4
Move these options up to the common dir so we only test & export them once across all ports.
2021-06-21sim: hw: rework configure option & device selectionMike Frysinger2-4/+14
The sim-hardware configure option allows builders to select a set of device models to enable. But this seems like unnecessary overkill: the existence of individual device models doesn't affect performance at all as they are only enabled at runtime if the config uses them, and individually these are all <5KB a piece. Stripping off a total of ~50KB from a ~1MB binary doesn't seem useful, and it's extremely unlikely anyone will ever bother. So let's simplify the configure/make logic by turning sim-hardware into a boolean option like many of the other sim options. Any ports that have unique device models will declare them in their Makefile instead of at configure time. This will allow us to (eventually) unify the setting into the common dir.
2021-06-20sim: unify cgen maintainer settingsMike Frysinger2-1/+4
Move these options up to the common dir so we only test & export them once across all ports. It makes it available to targets that aren't cgen-based, but those will just ignore the settings, so it shouldn't be an issue.
2021-06-20sim: move sim-inline to the common codeMike Frysinger2-1/+4
This will allow us to build the common code with the same inline settings as the arch subdirs, and only do the test once.
2021-06-19sim: move UNUSED before TYPE in SIM_ENDIAN_INLINE's definitionSimon Marchi2-27/+31
I get this when building with gcc 11: CC common/common_libcommon_a-sim-load.o In file included from /home/simark/src/binutils-gdb/sim/common/sim-n-bits.h:27, from /home/simark/src/binutils-gdb/sim/common/sim-bits.c:259, from /home/simark/src/binutils-gdb/sim/common/sim-bits.h:599, from /home/simark/src/binutils-gdb/sim/common/sim-basics.h:122, from /home/simark/src/binutils-gdb/sim/common/sim-load.c:30: /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:39:27: error: 'offset_16' defined but not used [-Werror=unused-function] 39 | #define offset_N XCONCAT2(offset_,N) | ^~~~~~~ /home/simark/src/binutils-gdb/sim/../include/symcat.h:23:26: note: in definition of macro 'CONCAT2' 23 | #define CONCAT2(a,b) a##b | ^ /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:39:18: note: in expansion of macro 'XCONCAT2' 39 | #define offset_N XCONCAT2(offset_,N) | ^~~~~~~~ /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:138:1: note: in expansion of macro 'offset_N' 138 | offset_N (unsigned_N *x, | ^~~~~~~~ offset_N uses INLINE_SIM_ENDIAN, which uses UNUSED to put the "unused" attribute. However, it appears after the function's return type, which seems to make it not apply to the function. Moving it to before the return type fixes the error. Change all instances found in that file. sim/common/ChangeLog: * sim-inline.h: Move UNUSED before TYPE. Change-Id: Ide20106683ed7a9ebf35d484dabf70b309cb1ba6
2021-06-19sim: drop old BUILT_SRC_FROM_COMMON refMike Frysinger2-3/+4
The code that set & used this variable was deleted long ago, but the clean target was missed. Clean that up now.
2021-06-19sim: unify gettext/intl probing logicMike Frysinger2-3/+6
Move these options up to the common dir so we only test & export them once across all ports.
2021-06-19sim: unify toolchain dependency logicMike Frysinger2-2/+4
The common dir is already probing this info since it's using automake, so pass it down to the subdirs so they don't have to probe it at all.
2021-06-19sim: unify toolchain probing logicMike Frysinger2-22/+4
Move these options up to the common dir so we only test & export them once across all ports.
2021-06-19sim: unify bfd library dependency testing logicMike Frysinger2-3/+7
Move these options up to the common dir so we only test & export them once across all ports.
2021-06-19sim: unify various library testing logicMike Frysinger2-1/+5
Move these options up to the common dir so we only test & export them once across all ports.
2021-06-18sim: unify -Werror build settingsMike Frysinger2-2/+4
Move these options up to the common dir so we only test & export them once across all ports. It also enables -Werror usage on the common files we've been pulling out of arch subdirs.
2021-06-18sim: create a makefile fragment to pass common settings downMike Frysinger2-0/+7
As we merge settings from subdirs into the common configure, we sometimes need to keep the settings working in both dirs. Create a makefile fragment to pass them down so we don't have to run the checks twice. For now, the file is empty, but we'll start moving logic in shortly.
2021-06-18sim: split sim-signal.h include outMike Frysinger12-1/+17
The sim-basics.h is too big and includes too many things. This leads to some arch's sim-main.h having circular loop issues with defs, and makes it hard to separate out common objects from arch-specific defs. By splitting up sim-basics.h and killing off sim-main.h, it'll make it easier to separate out the two.
2021-06-18sim: drop core libiberty.h includeMike Frysinger2-2/+4
This doesn't need to be included for every sim file, so drop it. Every C file that needs it seems to already include it.
2021-06-17sim: overhaul & unify endian settings managementMike Frysinger4-15/+8
The m4 macro has 2 args: the "wire" settings (which represents the hardwired port behavior), and the default settings (which are used if nothing else is specified). If none are specified, the arch is expected to support both, and the value will be probed based on the user runtime options or the input program. Only two arches today set the default value (bpf & mips). We can probably let this go as it only shows up in one scenario: the sim is invoked, but with no inputs, and no user endian selection. This means bpf will not behave like the other arches: an error is shown and forces the user to make a choice. If an input program is used though, we'll still switch the default to that. This allows us to remove the WITH_DEFAULT_TARGET_BYTE_ORDER setting. For the ports that set a "wire" endian, move it to the runtime init of the respective sim_open calls. This allows us to change the WITH_TARGET_BYTE_ORDER to purely a user-selected configure setting if they want to force a specific endianness. With all the endian logic moved to runtime selection, we can move the configure call up to the common dir so we only process it once across all ports. The ppc arch was picking the wire endian based on the target used, but since we weren't doing that for other biendian arches, we can let this go too. We'll rely on the input selecting the endian, or make the user decide.