aboutsummaryrefslogtreecommitdiff
path: root/sim/cris
AgeCommit message (Collapse)AuthorFilesLines
2023-01-01Update copyright year range in header of all files managed by GDBJoel Brobecker29-29/+29
This commit is the result of running the gdb/copyright.py script, which automated the update of the copyright year range for all source files managed by the GDB project to be updated to include year 2023.
2022-11-05sim: run: move linking into top-levelMike Frysinger1-0/+8
Automake will run each subdir individually before moving on to the next one. This means that the linking phase, a single threaded process, will not run in parallel with anything else. When we have to link ~32 ports, that's 32 link steps that don't take advantage of parallel systems. On my really old 4-core system, this cuts a multi-target build from ~60 sec to ~30 sec. We eventually want to move all compile+link steps to this common dir anyways, so might as well move linking now for a nice speedup. We use noinst_PROGRAMS instead of bin_PROGRAMS because we're taking care of the install ourselves rather than letting automake process it.
2022-11-05sim: cris: move rvdummy linking to top-levelMike Frysinger2-12/+8
This is only used by `make check`, so we can move it out of the default build too.
2022-11-04sim: build: remove various obsolete generation dep variablesMike Frysinger1-20/+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-04sim: build: switch to libtool for linkingMike Frysinger1-1/+2
The top-level already sets up a libtool script for the host, so use that when linking rather than invoking CC directly. This will also happen when we (someday) move the building to pure automake.
2022-11-02sim: common: change sim_{fetch,store}_register helpers to use void* buffersMike Frysinger1-4/+4
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 Frysinger2-2/+2
These functions only read from memory, so mark the pointer as const.
2022-10-31sim: common: change sim_read & sim_write to use void* buffersMike Frysinger1-1/+1
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-11sim/cris: Add ATTRIBUTE_PRINTFTsukasa OI1-1/+1
Clang generates a warning if the format string of a printf-like function is not a literal ("-Wformat-nonliteral"). On the default configuration, it causes a build failure (unless "--disable-werror" is specified). To avoid warnings on the printf-like wrapper, it requires proper __attribute__((format)) and we have ATTRIBUTE_PRINTF macro for this reason. This commit adds ATTRIBUTE_PRINTF to a printf-like function.
2022-08-06Don't use BFD_VMA_FMT in gdb and simAlan Modra1-12/+13
Like commit b82817674f, this replaces BFD_VMA_FMT "x" in sim/ with PRIx64 and casts to promote bfd_vma to uint64_t. The one file using BFD_VMA_FMT in gdb/ instead now uses hex_string, and a typo in the warning message is fixed.
2022-06-15sim: fix BFD_VMA format arguments on 32-bit hosts [PR gdb/29184]Sergei Trofimovich1-4/+6
Noticed format mismatch when attempted to build gdb on i686-linux-gnu in --enable-64-bit-bfd mode: sim/../../sim/cris/sim-if.c:576:28: error: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'bfd_size_type' {aka 'long long unsigned int'} [-Werror=format=] 576 | sim_do_commandf (sd, "memory region 0x%" BFD_VMA_FMT "x,0x%lx", | ^~~~~~~~~~~~~~~~~~~ 577 | interp_load_addr, interpsiz); | ~~~~~~~~~ | | | bfd_size_type {aka long long unsigned int} While at it fixed format string for time-related types.
2022-05-13sim: remove use of PTRAlan Modra2-3/+3
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-04-04sim: fixes for libopcodes styled disassemblerAndrew Burgess1-1/+2
In commit: commit 60a3da00bd5407f07d64dff82a4dae98230dfaac Date: Sat Jan 22 11:38:18 2022 +0000 objdump/opcodes: add syntax highlighting to disassembler output I broke several sim/ targets by forgetting to update their uses of the libopcodes disassembler to take account of the new styled printing. These should all be fixed by this commit. I've not tried to add actual styled output to the simulator traces, instead, the styled print routines just ignore the style and print the output unstyled.
2022-02-14sim cris: Unbreak --disable-sim-hardware buildsHans-Peter Nilsson1-0/+8
With --disable-sim-hardware (--enable-sim-hardware=no), whose default was changed to --enable-sim-hardware(=yes) in commit 34cf51120683, building for cris-elf fails as sim_hw_parse then doesn't exist. A cris-elf simulator configured for --enable-sim-hardware (or the default after to the mentioned commit) runs about 2.5x slower than one configured --disable-sim-hardware. A further 2-5% performance regression was not investigated. When sim_hw_parse doesn't exist, --cris-900000xx can't be supported. The best action here is to remove it completely, so its absence can be identified through --help, but avoiding littering the code with "#if WITH_HW". sim/cris: * sim-if.c (cris_options) [WITH_HW]: Conditionalize support of option --cris-900000xx. (sim_open) [WITH_HW]: Conditionalize sim_hw_parse call.
2022-02-14sim cris: Correct PRIu32 to PRIx32Hans-Peter Nilsson1-1/+1
In 5ee0bc23a68f "sim: clean up bfd_vma printing" there was an additional introduction of PRIx32 and PRIu32 but just in sim/cris/sim-if.c. One type of bug was fixed in commit d16ce6e4d581 "sim: cris: fix memory setup typos" but one remained; the PRIu32 usage is wrong, as hex output is desired; note the 0x prefix. Without this fix, you'll see output like: memory map 0:0x4000..0x5fff (8192 bytes) overlaps 0:0x0..0x16383 (91012 bytes) program stopped with signal 6 (Aborted). for some C programs, like some of the ones in the sim/cris/c testsuite from where the example is taken (freopen2.c). The bug behavior was with memory allocation. With an attempt to allocate memory using the brk syscall such that the room up to the next 8192-byte "page boundary" wasn't sufficient, the simulator memory allocation machinery horked on a consistency error when trying to allocate a memory block to raise the "end of the data segment": there was already memory allocated at that address. Unfortunately, none of the programs in sim/cris/asm exposed this bug at the time, but an assembler test-case is committed after this fix. sim/cris: * sim-if.c (sim_open): Correct PRIu32 to PRIx32.
2022-01-06sim: cris: migrate to standard uintXX_t typesMike Frysinger7-80/+80
Move off the sim-specific unsignedXX types and to the standard uintXX_t types that C11 provides.
2022-01-01Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker29-29/+29
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-22/+22
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-4/+12
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-2/+8
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: cris: touch up rvdummy handlingMike Frysinger1-2/+2
Add quiet build support and make sure it's removed with `make clean`.
2021-11-15sim: split program path out of argv vectorMike Frysinger1-7/+3
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-08sim: cris: clean up missing func prototype warningsMike Frysinger4-6/+6
Move some unused funcs under existing #if 0 protection, mark a few local funcs as static, and add missing prototypes for the rest which are used from other files. This fixes all the fatal warnings in the mloop files so we can turn -Werror on here fully.
2021-11-03sim: mloop: mark a few conditionally used funcs as unusedMike Frysinger1-1/+2
These are marked inline, so building w/gcc at higher optimization levels will automatically discard them. But building with -O0 will trigger unused function warnings, so fix that. The common before/after cover functions in the common mloop generator are not used by all architecture ports. Doesn't seem to be a hard requirement, so marking them optional (i.e. unused) is fine. The cris execute function is conditionally used depending on the fast-build mode settings, so mark it unused too.
2021-11-02sim: hoist cgen mloop rules up to common buildsMike Frysinger2-31/+55
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: cris: 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: tighten up stamp rulesMike Frysinger1-2/+4
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-5/+5
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-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-06-30sim: cris/frv/iq2000/lm32: merge with common configure scriptMike Frysinger4-2896/+6
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 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-28/+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: 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 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 Frysinger3-16/+5
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: bpf/cris: include cgen-mem in decodersMike Frysinger3-0/+7
These arches use cgen memory functions, so make sure to include the header in the modules.
2021-06-24sim: cris: fix a few missing prototype warningsMike Frysinger3-32/+11
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-23sim: cris: override getpid callbackMike Frysinger2-0/+13
The cris linux syscall layers assume getpid returns a constant, so add a custom function to provide that.
2021-06-22sim: cris: fix a few warningsMike Frysinger2-2/+9
Include header for hw funcs called, adjust prototype to match the args given to it, and adjust cast to match the function.
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-52/+47
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: cris: clean up printf & abort usage a bitMike Frysinger2-40/+43
Inline the stats printf calls to avoid compiler warnings about non-literal format strings. This in turn highlights bad type sizes being passed in, so fix the strings to use the right size type. This in turn highlights the rest of the func using casts rather than the right type directly, so adjust all of those. Finally, replace a few abort+sim_engine_halt calls with the common sim_engine_abort. This provides good output while still aborting as we want.
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.