aboutsummaryrefslogtreecommitdiff
path: root/sim/ppc
AgeCommit message (Collapse)AuthorFilesLines
2022-05-13sim: remove use of PTRAlan Modra3-7/+7
PTR will soon disappear from ansidecl.h. Remove uses in sim. Where a PTR cast is used in assignment or function args to a void* I've simply removed the unnecessary (in C) cast rather than replacing with (void *).
2022-03-24sim: fix “alligned” typosReuben Thomas2-2/+2
Change-Id: Ifd574e38524dd4f1cf0fc003e0c5c7499abc84a0
2022-01-06sim: ppc: migrate to standard uintXX_t typesMike Frysinger37-1343/+1332
Drop the sim-specific unsignedXX types and move to the standard uintXX_t types that C11 provides.
2022-01-01sim: ppc: drop natural typesMike Frysinger4-31/+10
These are almost entirely unused. For the very few places using them, replace with explicit signed types. This matches what was done in the common sim code.
2022-01-01Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker11-11/+11
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-16/+16
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-28sim: nltvals: pull target syscalls out into a dedicated source fileMike Frysinger1-32/+4
Like we just did for pulling out the errno map, pull out the syscall maps into a dedicated common file. Most newlib ports are using the same syscall map, but not all, which means we have to do a bit more work to migrate. This commit adds the maps and switches the ports using the common default syscall table over to it. Ports using unique syscall tables are still using the old targ-map.c logic. Switching common ports over is easy by checking NL_TARGET, but the ppc code needs a bit more cleanup here hence its larger diff.
2021-11-19sim: install various doc filesMike Frysinger1-0/+19
2021-11-06sim: ppc: switch to libiberty environ.hMike Frysinger1-2/+2
Drop our compat code and assume environ exists to simplify. We did this for all other targets already, but ppc was missed.
2021-11-06sim: clarify license text via COPYING fileMike Frysinger2-1155/+0
The project has been using GPL v3 for a while now in the source files, and the arm & ppc ports have carried a copy of the COPYING file. Lets move those up to the top sim dir like other projects to make it clear. Also drop the ppc/COPYING.LIB as it's not really referenced by any source as everything is GPL v3.
2021-11-03sim: ppc: inline common sim-fpu.c logicMike Frysinger3-33/+2
We will never bother building w/out a ../common/ sim directory, so drop ancient logic supporting that method.
2021-11-03sim: ppc: switch to common builds for callback objectsMike Frysinger3-37/+6
We don't need to build this anymore ourselves since the common build includes it and produces the same object code. We also need to pull in the split constant modules after the refactoring and pulling them out of nltvals.def & targ-map.o. This doesn't matter for the sim directly, but does for gdb and other users of libsim. We also delete some conditional source tree logic since we already require this be the "new" combined tree with a ../common/ dir. This has been the case for decades at this point.
2021-11-01sim: ppc: fix the printf fix for 32-bit systemsMike Frysinger1-1/+1
The time delta is a 64-bit value too.
2021-10-31sim: ppc: clean up printf format handlingMike Frysinger9-117/+116
Don't blindly cast every possible type to (long). Change to the right printf format specifier whether it be a 64-bit type or a pointer.
2021-10-31sim: ppc: switch core types to stdint.h typesMike Frysinger1-12/+11
There's no need to define these ourselves anymore, so switch to the stdint.h types. This will be important when we start using PRI* defines with printf formats.
2021-10-31sim: ppc: handle \r in igen inputs [PR sim/28476]Mike Frysinger1-8/+16
Make sure we consume & ignore \r bytes in inputs in case the file encodings are from a non-LF systems (e.g. Windows).
2021-10-31sim: ppc: constify strings in igen toolingMike Frysinger13-50/+51
2021-10-31sim: ppc: use silent build rules here tooMike Frysinger3-50/+50
The ppc codebase is unique and doesn't leverage common/, so have to add silent rules to it specifically.
2021-10-31sim: silence stamp touch rulesMike Frysinger1-5/+5
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-27/+29
Use the srcroot path and make them all silent.
2021-10-30sim: fix compilation on mingw64 [PR sim/28476]Orgad Shaneh3-7/+14
...by reordering includes. 1. sim-utils.c sim/mips/sim-main.h defines UserMode, while there is a struct in winnt.h which has UserMode as a member. So if sim-main.h is included before winnt.h, compilation fails. 2. ppc registers.h defines CR, which is used as a member in winnt.h. winsock2.h is included by sys/time.h, so sys/time.h has to be included before registers.h. Bug: https://sourceware.org/PR28476
2021-10-28[sim] Include defs.h in ppc/hw_memory.cChristian Biesinger1-0/+3
To fix this error (seen on cygwin): /../../sim/ppc/../common ../../../sim/ppc/hw_memory.c In file included from ../../gnulib/import/stdlib.h:100, from ../../../sim/ppc/hw_memory.c:28: ../../gnulib/import/unistd.h:663:3: error: #error "Please include config.h first." 663 | #error "Please include config.h first." | ^~~~~ ../../gnulib/import/unistd.h:665:24: error: expected ';' before 'extern' 665 | _GL_INLINE_HEADER_BEGIN | ^ | ; ../../gnulib/import/unistd.h:2806:22: error: expected ';' before 'extern' 2806 | _GL_INLINE_HEADER_END | ^ | ;
2021-10-03sim: ppc: fallback when ln is not available [PR sim/18864]Mike Frysinger1-2/+2
Not all systems have easy access to hard links or symlinks, so add fallback logic to the run->psim build code to handle those. Bug: https://sourceware.org/PR18864
2021-09-09sim: ppc: drop support for std-config.h overridesMike Frysinger5-66/+6
Only the ppc arch supports this kind of source file override logic. All the others expose knobs via configure flags, and for some of these, the ppc code does as well. For others, it doesn't make sense to ever change them. Since it's unlikely anyone is using this, drop it all to simplify the code (and to get us a little closer to the common sim code).
2021-09-09sim: ppc: enable use of gnulibMike Frysinger5-2/+26
All other sim arches are using this now, so finish up the logic in the ppc arch to enable gnulib usage here too.
2021-09-09sim: drop old O_NDELAY & FNBLOCK supportMike Frysinger1-3/+3
We use these older names inconsistently in the sim codebase, and time has moved on long ago, so drop support for these non-standard names. POSIX provides O_NONBLOCK for us, so use it everywhere.
2021-09-08sim: ppc: switch to common warning flagsMike Frysinger3-109/+2
Now that the ppc code has been cleaned up enough to use the same set of warning flags as the common code, delete the ppc-specific configure logic so we can leverage what the common code already defined for us.
2021-09-08sim: ppc: enable -Wpointer-sign warningsTom de Vries4-6/+8
When compiling with --enable-werror and CFLAGS="-O0 -g -Wall", we run into: ... src/sim/ppc/hw_memory.c: In function 'hw_memory_init_address': src/sim/ppc/hw_memory.c:204:7: error: pointer targets in passing argument 4 \ of 'device_find_integer_array_property' differ in signedness \ [-Werror=pointer-sign] &new_chunk->size); ^ ... Fix these by adding an explicit pointer cast. It's a bit ugly to use APIs based on signed integers to read out unsigned values, but in practice, this is par for the course in the ppc code. We already use signed APIs and assign the result to unsigned values a lot: see how device_find_integer_property returns a signed integer (cell), but then assign it to unsigned types. The array APIs are not used that often which is why we don't see many warnings, and we disable warnings when we assign signed integers to unsigned integers in general. The dtc/libfdt project (which is the standard in other projects) processes the fdt blob as a series of bytes without any type information. Typing is left to the caller. They have core APIs that read/write bytes, and a few helper functions to cast/convert those bytes to the right value (e.g. u32). In this ppc sim code, the core APIs use signed integers, and the callers convert to unsigned, usually implicitly. We could add some core APIs to the ppc sim that deal with raw bytes and then add some helpers to convert to the right type, but that seems like a lot of lifting for what boils down to a cast, and is effectively equivalent to all the implicit assignments we use elsewhere. Long term, a lot of the ppc code should either get converted to existing sim common code, or we should stand up proper APIs in the common code first, or use standard libraries to do all the processing (e.g. libfdt). Either way, this device.c code would all get deleted, and callers (like these hw_*.c files) would get converted. Which is also why we go with a cast rather new (but largely unused) APIs.
2021-09-08sim: ppc: enable -Wmissing-declarations & -Wmissing-prototypesMike Frysinger3-4/+11
This aligns with common code which already uses this flag. We have to add another local prototype to fix the failure, and add another local decl for the SIM_DESC type. Unwinding these will require a lot more work & conversions in the process, so going with the decl for now unblocks the warning unification.
2021-09-08sim: ppc: align format string settings with common codeMike Frysinger3-1/+13
This copies logic used in the common sim warning configure code to fix build errors for mingw targets. Turning format warnings on triggers a failure in the debug.c file, so apply a minor fix at the same time.
2021-09-08sim: ppc: drop unnecessary config includesMike Frysinger1-4/+0
This file is compiled for the --host & --build system which leads to including the configure generated config.h in both environments. This obviously doesn't work when the two targets don't look alike at all and can cause build failures here (e.g. a mingw host & a linux build). Since we don't actually need any config settings in this very simple file, drop the includes entirely.
2021-08-17sim: rename ChangeLog files to ChangeLog-2021Mike Frysinger2-2168/+2168
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-06sim: ppc: add missing empty targetsDan Streetman1-0/+12
These are copied from sim/common/Make-common.in. On ppc the build fails without at least the 'info' target, e.g.: Making info in ppc make[4]: Entering directory '/<<BUILDDIR>>/gdb-10.2.2974.g5b45e89f56d+21.10.20210510155809/build/default/sim/ppc' make[4]: *** No rule to make target 'info'. Stop.
2021-07-01sim: unify reserved instruction bits settingsMike Frysinger5-40/+7
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: ppc: unify (most) compiler warnings with common codeMike Frysinger3-5/+73
Copy most of the common build warning logic over from the common code to help keep code behavior a bit consistent, and turn them on by default. We disable a few flags for now until we can clean the code up.
2021-06-29sim: ppc: fix printf warningsMike Frysinger3-2/+16
This code hits some format-zero-length warnings, so hack the code like we did in the common layers.
2021-06-20sim: move sim-inline to the common codeMike Frysinger4-79/+7
This will allow us to build the common code with the same inline settings as the arch subdirs, and only do the test once.
2021-06-19sim: ppc: rename inline defines to match common codeMike Frysinger6-52/+64
Use the same basic names as the common sim inline logic so we can merge the two. We don't do that here, just prepare for it. The common code seems to be based on the ppc version but with slightly different names as it was cleaned up & generalized. I *think* these concepts are the same, so binding them together is OK, but maybe I'm misreading them. If so, can always tweak them later. REVEAL_MODULE -> H_REVEALS_MODULE INLINE_MODULE -> C_REVEALS_MODULE
2021-06-19sim: unify gettext/intl probing logicMike Frysinger5-99/+6
Move these options up to the common dir so we only test & export them once across all ports.
2021-06-19sim: unify toolchain probing logicMike Frysinger4-288/+20
Move these options up to the common dir so we only test & export them once across all ports.
2021-06-19sim: unify bfd library dependency testing logicMike Frysinger6-433/+245
Move these options up to the common dir so we only test & export them once across all ports.
2021-06-18sim: unify -Werror build settingsMike Frysinger4-48/+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.
2021-06-18sim: create a makefile fragment to pass common settings downMike Frysinger2-0/+7
As we merge settings from subdirs into the common configure, we sometimes need to keep the settings working in both dirs. Create a makefile fragment to pass them down so we don't have to run the checks twice. For now, the file is empty, but we'll start moving logic in shortly.
2021-06-18sim: split sim-signal.h include outMike Frysinger2-1/+4
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.
2021-06-17sim: overhaul & unify endian settings managementMike Frysinger4-46/+6
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.
2021-06-17sim: ppc: avoid "PAGE_SIZE" nameMike Frysinger3-4/+9
This define is used for a particular target and depends on the simulated CPU hardware. It has no relation to the host CPU that the sim is running on. So rename the common "PAGE_SIZE" here to better reflect its usage and avoid conflicts with system headers.
2021-06-16sim: drop obsolete AC_EXEEXT callMike Frysinger3-5/+5
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.
2021-06-16sim: ppc: use common sim-assert settingMike Frysinger4-38/+5
The common sim code already sets this up for us, so no need to duplicate the logic.
2021-06-16sim: ppc: convert to bfd_endianMike Frysinger11-59/+75
Rather than re-invent endian defines, as well as maintain our own list of OS & arch-specific includes, punt all that logic in favor of the bfd ones already set up and maintained elsewhere. We already rely on the bfd library, so leveraging the endian aspect should be fine. This was done for all the other ports years ago, so catch ppc up.
2021-06-16sim: ppc: replace local __attribute__ fallbackMike Frysinger3-15/+7
The common ansidecl.h provides fallbacks for these so we don't need to.