aboutsummaryrefslogtreecommitdiff
path: root/sim
AgeCommit message (Collapse)AuthorFilesLines
2022-12-21sim: moxie: invert sim_cpu storageMike Frysinger2-14/+13
2022-12-21sim: msp430: invert sim_cpu storageMike Frysinger3-120/+106
2022-12-21sim: ft32: invert sim_cpu storageMike Frysinger3-95/+99
2022-12-21sim: bfin: invert sim_cpu storageMike Frysinger2-10/+5
2022-12-20sim: sim_cpu: invert sim_cpu storageMike Frysinger7-39/+45
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-20sim: move register headers into sim/ namespace [PR sim/29869]Mike Frysinger16-16/+16
These headers define the register numbers for each port to implement the sim_fetch_register & sim_store_register interfaces. While gdb uses these, the APIs are part of the sim, not gdb. Move the headers out of the gdb/ include namespace and into sim/ instead.
2022-12-20sim: ppc: drop old dgen.c generatorMike Frysinger3-363/+6
The spreg.[ch] files live in the source tree now and are created with the dgen.py script, so we don't need this old tool anymore.
2022-12-20sim: ppc: move spreg.[ch] files to the source treeMike Frysinger5-0/+1608
Simplify the build by moving the generation of these files from build-time (via dgen.c that we have to compile & execute on the build system) to maintainer/release mode (via spreg-gen.py that we only ever execute when the spreg table actually changes). It speeds up the build process and makes it easier for us to reason about & review changes to the code generator. The tool is renamed from "dgen" because it's hardcoded to only generated spreg files. It isn't a generalized tool for creating lookup tables.
2022-12-19sim: ppc: change spreg switch table generation to compile-timeMike Frysinger4-15/+16
Simplify the generator by always outputting the switch tables, and leave the choice of whether to use them to the compiler via a -D flag.
2022-12-19sim: dv-core: add hw_detach_address method [PR sim/25211]Mike Frysinger2-13/+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-12sim: pru: Fix behaviour when loop count is zeroDimitar Dimitrov2-2/+43
If the counter for LOOP instruction is provided by a register with value zero, then the instruction must cause a PC jump directly to the loop end. But in that particular case simulator must not initialize its internal loop variables, because loop body will not be executed. Instead, simulator must obtain the loop's end address directly from the LOOP instruction. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2022-11-11sim: igen: cleanup archaic pointer-to-long printf castsMike Frysinger4-53/+49
Use proper %p to printf a pointer instead of casting it to long and using 0x%lx. It's cleaner, more correct, and doesn't break on LLP64.
2022-11-11sim: v850: rename v850.dc to align with other portsMike Frysinger3-2/+2
Other arches use the .dc extension for the instruction decode table.
2022-11-11sim: igen: fix hang when decoding boolean rule constantsMike Frysinger1-0/+2
The parser for boolean rules fails to skip over the , separator in the options which makes it hang forever. No dc files in the tree use boolean rules atm which is why no one noticed.
2022-11-11sim: igen: mark error func as noreturn since it exitsMike Frysinger1-1/+1
2022-11-11sim: igen: mark output funcs with printf attributeMike Frysinger2-7/+4
... and fix the legitimate bug that it catches.
2022-11-11sim: igen: constify various func argumentsMike Frysinger31-265/+380
2022-11-11sim: ppc: rename ppc-instructions to powerpc.igenMike Frysinger4-6/+6
To make it clear this is an input to the igen tool, rename it with an igen extension. This matches the other files in the ppc dir (altivec & e500 igen files), and the other igen ports (mips, mn10300, v850).
2022-11-10sim: ppc: drop old makefile fragmentMike Frysinger1-3/+0
Support for these files was dropped almost 30 years ago, but the ppc arch was missed. Clean that up now too.
2022-11-10sim: ppc: drop support for dgen -L optionMike Frysinger1-5/+1
Nothing passes this to dgen, and even if it did, nothing would happen because the generated spreg.[ch] files don't include any references back to the original data table. So drop it to simplify.
2022-11-10sim: ppc: collapse is_readonly & length switch tables heavilyMike Frysinger1-7/+15
Since we know we'll return 0 by default, we don't have to output case statements for readonly or length fields whose values are also zero. This is the most common case by far and thus generates a much smaller switch table in the end.
2022-11-10sim: ppc: collapse is_valid switch table moreMike Frysinger1-1/+4
Instead of writing: case 1: return 1; case 2: return 1; ...etc... Output a single return so we get: case 1: case 2: case ... return 1; This saves ~100 lines of code. Hopefully the compiler was already smart enough to optimize to the same code, but if not, this probably helps there too :).
2022-11-10sim: ppc: pull default switch return outMike Frysinger1-2/+1
This saves a single line for the same result. By itself, it's not interesting, but we can further optimize the generated output and completely omit the switch table in some cases. Which we'll do in follow up commits.
2022-11-10sim: ppc: constify spreg tableMike Frysinger1-2/+2
This internal table is only ever read, so constify it.
2022-11-10sim: igen: add missing newline to various error messagesMike Frysinger5-6/+6
The error() function expects a trailing newline in its message. Most callers do this already, so adding it to the few that don't.
2022-11-10sim: restore lstat & mkdir func checksMike Frysinger3-2/+16
When merging ppc configure checks into the top-level, these 2 funcs were accidentally dropped (probably due to incorrect resolution of conflicts). Restore them since the ppc code utilizes them both.
2022-11-10sim: ppc: drop obsolete USE_WIN32API checkMike Frysinger4-27/+0
This controls only one thing: how to call mkdir(). The gnulib code already has a mkdir module that provides this exact logic for us, so punt the code entirely.
2022-11-09sim: ppc: add missing parens with e500 macroMike Frysinger1-16/+16
This macro expansion was missing a set of outer-most parenthesis which some compilers would complain about depending on how the macro is used. This is just standard good macro hygiene too.
2022-11-09sim: ppc: drop useless linking of helper toolsMike Frysinger1-1/+1
We've never run these helper programs directly. The igen program includes the relevant source files directly and runs the code that way. So stop wasting developer CPU time linking programs that are never run. We leave the rules in place for people who need to test and debug the specific bits of code every now & then.
2022-11-08sim: mips: call Unpredictable instead of setting bogus values [PR sim/29276]Mike Frysinger1-2/+2
The intention of this code seems to be to indicate that this insn should not be used and produces undefined behavior, so instead of setting registers to bogus values, call Unpredictable. This fixes build warnings due to 32-bit/64-bit type conversions, and outputs a log message for users at runtime instead of silent corruption. Bug: https://sourceware.org/PR29276
2022-11-07sim: riscv: add missing AC_MSG_RESULT callMike Frysinger2-0/+3
Previous commit in here forgot to include this.
2022-11-07sim: v850: drop subdir configure logicMike Frysinger7-2962/+27
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-07sim: mn10300: drop subdir configure logicMike Frysinger7-2969/+34
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-07sim: or1k: drop subdir configure logicMike Frysinger7-2966/+32
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-07sim: bpf: drop subdir configure logicMike Frysinger7-2979/+44
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-07sim: riscv: drop subdir configure logicMike Frysinger8-3138/+65
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.
2022-11-07sim: .gdbinit: generate for all arch subdirsMike Frysinger3-143/+180
This was being skipped for ports that had a recursive configure, but we want it for them too.
2022-11-07sim: build: add a proper var for enabled archesMike Frysinger4-63/+98
The install code was using $SUBDIRS to track all enabled arches. This works, but isn't great if we want to add a subdir that isn't an arch port, or as we merge the subdirs into the top-level. Create a new var explicitly to track the list of enabled arches instead.
2022-11-06sim: build: respect AM_MAKEFLAGS when entering subdirsMike Frysinger7-14/+14
This doesn't matter right now, but it will as we add more flags to the recursive make step to pass state down.
2022-11-06sim: build: stop passing down SIM_PRIMARY_TARGETMike Frysinger2-2/+2
This was needed when the install step was run in subdirs, but now that we process that entirely in the top-level, we don't need to pass this down, so drop it.
2022-11-05sim: fix readline linkageMike Frysinger2-2/+2
Now that we link programs in the top dir instead of the arch subdir, update the readline library path to be relative to the top dir.
2022-11-05sim: use libtool to install programsMike Frysinger3-4/+6
Now that we use libtool to link, we have to use it to install instead of keeping the manual logic so we don't install wrapper shell scripts.
2022-11-05sim: bfin: move linux-fixed-code.h to top-levelMike Frysinger3-17/+36
2022-11-05sim: run: move linking into top-levelMike Frysinger40-126/+1445
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 Frysinger5-28/+52
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 Frysinger8-103/+107
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: cris: move rvdummy linking to top-levelMike Frysinger3-56/+77
This is only used by `make check`, so we can move it out of the default build too.
2022-11-05sim: build: add SIM_HW_CFLAGS to top-level build tooMike Frysinger2-3/+6
This matches what we do with targets already.
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-05sim: adjust sim_hw options styleMike Frysinger4-8/+12
We use uppercase for other variables, and are already turning it to uppercase in the arch-subdir.mk, so convert it in the configure step.