aboutsummaryrefslogtreecommitdiff
path: root/sim/bpf
AgeCommit message (Collapse)AuthorFilesLines
2024-01-29sim: bpf: remove support for ldinddw and ldabsdw instructionsJose E. Marchesi1-13/+0
This patch removes support for the two instructions above from the GNU simulator, including the corresponding tests. These instructions do not really exist in BPF and are not recognized as such by the kernel verifier. This has now been pointed out during the standardization of the BPF ISA. Signed-off-by: Jose E. Marchesi <jose.marchesi@oracle.com>
2024-01-12Update copyright year range in header of all files managed by GDBAndrew Burgess5-5/+5
This commit is the result of the following actions: - Running gdb/copyright.py to update all of the copyright headers to include 2024, - Manually updating a few files the copyright.py script told me to update, these files had copyright headers embedded within the file, - Regenerating gdbsupport/Makefile.in to refresh it's copyright date, - Using grep to find other files that still mentioned 2023. If these files were updated last year from 2022 to 2023 then I've updated them this year to 2024. I'm sure I've probably missed some dates. Feel free to fix them up as you spot them.
2023-12-19sim: bpf: fix -Wunused-variable warningsMike Frysinger1-2/+0
2023-08-21sim: bpf: remove negi, neg32i insnsDavid Faust1-8/+0
The BPF virtual machine does not support neg instructions operating on immediates, and these erroneous instructions were recently removed from gas. Remove them from the simulator as well.
2023-07-26bpf: fix neg and neg32 BPF instructions in simulatorJose E. Marchesi1-2/+2
This patch fixes the semantics of the neg and neg32 BPF instructions in the simulator, and also updates the corresponding tests accordingly. Tested in target bpf-unknown-none.
2023-07-21sim/bpf: desCGENization of the BPF simulatorJose E. Marchesi25-11249/+1474
The BPF port in binutils has been rewritten (commit d218e7fedc74d67837d2134120917f4ac877454c) in order to not be longer based on CGEN. Please see that commit log for more information. This patch updates the BPF simulator accordingly. The new implementation is much simpler and it is based on the new BPF opcodes. Tested with target bpf-unknown-none with both 64-bit little-endian host and 32-bit little-endian host. Note that I have not tested in a big-endian host yet. I will do so once this lands upstream so I can use the GCC compiler farm.
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-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-11sim: build: drop subdir Makefile.in filesMike Frysinger1-25/+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: bpf: move arch-specific file compilation to top-levelMike Frysinger2-26/+8
We can drop the arch-specific rules from the subdir as they're no longer used.
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: bpf: move libsim.a creation to top-levelMike Frysinger2-12/+36
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-2/+4
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-02sim: bpf: hoist cgen rules to top-levelMike Frysinger2-90/+40
2023-01-01sim: replace -I$srcroot/opcodes include with -I$srcrootMike Frysinger1-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.
2023-01-01Update copyright year range in header of all files managed by GDBJoel Brobecker26-26/+26
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-23sim: cgen: move cgen-types.h include to cgen-defs.hMike Frysinger1-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.
2022-12-22sim: use bfd_vma when reading start addr from bfd infoMike Frysinger1-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.
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-21sim: bpf: invert sim_cpu storageMike Frysinger3-7/+13
The cpu.h change is in generated cgen code, but that has been sent upstream too, so the next regen should include it automatically.
2022-11-07sim: bpf: drop subdir configure logicMike Frysinger4-2955/+2
We've been using this only to set the default word size to 64. 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-19/+1
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-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.
2022-10-31sim: reg: constify store helperMike Frysinger1-1/+1
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-01Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker26-26/+26
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-17/+17
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-0/+5
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-4/+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-27/+50
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-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-8/+8
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-4/+4
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 Frysinger2-2/+4
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 Frysinger4-26/+6
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-23/+8
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/+13
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: bpf: enable -Werror usageMike Frysinger2-3/+4
Now that all bpf warnings have been cleaned up, turn on -Werror.
2021-06-28sim: bpf: fix printf warnings on 32-bit systemsMike Frysinger2-1/+5
Use PRI macros to display 64-bit types instead of assuming long is a 64-bit type itself.
2021-06-28sim: cgen: delete unused record_trace_results functionsMike Frysinger2-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.
2021-06-27sim: bpf/cris: include cgen-mem in decodersMike Frysinger3-0/+9
These arches use cgen memory functions, so make sure to include the header in the modules.