aboutsummaryrefslogtreecommitdiff
path: root/sim/m32r
AgeCommit message (Collapse)AuthorFilesLines
2022-11-04sim: build: remove various obsolete generation dep variablesMike Frysinger1-6/+0
These manual settings were necessary when we weren't doing automatic header dependency tracking. That was changed a while ago, and we use automake now to do it all for us. As a result, many of these vars aren't even referenced anymore. Further, some of the source file generation (e.g. .c files, or igen, or cgen outputs) were moved to the common automake build, and it takes care of dependency tracking for us with the object files.
2022-11-02sim: common: change sim_{fetch,store}_register helpers to use void* buffersMike Frysinger3-6/+6
When reading/writing arbitrary data to the system's memory, the unsigned char pointer type doesn't make that much sense. Switch it to void so we align a bit with standard C library read/write functions, and to avoid having to sprinkle casts everywhere.
2022-10-31sim: reg: constify store helperMike Frysinger3-3/+3
These functions only read from memory, so mark the pointer as const.
2022-10-29sim/m32r: Initialize "list" variableTsukasa OI1-1/+1
The variable "list" is only initialized when arg1 > 0 and when arg1 == 0, an uninitialized value is passed to translate_endian_h2t function. Although this behavior is harmless, this commit adds initialization to avoid a GCC warning ("-Wmaybe-uninitialized").
2022-05-13sim: remove use of PTRAlan Modra1-2/+2
PTR will soon disappear from ansidecl.h. Remove uses in sim. Where a PTR cast is used in assignment or function args to a void* I've simply removed the unnecessary (in C) cast rather than replacing with (void *).
2022-01-01Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker37-37/+37
This commit brings all the changes made by running gdb/copyright.py as per GDB's Start of New Year Procedure. For the avoidance of doubt, all changes in this commits were performed by the script.
2021-12-09sim: use ## for automake commentsMike Frysinger1-21/+21
The ## marker tells automake to not include the comment in its generated output, so use that in most places where the comment only makes sense in the inputs.
2021-11-16sim: callback: expose argv & environMike Frysinger1-3/+8
Pass the existing strings data to the callbacks so that common libgloss syscalls can be implemented (which we'll do shortly).
2021-11-16sim: keep track of program environment stringsMike Frysinger1-1/+7
We've been passing the environment strings to sim_create_inferior, but most ports don't do anything with them. A few will use ad-hoc logic to stuff the stack for user-mode programs, but that's it. Let's formalize this across the board by storing the strings in the normal sim state. This will allow (in future commits) supporting more functionality in the run interface, and to unify some of the libgloss syscalls.
2021-11-15sim: split program path out of argv vectorMike Frysinger1-5/+1
We use the program argv to both find the program to run (argv[0]) and to hold the arguments to the program. Most of the time this is fine, but if we want to let programs specify argv[0] independently (which is possible in standard *NIX programs), this double duty doesn't work. So let's split the path to the program to run out into a separate field by itself. This simplifies the various sim_open funcs too. By itself, this code is more of a logical cleanup than something that is super useful. But it will open up customization of argv[0] in a follow up commit. Split the changes to make it easier to review.
2021-11-02sim: hoist cgen mloop rules up to common buildsMike Frysinger2-56/+66
These rules don't depend on the target compiler settings, so hoist the build logic up to the common builds for better parallelization. We have to extend the genmloop.sh logic a bit to allow outputting to a subdir since it always assumed cwd was the right place. We leave the cgen maintainer rules in the subdirs for now as they aren't normally run, and they rely on cgen logic that has not yet been generalized.
2021-11-01sim: m32r: reduce -Wno-error scopeMike Frysinger1-2/+2
Only two files in here still generates warnings, so reduce the -Werror disable to that now that we require GNU make and can set variables on a per-object basis.
2021-10-31sim: drop unused targ-vals.h includesMike Frysinger1-1/+0
This is used in a few places where it's not needed. Drop the include to avoid the build-time generated header file as we move to drop it.
2021-10-31sim: tighten up stamp rulesMike Frysinger1-3/+6
Add a new ECHO_STAMP helper and convert existing stamp code over to it. This is mostly common rules and cgen mloop rules.
2021-10-31sim: silence stamp touch rulesMike Frysinger1-7/+7
We pretty much never care about these stamp touches, so silence them. Also switch to using $@ when it makes sense.
2021-10-31sim: standardize move-if-change rulesMike Frysinger1-6/+6
Use the srcroot path and make them all silent.
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-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: m32r: merge with common configure scriptMike Frysinger4-2896/+6
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 Frysinger2-8/+8
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-06-30sim: unify scache settingsMike Frysinger4-34/+7
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 default model to the runtime sim stateMike Frysinger5-24/+9
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 Frysinger3-1/+11
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: model: constify sim_machs storageMike Frysinger2-1/+5
The array of pointers is never modified, so mark it const so it ends up in the read-only data section.
2021-06-28sim: cgen: delete unused record_trace_results functionsMike Frysinger4-24/+6
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-24sim: callback: extend syscall interface to handle 7 argsMike Frysinger2-0/+8
The Linux syscall interface, depending on architecture, handles up to 7 arguments. Extend the callback API to handle those.
2021-06-22sim: drop configure scripts for simple portsMike Frysinger2-0/+11
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 Frysinger3-49/+5
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 Frysinger4-39/+32
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: delete SIM_AC_COMMON macroMike Frysinger4-5/+5
Now that we've moved all content out to the common file, this is empty and can be deleted it entirely.
2021-06-20sim: unify general maintainer settingsMike Frysinger3-124/+5
Move these options up to the common dir so we only test & export them once across all ports. This takes a page from the cgen maint logic to make $(MAINT) work for non-automake Makefiles which will allow us to merge it together.
2021-06-20sim: unify cgen maintainer settingsMike Frysinger5-45/+6
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 Frysinger3-36/+5
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: unify gettext/intl probing logicMike Frysinger2-85/+0
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-1109/+1
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-1360/+26
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 Frysinger3-7691/+6
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-141/+6
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 Frysinger3-112/+6
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: move -Werror disabling to MakefileMike Frysinger4-103/+113
For the ports that still don't build with -Werror, rather than disable the flag at configure time, do it at make time. This will allow us to unify these tests in the common sim configure script.
2021-06-18sim: split sim-signal.h include outMike Frysinger3-0/+7
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-17sim: overhaul & unify endian settings managementMike Frysinger5-56/+9
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.
2021-06-16sim: drop obsolete AC_EXEEXT callMike Frysinger2-2/+4
The current autoconf 2.69 defines this to nothing because the logic in AC_PROG_CC takes care of it all the time now. Delete the call.
2021-06-16sim: drop arch-specific config.hMike Frysinger3-280/+47
All of the settings in here are handled by the common top-level config.h, so drop the individual arch-config.h files entirely. This will also help guarantee that we don't add any new arch specific defines that would affect common code which will help with the effort of unifying them.
2021-06-15sim: move dv-sockser define to CPPFLAGSMike Frysinger3-8/+5
This is the only define left in m4/ that is not in the common config.h, so move it to sim_hw_cflags so we can drop the arch-specific config.h.
2021-06-12sim: start unifying portability shimsMike Frysinger2-0/+5
There are some functions that gnulib does not yet provide fallbacks for, so start a common file of our own for holding existing stubs.