summaryrefslogtreecommitdiff
path: root/sim/riscv
Commit message (Collapse)AuthorAgeFilesLines
* sim: riscv: add missing AC_MSG_RESULT callMike Frysinger2022-11-071-0/+1
| | | | Previous commit in here forgot to include this.
* sim: riscv: drop subdir configure logicMike Frysinger2022-11-075-3129/+23
| | | | | | We've been using this only to set the default word size to 32-vs-64 based on the $target. We can easily merge this with the top-level configure script to clean things up a bit.
* sim: run: move linking into top-levelMike Frysinger2022-11-051-0/+25
| | | | | | | | | | | | | 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: 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-5/+5
| | | | | | | 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: mips/ppc/riscv: re-add AC_CANONICAL_SYSTEM [PR sim/29439]Mike Frysinger2022-10-232-0/+162
| | | | | | | | | | | | | | These configure scripts check $target and change behavior. They shouldn't be doing that, but until we can rework the sim to change behavior based on the input ELF, restore AC_CANONICAL_SYSTEM to these so that $target is correctly populated. This was lost in the d3562f83a7b8a1ae6e333cd5561419d3da18fcb4 ("sim: unify toolchain probing logic") refactor as the logic was hoisted up to the common code. But the fact the vars weren't passed down to the sub-configure scripts was missed. Bug: https://sourceware.org/PR29439
* sim/riscv: fix multiply instructions on simulatorTsukasa OI2022-10-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | After this commit: commit 0938b032daa52129b4215d8e0eedb6c9804f5280 Date: Wed Feb 2 10:06:15 2022 +0900 RISC-V: Add 'Zmmul' extension in assembler. some instructions in the RISC-V simulator stopped working as a new instruction class 'INSN_CLASS_ZMMUL' was added, and some existing instructions were moved into this class. The simulator doesn't currently handle this instruction class, and so the instructions will now cause an illegal instruction trap. This commit adds support for INSN_CLASS_ZMMUL, and adds a test that ensures the affected instructions can be executed by the simulator. Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com> Reviewed-by: Andrew Burgess <aburgess@redhat.com>
* sim/riscv: Complete tidying up with SBREAKTsukasa OI2022-09-051-3/+3
| | | | | | | | | This commit removes SBREAK-related references on the simulator as it's renamed to EBREAK in 2016 (the RISC-V ISA, version 2.1). sim/ChangeLog: * riscv/sim-main.c (execute_i): Use "ebreak" instead of "sbreak".
* sim: gdbinit: hoist setup to common codeMike Frysinger2022-02-211-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.
* sim: riscv: migrate to standard uintXX_t typesMike Frysinger2022-01-061-28/+28
| | | | | 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-016-6/+6
| | | | | | | | 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: riscv: switch to new target-newlib-syscallMike Frysinger2021-11-282-3/+2
| | | | | | Use the new target-newlib-syscall module. This is needed to merge all the architectures into a single build, and riscv has a custom syscall table for its newlib/libgloss port.
* 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-0/+6
| | | | | | | | | | | 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: split program path out of argv vectorMike Frysinger2021-11-151-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.
* sim: drop unused targ-vals.h includesMike Frysinger2021-10-311-2/+0
| | | | | This is used in a few places where it's not needed. Drop the include to avoid the build-time generated header file as we move to drop it.
* 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: unify reserved instruction bits settingsMike Frysinger2021-07-012-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.
* sim: unify scache settingsMike Frysinger2021-06-302-2/+4
| | | | | | | | | | | | | | | | 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-37/+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.
* 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: 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.
* sim: hw: rework configure option & device selectionMike Frysinger2021-06-212-37/+29
| | | | | | | | | | | | | | | | 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.
* sim: delete SIM_AC_COMMON macroMike Frysinger2021-06-204-5/+5
| | | | | Now that we've moved all content out to the common file, this is empty and can be deleted it entirely.
* sim: unify general maintainer settingsMike Frysinger2021-06-202-124/+0
| | | | | | | 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.
* sim: move sim-inline to the common codeMike Frysinger2021-06-203-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.
* sim: unify gettext/intl probing logicMike Frysinger2021-06-192-85/+0
| | | | | Move these options up to the common dir so we only test & export them once across all ports.
* sim: unify toolchain dependency logicMike Frysinger2021-06-192-1109/+1
| | | | | The common dir is already probing this info since it's using automake, so pass it down to the subdirs so they don't have to probe it at all.
* sim: unify toolchain probing logicMike Frysinger2021-06-192-1360/+26
| | | | | Move these options up to the common dir so we only test & export them once across all ports.
* sim: unify bfd library dependency testing logicMike Frysinger2021-06-193-7691/+6
| | | | | Move these options up to the common dir so we only test & export them once across all ports.
* sim: unify various library testing logicMike Frysinger2021-06-192-141/+6
| | | | | Move these options up to the common dir so we only test & export them once across all ports.
* sim: unify -Werror build settingsMike Frysinger2021-06-183-112/+6
| | | | | | Move these options up to the common dir so we only test & export them once across all ports. It also enables -Werror usage on the common files we've been pulling out of arch subdirs.
* sim: move -Werror disabling to MakefileMike Frysinger2021-06-182-5/+8
| | | | | | For the ports that still don't build with -Werror, rather than disable the flag at configure time, do it at make time. This will allow us to unify these tests in the common sim configure script.
* sim: split sim-signal.h include outMike Frysinger2021-06-182-0/+5
| | | | | | | | The sim-basics.h is too big and includes too many things. This leads to some arch's sim-main.h having circular loop issues with defs, and makes it hard to separate out common objects from arch-specific defs. By splitting up sim-basics.h and killing off sim-main.h, it'll make it easier to separate out the two.
* sim: overhaul & unify endian settings managementMike Frysinger2021-06-175-58/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The m4 macro has 2 args: the "wire" settings (which represents the hardwired port behavior), and the default settings (which are used if nothing else is specified). If none are specified, the arch is expected to support both, and the value will be probed based on the user runtime options or the input program. Only two arches today set the default value (bpf & mips). We can probably let this go as it only shows up in one scenario: the sim is invoked, but with no inputs, and no user endian selection. This means bpf will not behave like the other arches: an error is shown and forces the user to make a choice. If an input program is used though, we'll still switch the default to that. This allows us to remove the WITH_DEFAULT_TARGET_BYTE_ORDER setting. For the ports that set a "wire" endian, move it to the runtime init of the respective sim_open calls. This allows us to change the WITH_TARGET_BYTE_ORDER to purely a user-selected configure setting if they want to force a specific endianness. With all the endian logic moved to runtime selection, we can move the configure call up to the common dir so we only process it once across all ports. The ppc arch was picking the wire endian based on the target used, but since we weren't doing that for other biendian arches, we can let this go too. We'll rely on the input selecting the endian, or make the user decide.
* sim: drop obsolete AC_EXEEXT callMike Frysinger2021-06-162-2/+4
| | | | | The current autoconf 2.69 defines this to nothing because the logic in AC_PROG_CC takes care of it all the time now. Delete the call.
* sim: drop arch-specific config.hMike Frysinger2021-06-163-280/+47
| | | | | | | | | All of the settings in here are handled by the common top-level config.h, so drop the individual arch-config.h files entirely. This will also help guarantee that we don't add any new arch specific defines that would affect common code which will help with the effort of unifying them.
* sim: move dv-sockser define to CPPFLAGSMike Frysinger2021-06-153-8/+5
| | | | | This is the only define left in m4/ that is not in the common config.h, so move it to sim_hw_cflags so we can drop the arch-specific config.h.
* sim: drop redundant SIM_AC_OPTION_WARNINGSMike Frysinger2021-06-143-96/+100
| | | | | | The common code already calls this, so no need to do so in arch dirs. We leave the calls that disable -Werror. This will help unify the configure scripts.
* sim: overhaul alignment settings managementMike Frysinger2021-06-124-56/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the sim-config module will abort if alignment settings haven't been specified by the port's configure.ac. This is a bit weird when we've allowed SIM_AC_OPTION_ALIGNMENT to seem like it's optional to use. Thus everyone invokes it. There are 4 alignment settings, but really only 2 matters: strict and nonstrict. The "mixed" setting is just the default ("unset"), and "forced" isn't used directly by anyone (it's available as a runtime option for some ports). The m4 macro has 2 args: the "wire" settings (which represents the hardwired port behavior), and the default settings (which are used if nothing else is specified). If none are specified, then the build won't work (see above as if SIM_AC_OPTION_ALIGNMENT wasn't called). If default settings are provided, then that is used, but we allow the user to override at runtime. Otherwise, the "wire" settings are used and user runtime options to change are ignored. Most ports specify a default, or set the "wire" to nonstrict. A few set "wire" to strict, but it's not clear that's necessary as it doesn't make the code behavior, by default, any different. It might make things a little faster, but we should provide the user the choice of the compromises to make: force a specific mode at compile time for faster runtime, or allow the choice at runtime. More likely it seems like an oversight when these ports were initially created, and/or copied & pasted from existing ports. With all that backstory, let's get to what this commit does. First kill off the idea of a compile-time default alignment and set it to nonstrict in the common code. For any ports that want strict alignment by default, that code is moved to sim_open while initializing the sim. That means WITH_DEFAULT_ALIGNMENT can be completely removed. Moving the default alignment to the runtime also allows removal of setting the "wire" settings at configure time. Which allows removing of all arguments to SIM_AC_OPTION_ALIGNMENT and moving that call to common code. The macro logic can be reworked to not pass WITH_ALIGNMENT as -D CPPFLAG and instead move it to config.h. All of these taken together mean we can hoist the macro up to the top level and share it among all sims so behavior is consistent among all the ports.
* sim: unify bug & package settingsMike Frysinger2021-06-123-87/+2
| | | | | | Move these options up to the common dir so we only test & export them once across all ports. The AC_INIT macro does a lot of the heavy lifting already which allows further simplification.
* sim: unify debug/stdio/trace/profile build settingsMike Frysinger2021-06-122-150/+2
| | | | | | | | | Move these options up to the common dir so we only test & export them once across all ports. The ppc code needs a little extra care with its trace settings as it's not exactly the same API as the common code. The other knobs are the same though.
* sim: unify environment build settingsMike Frysinger2021-06-123-32/+2
| | | | | Move the --sim-enable-environment option up to the common dir so we only test & export it once across all ports.
* sim: unify assert build settingsMike Frysinger2021-06-124-28/+6
| | | | | Move the --sim-enable-assert option up to the common dir so we only test & export it once across all ports.
* sim: unify platform function & header testsMike Frysinger2021-06-123-552/+6
| | | | | | | | | | Move the various platform tests up a level to avoid duplication across the ports. When building multiple versions, this speeds things up a bit. For now we move the obvious stuff up a level, but we don't turn own the config.h entirely just yet -- we still have some tests related to libraries that need consideration.
* sim: fully merge sim_state_base into sim_stateMike Frysinger2021-05-172-2/+4
| | | | | Now that all ports have migrated to the new framework, drop support for the old sim_state_base layout.
* sim: riscv: invert sim_state storageMike Frysinger2021-05-174-12/+22
|