aboutsummaryrefslogtreecommitdiff
path: root/sim
AgeCommit message (Collapse)AuthorFilesLines
2021-02-08sim/rx: enable build with warningsAndrew Burgess3-1/+8
The rx simulator now has no build warnings. Delete the call to SIM_AC_OPTION_WARNINGS in configure.ac, the default yes will be provided by SIM_AC_OUTPUT. sim/rx/ChangeLog: * configure: Regenerate. * configure.ac (SIM_AC_OPTION_WARNINGS): Delete call.
2021-02-08sim/rx: avoid pointer arithmetic on void * pointersAndrew Burgess3-6/+18
Pointer arithmetic on void * pointers results in a GCC warning. Avoid the warning by casting the pointer to its actual type earlier in the function. sim/rx/ChangeLog: * mem.c (mem_put_blk): Rename parameter, add cast from parameter type to local type. Remove cast later in the function. (mem_get_blk): Likewise. * mem.h (mem_put_blk): Rename parameter to match definition. (mem_get_blk): Likewise.
2021-02-08sim/rx: add some missing includesAndrew Burgess3-2/+8
In load.c there's some GCC warnings about undefined functions (bfd_get_elf_phdr_upper_bound and bfd_get_elf_phdrs). To get the declarations of these functions include 'elf-bfd.h'. This headers also pulls in other elf related headers, like 'elf/internal.h' and 'elf/common.h', so these no longer need to be explicitly included from load.c. In trace.c and include for trace.h is missing, again this results in GCC warnings for missing function declarations. sim/rx/ChangeLog: * load.c: Replace 'elf/internal.h' and 'elf/common.h' includes with 'elf-bfd.h' include. * trace.c: Add 'trace.h' include.
2021-02-08sim/rx: use PRIx64 in printf format stringAndrew Burgess2-2/+7
Silence a GCC compiler warning by using PRIx64 in printf format string instead of hard coded "llx". sim/rx/ChangeLog: * reg.c (trace_register_changes): Use PRIx64 in printf format string.
2021-02-08sim/rx: move some variable declarations to the start of the blockAndrew Burgess3-3/+11
For sim code variables still need to be declared at the start of the enclosing block. This silences a few GCC warnings. sim/rx/ChangeLog: * syscalls.c (rx_syscall): Move declaration of some variables to the start of the enclosing block. * trace.c (load_file_and_line): Likewise.
2021-02-08sim/rx: provide a format string for printfAndrew Burgess2-4/+9
Calling printf with the format being a non constant string results in a GCC warning: warning: format not a string literal and no format arguments [-Wformat-nonliteral] Provide a constant format string to printf in the few places this warning is triggered. sim/rx/ChangeLog: * reg.c (fpsw2str): Provide a format string to printf. (trace_register_changes): Likewise.
2021-02-08sim/rx: delete an unused functionAndrew Burgess2-9/+4
This function is not used. sim/rx/ChangeLog: * err.c (execution_error_exit_all): Delete.
2021-02-08sim/rx: mark some functions as staticAndrew Burgess4-3/+9
Some functions that should be marked static. sim/rx/ChangeLog: * fpu.c (check_exceptions): Make static. * gdb-if.c (handle_step): Likewise. * mem.c (mem_put_byte): Likewise.
2021-02-08sim/rx: fill in missing 'void' for empty argument listsAndrew Burgess7-9/+21
Ensure we have 'void' inside empty argument lists. This was causing several warnings for the rx simulator. sim/rx/ChangeLog: * cpu.h (trace_register_changes): Add void parameter type. * err.c (ee_overrides): Likewise. * mem.c (mem_usage_stats): Likewise. (e): Likewise. * reg.c (stack_heap_stats): Likewise. * rx.c (pop): Likewise. (poppc): Likewise. (decode_opcode): Likewise. * syscalls.c (arg): Likewise.
2021-02-08sim/rx: fix an issue where we try to modify a const stringAndrew Burgess2-2/+6
While experimenting with switching on warnings for the rx simulator I discovered this bug. In sim_do_command we get passed a 'const char *' argument. We create a copy of this string to work with locally, but then while processing this we accidentally switch back to reference the original string. sim/rx/ChangeLog: * gdb-if.c (sim_do_command): Work with a copy of the command.
2021-02-08sim/rx: define sim_memory_mapAndrew Burgess2-0/+12
The rx simulator doesn't define sim_memory_map and so fails to link with GDB. Define it now to return NULL, this can be extended later to return an actual memory map if anyone wants this functionality. sim/rx/ChangeLog: * gdb-if.c (sim_memory_map): New function.
2021-02-06sim: erc32/m32c/rl78: add sim_memory_map stub for gdbMike Frysinger6-0/+30
These ports don't use the common sim core, so they weren't providing a sim_memory_map for gdb, so they failed to link with the new memory map logic added for the sim. Add stubs to fix.
2021-02-06sim: watchpoints: use common sim_pc_getMike Frysinger25-54/+129
Few arches implement STATE_WATCHPOINTS()->pc while all of them implement sim_pc_get. Lets switch the sim-watch core for monitoring pc events to the sim_pc_get API so this module works for all ports, and then we can delete this old back channel of snooping in the port's cpu state -- the code needs the pointer to the pc storage so that it can read out bytes and compare them to the watchrange. This also fixes the logic on multi-cpu sims by removing the limitation of only being able to watch CPU0's state.
2021-02-06sim: add ChangeLog entries for last commitsMike Frysinger2-0/+12
2021-02-06sim: igen: drop libiberty linkageMike Frysinger3-10/+1
This dir doesn't use anything from libiberty, so drop the linkage.
2021-02-06sim: common: switch AC_CONFIG_HEADERSMike Frysinger31-92/+61
The AC_CONFIG_HEADER macro is long deprecated, so switch to the newer form. This also gets rid of the position limitation, and drops support for an argument to SIM_AC_COMMON which we haven't used anywhere.
2021-02-06sim: drop use of bfd/configure.hostMike Frysinger73-233/+434
These settings might have made sense in darker compiler times, but I think they're largely obsolete now. Looking through the values that get used in HDEFINES, it's quite limited, and configure itself should handle them. If we still need something, we can leverage standard autoconf macros instead, after we get a clear user report. TDEFINES was never set anywhere and was always empty, so prune that.
2021-02-04gdb: riscv: enable sim integrationMike Frysinger2-0/+76
Now the simulator can be loaded via gdb using "target sim".
2021-02-04sim: riscv: new portMike Frysinger23-0/+18290
This is a hand-written implementation that should have fairly complete coverage for the base integer instruction set ("i"), and for the atomic ("a") and integer multiplication+division ("m") extensions. It also covers 32-bit & 64-bit targets. The unittest coverage is a bit weak atm, but should get better.
2021-01-31sim: cgen-trace: tweak printf callMike Frysinger2-1/+5
GCC warns that we pass a non-string literal as the format string, so add an explicit "%s" to make it happy.
2021-01-31sim: bpf: fix mainloop extract callMike Frysinger2-1/+5
The extract function takes the argbuf, not the scache.
2021-01-31sim: bpf/or1k: fix CGEN_TRACE_EXTRACT nameMike Frysinger5-127/+138
We renamed these years ago, but it looks like the cgen core missed the TRACE_EXTRACT function, so these new ports still used the incompatible common name. Fix those ports to use the right func.
2021-01-31sim: cgen-accfp: Fix pointer sign warningsStafford Horne2-3/+9
When compiling we get the following warnings: common/cgen-accfp.c: In function 'fixsfsi': common/cgen-accfp.c:370:18: warning: pointer targets in passing argument 1 of 'sim_fpu_to32i' differ in signedness [-Wpointer-sign] sim_fpu_to32i (&res, &op1, sim_fpu_round_near); ^ common/cgen-accfp.c: In function 'fixdfsi': common/cgen-accfp.c:381:18: warning: pointer targets in passing argument 1 of 'sim_fpu_to32i' differ in signedness [-Wpointer-sign] sim_fpu_to32i (&res, &op1, sim_fpu_round_near); ^
2021-01-31sim: v850: cleanup build warningsMike Frysinger4-107/+124
This port only had one minor warning left in it, so fix it and then enable -Werror behavior by deleting the macro call. We'll use the common default now (which is -Werror).
2021-01-31sim: v850: fix handling of SYS_timesMike Frysinger2-2/+5
My recent rewrite of the nltvals generator fixed a bug where SYS_times was not being exported for v850. But that in turn uncovered this bug where the SYS_times codepath had a compile error.
2021-01-31sim: moxie: cleanup build warningsMike Frysinger4-6/+22
This port only had one minor warning left in it, so fix it and then enable -Werror behavior by deleting the macro call. We'll use the common default now (which is -Werror).
2021-01-30sim: common: change gennltvals helper to PythonMike Frysinger6-240/+243
This tool is only run by developers and not in a release build, so rewrite it in Python to make it more maintainable.
2021-01-30sim: m68hc11: fix printf size warningsMike Frysinger2-1/+5
GCC complains %llu is wrong for signed64, so switch to PRIi64.
2021-01-30sim: m68hc11: localize a few functionsMike Frysinger2-6/+12
These are only used in this file and lack prototypes, so gcc complains about it. Add static everywhere to clean that up.
2021-01-30sim: m68hc11: tweak printf-style funcsMike Frysinger2-2/+6
GCC complains that we past non-string literals to a printf style func, so put a %s in here to keep it quiet.
2021-01-30sim: m68hc11: include stdlib.h for prototypesMike Frysinger3-0/+7
These files use abort() & strtod(), so include stdlib.h for them.
2021-01-30sim: watchpoints: change sizeof_pc to sizeof(sim_cia)Mike Frysinger23-16/+50
Existing ports already have sizeof_pc set to the same size as sim_cia, so simply make that part of the core code. We already assume this in places by way of sim_pc_{get,set}, and this is how it's documented in the sim-base.h API. There is code to allow sims to pick different register word sizes from address sizes, but most ports use the defaults for both (32-bits), and the few that support multiple register sizes never change the address size (so address defaults to register). I can't think of any machine where the register hardware size would be larger than the address word size either. We have ABIs that behave that way (e.g. x32), but the hardware is still equivalent register sized.
2021-01-30sim: profile: fix bucketing with 64-bit targetsMike Frysinger2-2/+6
When the target's PC is 64-bits, this shift expands into a range of 8 * 8 - 1 which doesn't work with 32-bit constants. Force it to be a 64-bit value all the time and let the compiler truncate it.
2021-01-30sim: m68hc11: stop making hardware conditionalMike Frysinger3-32/+22
This port doesn't build if these hardware modules are omitted, and there's no reason we need to make it conditional at build time, so always enable it. The hardware devices only get turned on if the user requests it at runtime via hardware settings.
2021-01-30sim: hw: replace fgets with getlineMike Frysinger2-30/+41
This avoids fixed sized buffers on the stack.
2021-01-30sim: common: sort nltvals.defMike Frysinger3-90/+95
This was largely already done, but I think people didn't quite notice.
2021-01-29sim: readd myself as a maintainerMike Frysinger2-1/+5
2021-01-22MAINTAINERS: Update my e-mail addressMaciej W. Rozycki1-1/+1
binutils/ * MAINTAINERS: Update my e-mail address. gdb/ * MAINTAINERS: Update my e-mail address. sim/ * MAINTAINERS: Update my e-mail address.
2021-01-19sim: ppc: update version script usageMike Frysinger2-2/+7
This matches the changes in the common code.
2021-01-18sim: bfin: delete accidental ADI copyrightMike Frysinger2-1/+4
This wasn't supposed to be in here when it was first merged as we had specifically disabled it for all the tests (and ADI has papers in place w/the FSF). Clean up this one.
2021-01-18sim: common: simplify version scriptMike Frysinger3-13/+15
We don't use the host & target aliases, so don't bother emitting them.
2021-01-18sim: common: delete configure & MakefileMike Frysinger9-3891/+208
This was mostly orphaned a while back, but left behind so people could still run `make headers`. Merge that one target to the top sim dir and delete all the build logic. This should avoid confusing people further.
2021-01-18sim: common: modernize gennltvals.shMike Frysinger5-167/+244
It's not 1996 anymore, so stop writing shell code like it is, and rewrite it with modern POSIX shell standards. This makes it much more user friendly. Then regenerate the file with latest newlib sources to verify.
2021-01-15sim: testsuite: flatten treeMike Frysinger2860-1/+5
Now that all port tests live under testsuite/sim/*/, and none live in testsuite/ directly, flatten the structure by moving all of the dirs under testsuite/sim/ to testsuite/ directly. We need to stop passing --tool to dejagnu so that it searches all dirs and not just ones that start with "sim". Since we have no other dirs in this tree, and no plans to add any, should be fine.
2021-01-15sim: testsuite: delete configure scriptMike Frysinger7-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.
2021-01-15sim: d10v: relocate tests & clean up test harnessMike Frysinger58-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.
2021-01-15sim: mips: delete empty stub test dirMike Frysinger7-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.
2021-01-15sim: frv: clean up redundant test coverageMike Frysinger14-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.
2021-01-15sim: m32r: clean up redundant test coverageMike Frysinger11-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.
2021-01-15sim: testsuite: allow tests to declare expected exit statusMike Frysinger5-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.