summaryrefslogtreecommitdiff
path: root/sim/iq2000
Commit message (Collapse)AuthorAgeFilesLines
* sim: modules.c: fix generation after recent refactorsMike Frysinger2023-01-151-0/+3
| | | | | | | | | | | | | | Add explicit arch-specific modules.c rules to keep the build from generating an incorrect common/modules.c. Otherwise the pattern rules would cascade such that it'd look for $arch/modules.o which turned into common/modules.c which triggered the gen rule. My local testing of this code didn't catch this bug because of how Automake manages .Po (dependency files) in incremental builds -- it was adding extra rules that override the pattern rules which caused the build to generate correct modules.c files. But when building from a cold cache, the pattern rules would force common/modules.c to be used leading to crashes at runtime.
* sim: common: move modules.c to source trackingMike Frysinger2023-01-141-1/+2
| | | | | | This makes sure the arch-specific modules.c wildcard is matched and not the common/%.c so that we compile it correctly. It also makes sure each subdir has depdir logic enabled.
* sim: build: drop most recursive build depsMike Frysinger2023-01-141-2/+1
| | | | | | Now that we build these objects in the top dir & generate modules.c there, we don't need to generate them all first -- we can let the normal dependency graph take care of building things in parallel.
* sim: common: move libcommon.a objects to sourcesMike Frysinger2023-01-141-2/+2
| | | | | | | | | This simplifies the build logic and avoids an Automake bug where the common_libcommon_a_OBJECTS variable isn't set in the arch libsim.a DEPENDENCIES for targets that, alphabetically, come before "common". We aren't affected by that bug with the current code, but as we move things out of SIM_ALL_RECURSIVE_DEPS and rely on finer dependencies, we will trip over it.
* sim: build: drop subdir Makefile.in filesMike Frysinger2023-01-111-21/+0
| | | | These aren't used anymore, so punt them all.
* sim: move arch-specific file compilation of common/ files to top-levelMike Frysinger2023-01-101-2/+2
|
* sim: iq2000: move arch-specific file compilation to top-levelMike Frysinger2023-01-101-3/+0
|
* sim: build: drop support for creating libsim.a in subdirsMike Frysinger2023-01-101-3/+0
| | | | | Now that all ports have moved to creating libsim.a in the top-level, drop all the support code to create it in a subdir.
* sim: iq2000: move libsim.a creation to top-levelMike Frysinger2023-01-102-8/+32
| | | | | | | | | | | The objects are still compiled in the subdir, but the creation of the archive itself is in the top-level. This is a required step before we can move compilation itself up, and makes it easier to review. The downside is that each object compile is a recursive make instead of a single one. On my 4 core system, it adds ~100msec to the build per port, so it's not great, but it shouldn't be a big deal. This will go away of course once the top-level compiles objects.
* sim: modules: trigger generation from top-levelMike Frysinger2023-01-101-0/+1
| | | | | | | | | | | | | Add rules for tracking generated subdir modules.c files. This doesn't actually generate the file from the top-level, but allows us to add rules that need to be ordered wrt it. Once those changes land, we can rework this to actually generate from the top-level. This currently builds off of the objects that go into the libsim.a as we don't build those from the top-level either. Once we migrate that up, we can switch this to the source files directly. It's a bit hacky overall, but makes it easier to migrate things in smaller chunks, and we aren't going to keep this logic long term.
* sim: build: move generated headers to built sourcesMike Frysinger2023-01-021-1/+2
| | | | | | | | | | | | | | Automake's automatic header deptracking has a bootstrap problem where it can't detect generated headers when compiling. We've been handling that by adding a custom SIM_ALL_RECURSIVE_DEPS variable, but that only works when building objects recursively in subdirs. As we move those out to the top-level, we don't have any recursive steps anymore. The Automake approach is to declare those headers in BUILT_SOURCES. This isn't completely foolproof as the Automake manual documents: it only activates for `make all`, not `make foo.o`, but that shouldn't be a huge limitation as it only affects the initial compile. After that, rebuilds should work fine.
* sim: iq2000: hoist cgen rules to top-levelMike Frysinger2023-01-022-26/+11
|
* sim: replace -I$srcroot/opcodes include with -I$srcrootMike Frysinger2023-01-011-2/+2
| | | | | | Clean up includes a bit by making ports include opcodes/ headers explicitly. This matches other projects, and makes it more clear where these headers are coming from.
* sim: iq2000: drop unused cpu define logicMike Frysinger2023-01-011-6/+0
| | | | | | | | These defines seem to have been added in anticipation of adding another cpu port (IQ10BF?), but that was over 20 years ago, and that port has yet to materialize. So drop these compile flags since they don't do anything to the generated code. If another port ever shows up, it's easy enough to readd things as needed.
* Update copyright year range in header of all files managed by GDBJoel Brobecker2023-01-0115-15/+15
| | | | | | | 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.
* sim: cpu: change default init to handle all cpusMike Frysinger2022-12-251-1/+1
| | | | | | All the runtimes were only initializing a single CPU. When SMP is enabled, things quickly crash as none of the other CPU structs are setup. Change the default from 0 to the compile time value.
* sim: cgen: move symcat.h include to where it's usedMike Frysinger2022-12-231-1/+0
| | | | | | Move this out of the global sim-main.h and to the few files that actually use functions from it. Only the cgen ports were pulling this, so this makes cgen & non-cgen behave more the same.
* sim: cgen: move cgen-types.h include to cgen-defs.hMike Frysinger2022-12-231-1/+0
| | | | | | | The cgen-types.h header sets up types that are needed by cgen-defs.h, so move the include out of sim-main.h and to that header. It might be needed in other specific modules, but for now let's kick it out of sim-main.h to make some progress. Things still build with just this.
* sim: use bfd_vma when reading start addr from bfd infoMike Frysinger2022-12-221-1/+1
| | | | | | Since SIM_ADDR is always 32-bit, it might truncate the address with 64-bit ELFs. Since we load that addr from the bfd, use the bfd_vma type which matches the bfd_get_start_address API.
* sim: enable common sim_cpu usage everywhereMike Frysinger2022-12-211-2/+0
| | | | | All ports should be migrated now. Drop the SIM_HAVE_COMMON_SIM_CPU knob and require it be used everywhere now.
* sim: iq2000: invert sim_cpu storageMike Frysinger2022-12-213-11/+7
| | | | | The cpu.h change is in generated cgen code, but that has been sent upstream too, so the next regen should include it automatically.
* sim: run: move linking into top-levelMike Frysinger2022-11-051-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.
* sim: build: remove various obsolete generation dep variablesMike Frysinger2022-11-041-9/+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.
* sim: cleanup unused SIM_EXTRA_CFLAGSMike Frysinger2022-11-041-2/+0
| | | | We want to eventually delete this, so at least drop the empty ones.
* sim: common: change sim_{fetch,store}_register helpers to use void* buffersMike Frysinger2022-11-021-2/+2
| | | | | | | 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.
* sim: reg: constify store helperMike Frysinger2022-10-311-1/+1
| | | | These functions only read from memory, so mark the pointer as const.
* sim: common: change sim_read & sim_write to use void* buffersMike Frysinger2022-10-311-4/+2
| | | | | | | 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.
* sim/iq2000: silence pointer-sign warningsAndrew Burgess2022-10-192-6/+6
| | | | | | | | | | | | | | | | | | | When building the iq2000 simulator I see a few warnings like this: /tmp/build/sim/../../src/sim/iq2000/iq2000.c: In function ‘fetch_str’: /tmp/build/sim/../../src/sim/iq2000/iq2000.c:50:54: error: pointer targets in passing argument 3 of ‘sim_read’ differ in signedness [-Werror=pointer-sign] 50 | sim_read (CPU_STATE (current_cpu), CPU2DATA(addr), buf, nr); | ^~~ | | | char * I've silenced these warnings by casting buf to 'unsigned char *'. With this change I now see no warnings when compiling iq2000.c, so I've removed the line from Makefile.in that disables -Werror. Makefile.in was also disabling -Werror when compiling mloop.c, however, I'm not seeing any warnings when compiling that file, so I've removed the -Werror disable in that case too.
* sim: iq2000: migrate to standard uintXX_t typesMike Frysinger2022-01-061-4/+4
| | | | | Move off the sim-specific unsignedXX types and to the standard uintXX_t types that C11 provides.
* Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker2022-01-0115-15/+15
| | | | | | | | 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.
* sim: use ## for automake commentsMike Frysinger2021-12-091-19/+19
| | | | | | 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.
* sim: iq2000/lm32/m32c/moxie/rx: switch to new target-newlib-syscall.hMike Frysinger2021-11-281-8/+8
| | | | | | | | | Use the new target-newlib-syscall.h to provide the target syscall defines. These code paths are written specifically for the newlib ABI rather than being generalized, so switching them to the defines rather than trying to go through the dynamic callback conversion seems like the best trade-off for now. Might have to reconsider this in the future.
* sim: callback: expose argv & environMike Frysinger2021-11-161-0/+5
| | | | | Pass the existing strings data to the callbacks so that common libgloss syscalls can be implemented (which we'll do shortly).
* sim: keep track of program environment stringsMike Frysinger2021-11-161-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.
* sim: iq2000: fix some missing prototypes warningsMike Frysinger2021-11-164-5/+10
| | | | | Turns out some of these were hiding real bugs like not passing the pc variable down.
* sim: split program path out of argv vectorMike Frysinger2021-11-151-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.
* sim: hoist cgen mloop rules up to common buildsMike Frysinger2021-11-022-12/+38
| | | | | | | | | | | | 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.
* sim: iq2000: reduce -Wno-error scopeMike Frysinger2021-11-012-5/+5
| | | | | | Clean up the warnings in sim-if, then reduce the -Werror disable to the files that still aren't clean that now that we require GNU make and can set variables on a per-object basis.
* sim: tighten up stamp rulesMike Frysinger2021-10-311-1/+2
| | | | | Add a new ECHO_STAMP helper and convert existing stamp code over to it. This is mostly common rules and cgen mloop rules.
* sim: silence stamp touch rulesMike Frysinger2021-10-311-3/+3
| | | | | We pretty much never care about these stamp touches, so silence them. Also switch to using $@ when it makes sense.
* sim: standardize move-if-change rulesMike Frysinger2021-10-311-2/+2
| | | | Use the srcroot path and make them all silent.
* sim: rename ChangeLog files to ChangeLog-2021Mike Frysinger2021-08-171-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.
* sim: cris/frv/iq2000/lm32: merge with common configure scriptMike Frysinger2021-06-304-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.
* sim: unify scache settingsMike Frysinger2021-06-304-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.
* sim: move default model to the runtime sim stateMike Frysinger2021-06-305-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.
* sim: namespace sim_machsMike Frysinger2021-06-303-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.
* sim: model: constify sim_machs storageMike Frysinger2021-06-292-1/+5
| | | | | The array of pointers is never modified, so mark it const so it ends up in the read-only data section.
* sim: cgen: delete unused record_trace_results functionsMike Frysinger2021-06-282-8/+4
| | | | | Since there are no callers of this anywhere, nor is the function implemented by anyone, drop it across the board to cleanup warnings.
* sim: drop configure scripts for simple portsMike Frysinger2021-06-222-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.
* sim: unify hardware settingsMike Frysinger2021-06-213-49/+5
| | | | | Move these options up to the common dir so we only test & export them once across all ports.