aboutsummaryrefslogtreecommitdiff
path: root/sim/ppc
AgeCommit message (Collapse)AuthorFilesLines
2023-12-22sim: ppc: fix -Wshadow=local warningsMike Frysinger1-3/+3
Use a local name in the macro to avoid shadowing wherever it's used.
2023-12-21sim: ppc: igen: fix -G handlingMike Frysinger1-2/+9
We weren't using the enable_p flag to see whether the option should be enabled or disabled, and we weren't breaking out when done parsing.
2023-12-21sim: ppc: fix -Wimplicit-fallthrough warningsMike Frysinger1-1/+1
Replace some fall through comments with the attribute.
2023-12-21sim: add ATTRIBUTE_FALLTHROUGH for local codeMike Frysinger1-0/+3
We'll replace various /* fall through */ comments so compilers can actually understand what the code is doing.
2023-12-21sim: ppc: phb: add missing break to address decoderMike Frysinger1-0/+1
I don't know what this emulation does exactly, but it missing a break statement seems kind of obvious based on the 32-bit case above it.
2023-12-21sim: ppc: mark halt & restart funcs as noreturnMike Frysinger3-6/+6
This helps the compiler with optimization and fixes fallthru warnings.
2023-12-07sim: ppc: fix -Wunused-but-set-variable warningsMike Frysinger1-2/+0
2023-12-04sim: ppc: fix implicit enum conversionMike Frysinger1-3/+3
This code tries to use attach_type enums as hw_phb_decode, and while they're setup to have compatible values, the compiler doesn't like it when the cast is missing. So cast it explicitly and then use that. sim/ppc/hw_phb.c:322:28: error: implicit conversion from enumeration type 'attach_type' (aka 'enum _attach_type') to different enumeration type 'hw_phb_decode' [-Werror,-Wenum-conversion]
2023-12-04sim: ppc: fix -Wmisleading-indentation warningsMike Frysinger1-1/+1
Fix building with -Wmisleading-indentation.
2023-12-04sim: ppc: cleanup getrusage declsMike Frysinger3-17/+2
Don't conflate HAVE_GETRUSAGE & HAVE_SYS_RESOURCE_H. Use the latter to include the header and nothing else. Use the former to determine whether to use the function and nothing else. If we find a system that doesn't follow POSIX and provides only one of these, we can figure out how to support it then. The manual local definition is clashing with the system ones and leading to build failures with newer C standards. sim/ppc/emul_netbsd.c:51:5: error: a function declaration without a prototype is deprecated in all versions of C and is treated as a zero-parameter prototype in C2x, conflicting with a previous declaration [-Werror,-Wdeprecated-non-prototype]
2023-01-18sim: info: convert verbose field to a boolMike Frysinger1-1/+1
The verbose argument has always been an int treated as a bool, so convert it to an explicit bool. Further, update the API docs to match the reality that the verbose value is actually used by some of the internal modules.
2023-01-17sim: ppc: drop local psim linkMike Frysinger1-4/+1
This has never been installed, and it's not clear anyone cares about it in the local build dir (when the main program is sim/ppc/run), so drop all the logic to simplify.
2023-01-16sim: assume sys/stat.h always exists (via gnulib)Mike Frysinger1-4/+0
We have many uses of sys/stat.h that are unprotected by HAVE_SYS_STAT_H, so this is more formalizing the reality that we require this header. Since we switched to gnulib, it guarantees that a sys/stat.h exists for us to include, so we're doubly OK.
2023-01-16sim: formally assume unistd.h always exists (via gnulib)Mike Frysinger10-21/+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-14sim: common: move libcommon.a dep to ppc codeMike Frysinger1-0/+6
Rather than force this to be built ahead of time for all targets, move the dep to the ppc code since it's the only user of it now.
2023-01-04sim: Regenerate using the maintainer modeTsukasa OI1-1/+1
Those files have changed by regenerating using the maintainer mode. The first line of sim/ppc/pk.h have changed by an effect of the commit 319e41e83a40 ("sim: ppc: inline the sim-packages option").
2023-01-01sim: refresh copyright dates a bitMike Frysinger2-2/+2
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 Brobecker14-14/+14
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-24sim: igen: drop move-if-changed usageMike Frysinger1-24/+12
Now that igen itself has this logic, drop these custom build rules to greatly simplify.
2022-12-24sim: igen: support in-place updates ourselfMike Frysinger1-9/+76
Every file that igen outputs is then processed with the move-if-changed shell script. This creates a lot of boilerplate in the build and not an insignificant amount of build-time overhead. Move the simple "is the file changed" logic into igen itself.
2022-12-23sim: ppc: drop unused types from sim-main.hMike Frysinger1-7/+0
The common sim headers should define these for us already, so there's no need for the ppc header to set them up.
2022-12-22sim: switch sim_{read,write} APIs to 64-bit all the time [PR sim/7504]Mike Frysinger1-8/+10
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-20sim: move register headers into sim/ namespace [PR sim/29869]Mike Frysinger2-2/+2
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 Frysinger4-0/+1598
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-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: 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-06sim: build: respect AM_MAKEFLAGS when entering subdirsMike Frysinger1-1/+1
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-05sim: run: move linking into top-levelMike Frysinger2-14/+17
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-14/+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: ppc: drop unused /dev/zero logicMike Frysinger4-84/+1
Nothing in the tree checks this option, or has checked for decades. The pre-cvs-import ChangeLog suggests this was added & removed back then, but can't be sure as that history doesn't exist in the VCS.
2022-11-05sim: ppc: delete unused host bitsize settingsMike Frysinger4-32/+2
Nothing checks this define anywhere, so drop all the logic. We don't want this to be a configure option in the first place as all such usage should be automatic & following proper types.
2022-11-05sim: ppc: inline the sim-packages optionMike Frysinger4-63/+12
This has only ever had a single option that's enabled by default. The objects it adds are pretty small and don't add overhead at runtime if it isn't used, so just enable it all the time to make the build code simpler.
2022-11-04sim: build: switch to bfd & opcodes libtool linker scriptsMike Frysinger1-5/+4
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-1/+2
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: ppc: include copyright & license in --versionMike Frysinger1-0/+5
This makes it match the other sim run programs and GNU tools.
2022-11-03sim: ppc: drop use of DATE & TIMEMike Frysinger1-6/+0
No other tool does this, sim or otherwise, and it makes the ppc build non-reproducible. Drop it to simplify & make reproducible.
2022-11-03sim: move common flags to default AM_CPPFLAGSMike Frysinger1-1/+1
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-02sim: common: change sim_{fetch,store}_register helpers to use void* buffersMike Frysinger1-3/+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/+2
These functions only read from memory, so mark the pointer as const.