summaryrefslogtreecommitdiff
path: root/sim
Commit message (Collapse)AuthorAgeFilesLines
* sim: testsuite: delete configure scriptMike Frysinger2021-01-157-3133/+27
| | | | | | | | Now that we've moved all ports to dejagnu & testsuite/sim/, the only thing the testsuite/configure script has been doing is filling in the sim_arch field in the testsuite/Makefile. We can simply let the top sim/configure script do that for us now. This simplifies & speeds up the build a bit by killing an entire configure script.
* sim: d10v: relocate tests & clean up test harnessMike Frysinger2021-01-1558-3434/+300
| | | | | | | | | | | | This is the only target using a dir directly under testsuite/. All others use sim/<arch>/ instead. Relocate it so all targets look the same, and so we can leverage the common test harness. We drop loop.s in the process because it was never referenced and was just 2 lines of code. All other test files are moved & have directives added to the top so that the test harness can invoke them correctly.
* sim: mips: delete empty stub test dirMike Frysinger2021-01-157-3200/+7
| | | | | | | No tests were ever added in here in the ~22 years since it was first created. Seems unlikely any tests will be added at this rate, and the sim/mips/ testdir already has some (light) coverage for this target. So punt the tree.
* sim: frv: clean up redundant test coverageMike Frysinger2021-01-1514-3219/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The frv-elf subdir contained five tests: * cache: A cache test of some sort. * exit47: A program to test exit status of 47 from sim. * grloop: Some basic limited loop test program. * hello: Standard "hello world" output program. * loop: An infinite loop program. The loop.s test is never referenced anywhere, and is all of 2 lines. Anyone who really needs a while(1); test case and re-implement it themselves locally. The cache.s code isn't referenced anywhere because it requires some custom args to the run program, and when this testcase was added, we didn't have any support for that. We do now, so we can add a header to enable that. Turns out the code crashes even with those, so turn around and mark it xfail. Maybe someone someday will care. That leaves the small exit47, grloop, and hello tests. Now that the sim test harness supports testing for custom exit status, we can move them all to sim/frv/ to maintain test coverage. The remaining differences between frv-elf & sim/frv are: * frv-elf/ runs for frv-*-elf while sim/frv/ runs for frv*-*-*. * frv-elf/ runs "*.s" files while sim/frv/ only has .cgs and such. On closer inspection, these are also meaningless distinctions: * There is nothing specific to the tests that require an *-elf target. Normally that would mean newlib+libgloss type stuff, but there's no such requirement in frv-elf/. * The ".s" suffix is the standard "this is an assembly file" suffix. Since FRV is a CGEN target, we can reuse the existing convention of ".ms" to mean "miscellaneous .s" as in "this is an assembly file, and run/bucket its test results in the miscellaneous category". So moving frv-elf/{cache,exit47,grloop,hello}.s to sim/frv/*.ms makes sense and simplifies things quite a bit for the target while also slightly increasing the coverage for some tuples.
* sim: m32r: clean up redundant test coverageMike Frysinger2021-01-1511-3203/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The m32r-elf subdir contained three tests: * exit47: A program to test exit status of 47 from sim. * hello: Standard "hello world" output program. * loop: An infinite loop program. There's already a sim/m32r/hello.ms test that does exactly the same thing as m32r-elf/hello.s, so we can delete that. The loop.s test is never referenced anywhere, and is all of 2 lines. Anyone who really needs a while(1); test case and re-implement it themselves locally. That leaves the single exit47 test. Now that the sim test harness supports testing for custom exit status, we can easily move that to sim/m32r/exit47.ms to maintain test coverage. The remaining differences between m32r-elf & sim/m32r are: * m32r-elf/ runs for m32r-*-elf while sim/m32r/ runs for m32r*-*-*. * m32r-elf/ runs "*.s" files while sim/m32r/ runs "*.ms" files. On closer inspection, these are also meaningless distinctions: * There is nothing specific to the tests that require an *-elf target. Normally that would mean newlib+libgloss type stuff, but there's no such requirement in m32r-elf/. * The ".s" suffix is the standard "this is an assembly file" suffix. Turns out ".ms" is just how sim/m32r/ (and a few other CGEN based targets) categorize/bucket test cases. It simply means "miscellaneous .s" as in "this is an assembly file, and run/bucket its test results in the miscellaneous category". So moving m32r-elf/exit47.s to sim/m32r/exit47.ms makes sense and simplifies things quite a bit for the target while also slightly increasing the coverage for some tuples.
* sim: testsuite: allow tests to declare expected exit statusMike Frysinger2021-01-155-13/+32
| | | | | | | | | | | | | Some tests want to verify they can control the exit status, and allowing any non-zero value would allow tests to silently fail: if it crashed & exited 1, or forced all non-zero to 1, then we wouldn't be able to differentiate with a test exiting with a status like 47. Extend the test harness to allow tests to declare their expected exit status that would be defined as a "pass". This requires a small tweak to the sim_run API to return the status directly, but that shouldn't be a big deal as it's only used by sim code.
* sim: h8300: drop separate eightbit memory bufferMike Frysinger2021-01-133-74/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The h8300 sim has its own implementation for memory handling that I'd like to replace with the common sim memory code. However, it's got a weird bit of code it calls "eightbit mem" that makes this not as easy as it would otherwise be. The code has this comment: /* These define the size of main memory for the simulator. Note the size of main memory for the H8/300H is only 256k. Keeping it small makes the simulator run much faster and consume less memory. The linker knows about the limited size of the simulator's main memory on the H8/300H (via the h8300h.sc linker script). So if you change H8300H_MSIZE, be sure to fix the linker script too. Also note that there's a separate "eightbit" area aside from main memory. For simplicity, the simulator assumes any data memory reference outside of main memory refers to the eightbit area (in theory, this can only happen when simulating H8/300H programs). We make no attempt to catch overlapping addresses, wrapped addresses, etc etc. */ I've read the H8/300 Programming Manual and the H8/300H Software Manual and can't find documentation on it. The closest I can find is the bits about the exception vectors, but that sounds like a convention where the first 256 bytes of memory are used for a special purpose. The sim will actually allocate a sep memory buffer of 256 bytes and you address it by accessing anywhere outside of main memory. e.g. I would expect code to access it like: uint32_t *data = (void *)0; data[0] = reset_exception_vector; not like the sim expects like: uint8_t *data = (void *)0x1000000; data[0] = ...; The gcc manual has an "eightbit_data" attribute: Use this attribute on the H8/300, H8/300H, and H8S to indicate that the specified variable should be placed into the eight-bit data section. The compiler generates more efficient code for certain operations on data in the eight-bit data area. Note the eight-bit data area is limited to 256 bytes of data. And the gcc code implies that it's accessed via special addressing: eightbit_data: This variable lives in the 8-bit data area and can be referenced with 8-bit absolute memory addresses. I'm fairly certain these are referring to the 8-bit addressing modes that allow access to 0xff00 - 0xffff with only an 8-bit immediate. They aren't completely separate address spaces which this eightbit memory buffer occupies. But the sim doesn't access its eightbit memory based on specific insns, it does it purely on the addresses requested. Unfortunately, much of this code was authored by Michael Snyder, so I can't ask him :(. I asked Renesas support and they didn't know: https://renesasrulz.com/the_vault/f/archive-forum/6952/question-about-eightbit-memory So I've come to the conclusion that this was a little sim-specific hack done for <some convenience> and has no relation to real hardware. And as such, let's drop it until someone notices and can provide a reason for why we need to support it.
* sim: watch: add basic default handler that trapsMike Frysinger2021-01-132-1/+18
| | | | | | | | | | | | | | | | | The default watchpoint handler is NULL. That means any port that sets the STATE_WATCHPOINTS->pc field will crash if you try to use the --watch options but don't configure the interrupt handler. In the past, you had to setup STATE_WATCHPOINTS->pc if you wanted to support PC profiling, and while that was fixed a while ago, we have a lot of ports who still configure it. We already add a default set of interrupts (just "int") if the port doesn't define any. Let's also add a default handler that raises a SIGTRAP. When connected to gdb, this is a breakpoint which is what people would expect. When running standalone, it'll abort the sim, but it's unclear whether there's anything better to do there. This really is just to make the watchpoint module more usable out of the box for most ports with very little setup, at least inside of gdb.
* sim: watch: fix range expression processingMike Frysinger2021-01-132-1/+5
| | | | | | | | The code supports a <start>[,<end>] syntax, but the logic for handling the <end> check was broken: it would detect the first byte was ",", but then include that in the strtoul call meaning the result is always 0. Further, it (re)assigned to arg0 when it meant arg1 which means this code always processed a range expression as 0,0. Oops.
* sim: watch: fix pc watchpoints on little endian host systemsMike Frysinger2021-01-134-5/+14
| | | | | | | | | | | | | My change 1ac72f0659d64d6a14da862242db0d841d2878d0 ("sim: convert to bfd_endian") subtly broke the watchpoint module on little endian host systems. The old code used 0 to mean "whatever the host endian is", and while that was changed to use BFD_ENDIAN_UNKNOWN, this caller was missed. Since its API used an int instead of an enum, the coercion from 0 to the BFD endian enum was silently missed, and 0 happens to be BFD_ENDIAN_BIG. Instead of restoring the old logic by passing in BFD_ENDIAN_UNKNOWN, we know the right host endian at compile time, so use that directly.
* sim: or1k: fix mixing of code & decl warningMike Frysinger2021-01-122-3/+10
| | | | | Use the correct style of declaring variables at top of scope. This fixes a few compiler warnings in the process.
* sim: or1k: clean up stale build entriesMike Frysinger2021-01-122-11/+8
| | | | | This logic was migrated to the common code long ago so ports don't need to declare them themselves.
* sim: README-HACKING: clean up stale run referencesMike Frysinger2021-01-122-2/+4
| | | | | The run.c interface was deleted long ago and everyone moved to nrun.c (which is also the default), so no one needs to declare this anymore.
* sim: common: use #error properlyMike Frysinger2021-01-122-1/+5
|
* sim: or1k: delete redundant SIM_AC_OPTION_INLINE callMike Frysinger2021-01-123-34/+16
| | | | | This was merged into the common code a long time ago, so ports shouldn't be calling this themselves.
* sim: tests: get common tests working againMike Frysinger2021-01-114-41/+46
| | | | | | | | | | | | | | These were written with 32-bit host assumptions baked into it. Simplify the printf formats to use ll length modifier as it's in C11 rather than trying to manually break it up into two, and cleanup some of the casts to stop assuming sizeof(long) is the same as sizeof(int). We also have to add a few more includes for the various funcs used in here. The tests aren't compiled automatically still. We can figure that out later with more work.
* sim: always call SIM_AC_OPTION_WARNINGSMike Frysinger2021-01-112-1/+7
| | | | | | | | Now that all ports have opted in to this, we can require it in the core. It guarantees that new ports have them turned on, and defaults to -Werror in the hopes that new ports keep their code clean from the start. We do this as a sep commit to make it clear that there are no changes to existing ports as they've all explicitly called it already.
* sim: call SIM_AC_OPTION_WARNINGS(no) in remaining portsMike Frysinger2021-01-1130-20/+1130
| | | | | | | | We want all ports to opt into extra warnings as the default compiler settings lets a lot slide. Opt all the ports that haven't already in to the warning system. None of them build with -Werror, so disable that by default. Hopefully someone finds these important enough to start fixing at some point.
* sim: or1k: fix include ordering with sim-main.hMike Frysinger2021-01-112-0/+6
| | | | | | | | | Make sure config.h is included before C library headers otherwise the later libiberty.h include gets confused about asprintf state leading to warnings like: common/sim-utils.c:330:9: warning: implicit declaration of function 'vasprintf'; did you mean 'xvasprintf'? [-Wimplicit-function-declaration]
* sim: common: fix printf formatsMike Frysinger2021-01-112-1/+6
| | | | | | For 32-bit targets, %x happens to work for unsigned_word. But for 64-bit targets, it's too small, and gcc throws an error. Use the right printf format define for them.
* sim: rl78: move storage out of headerMike Frysinger2021-01-113-1/+8
| | | | | | | This port declares its pc variable in a header and then includes it multiple times. This causes linker errors with newer gcc due to the change in -fno-common behavior. Move the storage to a C file so we only have one instance of it in the final program.
* sim: clean up C11 header includesMike Frysinger2021-01-11182-1090/+1097
| | | | | | | | | | | | Since we require C11 now, we can assume many headers exist, and clean up all of the conditional includes. It's not like any of this code actually accounted for the headers not existing, just whether we could include them. The strings.h cleanup is a little nuanced: it isn't in C11, but every use of it in the codebase will include strings.h only if string.h doesn't exist. Since we now assume the C11 string.h exists, we'll never include strings.h, so we can delete it.
* sim: replace rindex with strrchrMike Frysinger2021-01-092-2/+6
|
* sim: cr16/d10v: move storage out of headerMike Frysinger2021-01-096-2/+20
| | | | | | | These ports declare their State variable in a header and then include multiple times. This causes linker errors with newer gcc due to the change in -fno-common behavior. Move the storage to a C file so we only have one instance of it in the final program.
* sim: common: clean up asprintf includes a bitMike Frysinger2021-01-094-5/+7
| | | | | Delete stale prototypes that libiberty.h already provides, and add missing libiberty.h includes to files that use those functions.
* sim: sh64: delete portMike Frysinger2021-01-09430-73941/+13
| | | | | Support for sh64 was dropped from bfd et al in 2018. Without that, the sim port is useless. So clean up this code too.
* sim: clean up stale AC_PREREQ refsMike Frysinger2021-01-0961-458/+198
| | | | | This was purged from the tree when we upgraded to autoconf-2.69, but a few references in the sim tree were missed.
* sim: enable -Werror by default for some archesMike Frysinger2021-01-0953-116/+140
| | | | | | | | | | | | | | | We've had this off for a long time because the sim code was way too full of warnings for it to be feasible. However, I've cleaned things up significantly from when this was first merged, and we can start to turn this around. Change the macro to enable -Werror by default, and allow ports to opt out. New ports will get it automatically (and we can push back on them if they try to turn it off). Also turn it off for the few ports that still hit warnings for me. All the rest will get the new default, and we'll wait for feedback if/when new issues come up.
* sim: pru: fix include ordering with sim-main.hMike Frysinger2021-01-092-0/+6
| | | | | | | | | Make sure config.h is included before C library headers otherwise the later libiberty.h include gets confused about asprintf state leading to warnings like: common/sim-utils.c:330:9: warning: implicit declaration of function 'vasprintf'; did you mean 'xvasprintf'? [-Wimplicit-function-declaration]
* sim: hw: rework code to avoid gcc warningsMike Frysinger2021-01-092-7/+8
| | | | | | Newer gcc thinks we might return a pointer to a stack buffer, but we don't -- we strdup it before returning. Rework the code to just malloc the buffer from the start and avoid the stack+strdup.
* sim: common: add missing stdlib.h for abort()Mike Frysinger2021-01-095-0/+9
|
* sim: require a C11 compilerMike Frysinger2021-01-0865-419/+1750
| | | | | | | | | With GDB requiring a C++11 compiler now, this hopefully shouldn't be a big deal. It's been 10 years since C11 came out, so should be plenty of time to upgrade. This will allow us to start cleaning up random header logic and many of our non-standard custom types.
* sim: ppc: stub out sim_memory_mapMike Frysinger2021-01-082-0/+10
| | | | | Not clear how to implement this in the ppc-specific sim, so just stub it out. This is as good as it was previously.
* sim: ChangeLog: move arch-specific entries into the arch dirMike Frysinger2021-01-0710-509/+524
| | | | | | We don't want arch-specific entries in the common ChangeLog files. Most arches do this already, so clean up the recent additions, and move some older entries down to help avoid confusing newcomers.
* sim: cris: disable test that crashes the linkerMike Frysinger2021-01-072-1/+10
| | | | | | | PR ld/13900 Linking this test crashes the linker, so disable it. The crash was reported about 9 years ago but haven't made progress, so lets avoid the failures in test runs.
* sim: cris: use -sim with C tests for cris-elf targetsMike Frysinger2021-01-072-0/+8
| | | | | | | | | | | | | Building the C tests with a cris-elf toolchain (gcc-10.2 & newlib-4.1.0) currently fail due to warnings it emits: cris-elf-ld: libc.a(lib_a-closer.o): in function `_close_r': newlib/libc/reent/closer.c:47: warning: _close is not implemented and will always fail This is because the default target for cris-elf is bare metal, not the simulator. For that, we need -sim. So add it for elf targets. We don't add it for all targets as the simulator (and testsuite) run both libgloss programs as well as Linux userspace programs.
* sim: h8300: delete opcode cachingMike Frysinger2021-01-073-136/+20
| | | | | | | | | | This is in preparation for converting h8300 over to the common memory framework. It's not clear how much of a speed gain this was providing in the first place -- a naive test of ~400k insns (using shlr.s) shows that this code actually slowed things down a bit. If anyone really cares about h8300 anymore, they can migrate to the common insn caching logic.
* gdb/sim: add support for exporting memory mapMike Frysinger2021-01-072-0/+61
| | | | | | | This allows gdb to quickly dump & process the memory map that the sim knows about. This isn't fully accurate, but is largely limited by the gdb memory map format. While the sim supports RWX bits, gdb can only handle RW or RO regions.
* fix paths in ChangeLogMike Frysinger2021-01-071-5/+5
|
* sim: cris: fix C tests with newer toolchainsMike Frysinger2021-01-0711-2/+21
| | | | | | | | | | Make sure we include unistd.h for getpid prototypes to fix build warnings/errors with newer compilers & C libraries. Doing that for close in openpf highlights these were using the wrong function -- need to use fclose on FILE*, not close. These tests pass again with a cris-elf toolchain.
* sim: fr30: delete unused testsuiteMike Frysinger2021-01-05108-7226/+4
| | | | | | | | Looking through the history, it doesn't seem like the fr30 port was ever merged. There used to be a testsuite/fr30-elf/ dir, but that was punted back in 2005 as being dead too. Since there's no refs and the dir hasn't been touched since 1999, lets assume no one will ever notice or care.
* sim: testsuite: delete unused Make-common.in fileMike Frysinger2021-01-052-90/+4
| | | | | This seems like it was meant to unify arch test Makefiles, but that never happened, and we've instead unified using dejagnu.
* sim: h8300: fix test mach markersMike Frysinger2021-01-0510-9/+15
| | | | | | | | | | These tests all fail to assemble when targeting the h8300 or h8300h cpu variants with errors like: rotl.s:242: Warning: Opcode `rotl.b' with these operand types not available in H8/300H mode rotl.s:242: Error: invalid operands It's been this way for years and no one seems to care, so disable them for those targets since the assembler thinks it's impossible.
* sim: h8300: simplify testsuite runnerMike Frysinger2021-01-052-61/+15
| | | | | | We don't need to manually enumerate every test. Use a glob function like every other port and rely on the (already existing) #mach headers in each file to filter out targets we don't care about.
* sim: include stdlib.h for atoi()Mike Frysinger2021-01-0410-4/+23
| | | | | | Make sure the files using atoi() include stdlib.h for its prototype. These files were relying on it being included implicitly by others which isn't guaranteed, and newer toolchains produce warnings.
* sim: stdlib.h for abs()Mike Frysinger2021-01-046-0/+16
| | | | | | Make sure the files using abs() include stdlib.h for its prototype. These files were relying on it being included implicitly by others which isn't guaranteed, and newer toolchains produce warnings.
* sim: update bug URI to https://Mike Frysinger2021-01-0464-33/+159
|
* sim: common: version: add build & homepage info when interactiveMike Frysinger2021-01-042-0/+20
| | | | | | This mirrors gdb behavior of dumping extra info when being run in interactive mode. It also gives us an excuse to use the otherwise unused sim_print_config.
* sim: common: use sim_config_print nameMike Frysinger2021-01-043-3/+3
| | | | | Meant to push this variant where naming preference is given to the module the code resides in rather than the operation it performs.
* sim: common: add a version output helper w/copyright+license infoMike Frysinger2021-01-043-1/+31
| | | | | This mirrors the existing sim_print_help function, and the behavior of all other GNU tools with their --version.