aboutsummaryrefslogtreecommitdiff
path: root/sim/mn10300
AgeCommit message (Collapse)AuthorFilesLines
2023-12-21sim: signal: mark signal callback funcs as noreturn since they don't returnMike Frysinger2-2/+3
All funcs already call other funcs that don't return. The mips port is the only exception because its generic exception handler can return in the case of normal exceptions. So while the exceptions its signal handler triggers doesn't return, we can't express that conditional logic. So add some useless abort calls to make the compiler happy.
2023-12-21sim: mn10300: fix LAST_TIMER_REG typoMike Frysinger1-1/+1
The compiler pointed out that we're testing LAST_TIMER_REG and LAST_COUNTER which are the same value ... and that's because we set LAST_TIMER_REG to the wrong register. Fix the typo.
2023-12-19sim: mn10300: fix -Wunused-variable warningsMike Frysinger2-9/+0
2023-12-15sim: mn10300: fix incorrect implementation of a few insnsMike Frysinger1-7/+7
Fix a few problems caught by compiler warnings: * Some of the asr & lsr insns were setting up the c state flag, but then forgetting to set it in the PSW. Add it like the other asr & lsr variants. * Some of the dmulh insns were multiplying one of the source regs against itself instead of against the other source reg. * The sat16_cmp parallel insn was using the wrong register in the compare -- the reg1 src/dst pair are used in the sat16 op, and the reg2 src/dst pair are used in the add op.
2023-12-05sim: mn10300: fix sim_engine_halt callMike Frysinger1-1/+2
The sim_stop argument is an enum and should only be one of those values, not a signal constant. Fix the logic to pass the right sim_xxx & SIM_xxx values in the right arguments.
2023-01-19sim: mn10300: minimize mn10300-sim.h include in sim-main.hMark Wielaard4-0/+17
sim-main.h is special since it is one of the files automatically included in igen generated files. But this means anything including sim-main.h might get everything included just for the igen files. To prevent clashing symbols/defines only include sim-fpu.h, sim-signal.h, mn10300-sim.h from sim-main.h if it is included from one of the generated igen C files. Add explicit includes of mn10300-sim.h, sim-fpu.h and/or sim-signal.h to dv-mn103cpu.c, interp.c and op_utils.c.
2023-01-16sim: formally assume unistd.h always exists (via gnulib)Mike Frysinger1-2/+0
We have many uses of unistd.h that are unprotected by HAVE_UNISTD_H, so this is more formalizing the reality that we require this header. Since we switched to gnulib, it guarantees that a unistd.h exists for us to include, so we're doubly OK.
2023-01-15sim: modules.c: fix generation after recent refactorsMike Frysinger1-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.
2023-01-15sim: microblaze, mn10300: remove signal.h include in interp.cMark Wielaard1-2/+0
signal.h isn't needed in microblaze and mn10300 interp.c so don't include it.
2023-01-14sim: common: move modules.c to source trackingMike Frysinger1-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.
2023-01-14sim: build: drop most recursive build depsMike Frysinger1-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.
2023-01-14sim: common: move libcommon.a objects to sourcesMike Frysinger1-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.
2023-01-14sim: build: drop AM_MAKEFLAGS settingsMike Frysinger1-1/+0
We don't have any recursive builds anymore, so we can drop this logic.
2023-01-11sim: build: drop subdir Makefile.in filesMike Frysinger1-27/+0
These aren't used anymore, so punt them all.
2023-01-10sim: move arch-specific file compilation of common/ files to top-levelMike Frysinger1-2/+2
2023-01-10sim: mn10300: move arch-specific file compilation to top-levelMike Frysinger1-3/+4
The arch-specific compiler flags are duplicated, but they'll be cleaned up once we move all subdir compiles to the top-level.
2023-01-10sim: build: drop support for creating libsim.a in subdirsMike Frysinger1-2/+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.
2023-01-10sim: mn10300: move libsim.a creation to top-levelMike Frysinger2-7/+28
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.
2023-01-10sim: modules: trigger generation from top-levelMike Frysinger1-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.
2023-01-02sim: build: move generated headers to built sourcesMike Frysinger1-0/+9
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.
2023-01-01Update copyright year range in header of all files managed by GDBJoel Brobecker8-8/+8
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-12-25sim: cpu: change default init to handle all cpusMike Frysinger1-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.
2022-12-25sim: mn10300: fix SMP compileMike Frysinger3-18/+18
The igen tool sets up the SD define for code fragments to use, but mn10300 was expecting "sd". Change all the igen related code to use SD so it actually compiles.
2022-12-24sim: igen: drop move-if-changed usageMike Frysinger1-30/+15
Now that igen itself has this logic, drop these custom build rules to greatly simplify.
2022-12-23sim: mn10300: standardize the arch-specific settings a littleMike Frysinger4-43/+27
Rename mn10300_sim.h to mn10300-sim.h to match other ports, and move most of the arch-specific content out of sim-main.h to it. This isn't a big win though as we still have to include the header in sim-main.h due to the igen interface: it hardcodes including sim-main.h in its files. So until we can fix that, we have to keep bleeding these settings into the common codes. Also take the opportunity to purge a lot of unused headers from these. The local modules should already include the right headers, so there's no need to force everyone to pull them in. A lot of this is a hold over from the pre-igen days of this port.
2022-12-23Revert "sim: mn10300: drop unused sim-main.c"Mike Frysinger1-0/+9
This reverts commit 681a422b855e4b20086554b170dae051361f00c7. I missed that this was included via common/sim-inline.c. I thought I had grepped the top of the tree, but I must have only done mn10300. Add a comment to make it clear where/how this file is used.
2022-12-22sim: mn10300: drop unused sim-main.cMike Frysinger1-4/+0
Nothing compiles or references this, so punt it.
2022-12-21sim: build: hoist lists of hw devices upMike Frysinger2-2/+5
We need these in the top-level to generate libsim.a, but also in the subdirs to generate hw-config.h. Move it to the local.mk, and pass it down when running recursive make. This avoids duplication, and makes it available to both. We can simplify this once we move the various steps up to the top-level too.
2022-12-21sim: enable common sim_cpu usage everywhereMike Frysinger1-2/+0
All ports should be migrated now. Drop the SIM_HAVE_COMMON_SIM_CPU knob and require it be used everywhere now.
2022-12-20sim: sim_cpu: invert sim_cpu storageMike Frysinger1-11/+2
Currently all ports have to declare sim_cpu themselves in their sim-main.h and then embed the common sim_cpu_base in it. This dynamic makes it impossible to share common object code among multiple ports because the core data structure is always different. Let's invert this relationship: common code declares sim_cpu, and the port uses the new arch_data field for its per-cpu state. This is the first in a series of changes: it adds a define to select between the old & new layouts, then converts all the ports that don't need custom state over to the new layout. This includes mn10300 that, while it defines custom fields in its cpu struct, never uses them.
2022-11-07sim: mn10300: drop subdir configure logicMike Frysinger4-2956/+3
We've been using this only to set the default word size to 32. We can easily move this into the makefile via a -D compiler flag and clean up the build logic quite a bit.
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-04sim: build: remove various obsolete generation dep variablesMike Frysinger1-3/+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 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 Frysinger1-3/+3
These functions only read from memory, so mark the pointer as const.
2022-02-21sim: gdbinit: hoist setup to common codeMike Frysinger1-9/+0
This was left in subdirs because of the dynamic cgen usage. However, we can move this breakpoint call to runtime and let gdb detect whether the symbol exists.
2022-01-06sim: mn10300: migrate to standard uintXX_t typesMike Frysinger11-505/+498
This old port setup its own uintXX types, but since we require C11 now, we can assume the standard uintXX_t types exist and use them.
2022-01-01Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker8-8/+8
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-18/+18
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-28sim: mn10300: resolve syscalls dynamicallyMike Frysinger3-5/+4
Avoid use of TARGET_<syscall> defines and rely on the callback layers to resolve these dynamically so we can support multiple syscall layers instead of assuming the newlib/libgloss numbers all the time.
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 mn10300 & v850 igen rules up to common buildsMike Frysinger2-71/+90
These rules don't depend on the target compiler settings, so hoist the build logic up to the common builds for better parallelization. We leave the mips rules in place as they depend on complicated arch-specific configure logic that needs to be untangled first.
2021-10-31sim: mn10300: clean up pointer castsMike Frysinger2-9/+9
The void *data field is used to past arbitrary data between event handlers, and these are using it to pass an enum. Fix up the casts to avoid using (long) to cast to/from pointers since there is no guarantee that's the right size.
2021-10-31sim: igen: tighten up build outputMike Frysinger1-1/+1
Add a new stamp helper for quiet builds, and don't dump the command line options when it runs. That isn't standard tool behavior, and doesn't really seem necessary in any way.
2021-10-31sim: silence stamp touch rulesMike Frysinger1-1/+1
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-15/+15
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-07-01sim: unify reserved instruction bits settingsMike Frysinger4-24/+6
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-06-30sim: unify scache settingsMike Frysinger1-2/+0
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 Frysinger2-2/+4
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.