aboutsummaryrefslogtreecommitdiff
path: root/sim/common
AgeCommit message (Collapse)AuthorFilesLines
2023-01-14sim: common: simplify hw-config.h depsMike Frysinger1-3/+1
Now that all ports (other than ppc) build in the top-level, we don't need to expand all the hw-config.h targets as a recursive dep. Each port depends on their respective header now, and the ppc port doesn't use it at all.
2023-01-14sim: build: drop AM_MAKEFLAGS settingsMike Frysinger1-4/+0
We don't have any recursive builds anymore, so we can drop this logic.
2023-01-13sim: build: delete Make-common.in logicMike Frysinger2-211/+0
Now that all (other than ppc) build in the top-level, this logic is unused, so punt it all.
2023-01-10sim: common: move test-hw-events to top-level buildMike Frysinger3-5/+11
This is an internal developer target that isn't normally compiled, but it can still be occasionally useful. Move it to the top-level build so we can kill off common/Make-common.in.
2023-01-10sim: build: add basic framework for compiling arch objects in top-levelMike Frysinger2-2/+3
The code so far has been assuming that we only compile common/ objects. Now that we're ready to compile arch-specific objects, refactor some of the flags & checks a bit to support both.
2023-01-10sim: modules.c: move generation to top-levelMike Frysinger2-28/+25
Now that all arches create libsim.a from the top-level, we have full access to their inputs, and can move the actual generation from the subdir up to the top-level. This avoids recursive makes and will help simplify state passing between the two.
2023-01-10sim: build: drop support for creating libsim.a in subdirsMike Frysinger1-37/+3
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: aarch64: move libsim.a creation to top-levelMike Frysinger1-1/+2
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: build: drop support for subdir extra depsMike Frysinger1-14/+0
Nothing uses this hook anymore, so punt it. It was largely used to track generated files (which we do in the top-level now) and extra header files (which we use automake depgen for now).
2023-01-10sim: modules: trigger generation from top-levelMike Frysinger2-3/+18
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: common: drop libcommon.a linkageMike Frysinger1-3/+1
All of these objects should be in libsim.a already, so don't link to it too. In practice it never gets used, but no point in listing it.
2023-01-02sim: cgen: drop common subdir build rulesMike Frysinger1-68/+0
Now that everything has been hoisted to the top-level, we can delete this unused logic.
2023-01-02sim: cgen: hoist rules to the top-level buildMike Frysinger1-0/+60
The rules seem to generate the same output as existing subdir cgen rules with cgen ports, so hopefully this should be correct. These are the last set of codegen rules that we run in subdirs, so this will help unblock killing off subdir builds entirely.
2023-01-01sim: replace -I$srcroot/bfd include with -I$srcrootMike Frysinger1-1/+1
Clean up includes a bit by making ports include bfd/ headers explicitly. This matches other projects, and makes it more clear where these headers are coming from.
2023-01-01sim: replace -I$srcroot/opcodes include with -I$srcrootMike Frysinger1-1/+1
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.
2023-01-01sim: build: drop unused SIM_EXTRA_LIBSMike Frysinger1-3/+1
Now that all run binaries are linked in the topdir, this subdir libs variable isn't used anywhere, so punt it.
2023-01-01sim: refresh copyright dates a bitMike Frysinger1-1/+1
Update a few files that were missed, and revert the generated Automake output that uses dates from Automake itself.
2023-01-01Update copyright year range in header of all files managed by GDBJoel Brobecker123-123/+123
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-27sim: build: clean up unused codegen logicMike Frysinger1-8/+1
Now that all igen ports are in the top-level makefile, we don't need this logic in any subdirs anymore, so clean it up.
2022-12-25sim: build: drop support for subdir distcleanMike Frysinger1-5/+2
All ports that need to clean things up at distclean time have moved to the top-level build, so we can drop support for this hook.
2022-12-25sim: smp: plumb igen flag down to all usersMike Frysinger1-1/+1
While mips has respected sim_igen_smp at configure time (which was always empty since it defaulted smp to off), no other igen port did. Move this to a makefile variable and plumb it through the common IGEN_RUN variable instead so everyone gets it by default. We also clean up some redundant -N0 setting with multirun mips.
2022-12-25sim: cpu: change default init to handle all cpusMike Frysinger1-0/+5
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: cpu: fix SMP msg prefix helperMike Frysinger1-4/+7
This code fails to compile when SMP is enabled due to some obvious errors. Fix those and change the logic to avoid CPP to prevent any future rot from creeping back in.
2022-12-23sim: cgen: move symcat.h include to where it's usedMike Frysinger4-0/+7
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.
2022-12-23sim: cgen: move cgen-types.h include to cgen-defs.hMike Frysinger1-0/+2
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.
2022-12-22sim: endian: move bfd.h from header to sourceMike Frysinger2-2/+2
The bfd APIs are used only by sim-n-endian.h which is only included by sim-endian.c, so move the bfd.h include there and out of sim-endian.h which is included by many other modules.
2022-12-22sim: move bfd.h include out of sim-main.hMike Frysinger3-0/+4
Not all arches include this in sim-main.h, and the ones that do don't actually use bfd defines in the sim-main.h header. Prune it to make sim-main.h simpler so we can kill it off entirely in the future. We add the include to the files that utilize e.g. bfd_vma though.
2022-12-22sim: switch sim_{read,write} APIs to 64-bit all the time [PR sim/7504]Mike Frysinger2-6/+6
We've been using SIM_ADDR which has always been 32-bit. This means the upper 32-bit address range in 64-bit sims is inaccessible. Use 64-bit addresses all the time since we want the APIs to be stable regardless of the active arch backend (which can be 32 or 64-bit). The length is also 64-bit because it's completely feasible to have a program that is larger than 4 GiB in size/image/runtime. Forcing the caller to manually chunk those accesses up into 4 GiB at a time doesn't seem useful to anyone. Bug: https://sourceware.org/PR7504
2022-12-21sim: hw-config.h: move generation to top-levelMike Frysinger2-18/+21
In order to compile arch objects from the top-level, we need to generate the hw-config.h header, so move that logic up to the top level first.
2022-12-21sim: build: hoist lists of hw devices upMike Frysinger1-1/+1
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: build: hoist lists of common objects upMike Frysinger2-45/+56
In order to create libsim.a in the common dir, we need the list of objects for each target. To avoid duplicating the list with the recursive make in each port, pass it down as a variable. This is a temporary hack until the top-level creates libsim.a for ports.
2022-12-21sim: fully merge sim_cpu_base into sim_cpuMike Frysinger1-26/+19
Now that all ports have migrated to the new framework, drop support for the old sim_cpu_base layout. There's a lot of noise here, so it's been split into a dedicated commit.
2022-12-21sim: enable common sim_cpu usage everywhereMike Frysinger2-12/+1
All ports should be migrated now. Drop the SIM_HAVE_COMMON_SIM_CPU knob and require it be used everywhere now.
2022-12-21sim: cgen: prep for inverting sim_cpu storageMike Frysinger2-0/+15
Some common cgen code changes to allow cgen ports to invert their sim_cpu storage one-by-one.
2022-12-20sim: sim_cpu: invert sim_cpu storageMike Frysinger2-8/+35
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-12-19sim: dv-core: add hw_detach_address method [PR sim/25211]Mike Frysinger1-0/+18
The core device has an attach address method as the root of the tree which calls out to the sim API. But it doesn't have a corresponding detach method which means we just crash if anything tries to detach itself from the core. In practice, the m68hc11 is the only model that actually tries to detach itself on the fly, so no one noticed earlier. With this in place, we can delete the existing detach code from the m68hc11 model since it defaults to "passthru" callback which will in turn call the dv-core detach, and they have the same behavior -- call the sim core API to detach from the address space. Bug: https://sourceware.org/PR25211
2022-11-05sim: run: move linking into top-levelMike Frysinger2-7/+19
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: build: add uninstall supportMike Frysinger1-0/+1
This never worked before, but adding it to the common top-level dir is pretty easy to do now that we're unified.
2022-11-05sim: build: move install steps to the top-levelMike Frysinger1-33/+1
We still have to maintain custom install rules due to how we rename arch-specific files with an arch prefix in their name, but we can at least unify the logic in the common dir.
2022-11-05sim: drop unused SIM_HARDWARE variableMike Frysinger1-2/+1
This hasn't been used since the refactor way back in commit f872d0d643968c1101bb8c07b252edd54f626da2 ("Only enable H/W on some mips targets."), so punt it.
2022-11-04sim: build: remove various obsolete generation dep variablesMike Frysinger1-127/+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: drop duplicate $(LIBS) usageMike Frysinger1-2/+1
COMMON_LIBS is set to $(LIBS), and CONFIG_LIBS is set to that plus @LIBS@. This leds to the values being used twice. Inline the CONFIG_LIBS variable without @LIBS@ since it's used only once.
2022-11-04sim: build: switch to bfd & opcodes libtool linker scriptsMike Frysinger1-9/+7
Now that we use libtool to link, we don't need to duplicate all the libs that bfd itself uses. This simplifies the configure & Makefile.
2022-11-04sim: build: switch to libtool for linkingMike Frysinger1-5/+7
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-03sim: update --version copyright yearMike Frysinger1-1/+1
Probably should have done this 11 months ago ...
2022-11-03sim: move common flags to default AM_CPPFLAGSMike Frysinger2-7/+4
Since all host files we compile use these settings, move them out of libcommon.a and into the default AM_CPPFLAGS. This has the effect of dropping the custom per-target automake rules. Currently it saves us ~150 lines, but since it's about ~8 lines per object, the overhead will increase quite a bit as we merge more files into a single build. This also changes the object output names, so we have to tweak the rules that were pulling in the common objects when linking.
2022-11-03sim: common: remove unused include pathsMike Frysinger1-3/+3
A bunch of these paths don't include any headers, and most likely never will, so there's no real need to keep them. This will let us harmonize paths with the top-level Makefile more easily, which will in turn make it easier to move more compile steps there.
2022-11-02sim: split CPPFLAGS between build & hostMike Frysinger1-0/+1
In order to merge more common/ files into the top-level, we need to add more host flags to CPPFLAGS, and that conflicts with our current use with build-time tools. So split them apart like we do with all other build flags to avoid the issue.
2022-11-02sim: common: change sim_{fetch,store}_register helpers to use void* buffersMike Frysinger2-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.