aboutsummaryrefslogtreecommitdiff
path: root/sim/moxie/interp.c
AgeCommit message (Collapse)AuthorFilesLines
2024-01-12Update copyright year range in header of all files managed by GDBAndrew Burgess1-1/+1
This commit is the result of the following actions: - Running gdb/copyright.py to update all of the copyright headers to include 2024, - Manually updating a few files the copyright.py script told me to update, these files had copyright headers embedded within the file, - Regenerating gdbsupport/Makefile.in to refresh it's copyright date, - Using grep to find other files that still mentioned 2023. If these files were updated last year from 2022 to 2023 then I've updated them this year to 2024. I'm sure I've probably missed some dates. Feel free to fix them up as you spot them.
2023-12-19sim: moxie: fix -Wunused-variable warningsMike Frysinger1-8/+1
2023-01-01Update copyright year range in header of all files managed by GDBJoel Brobecker1-1/+1
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-25sim: cpu: change default init to handle all cpusMike Frysinger1-1/+1
All the runtimes were only initializing a single CPU. When SMP is enabled, things quickly crash as none of the other CPU structs are setup. Change the default from 0 to the compile time value.
2022-12-23sim: moxie: move arch-specific settings to internal headerMike Frysinger1-0/+2
There's no need for these settings to be in sim-main.h which is shared with common/ sim code, so move it all out to a new header which only this port will include.
2022-12-22sim: moxie: replace custom "word" type with int32_tMike Frysinger1-13/+11
This is a 32-bit architecture with 32-bit registers, so replace the custom "word" int typedef with an explicit int32_t. Practically speaking, this produces the same code, but it should hopefully make it easier to merge common code in the future.
2022-12-22sim: cr16/d10v/mcore/moxie: clean up unused word & uword typesMike Frysinger1-1/+0
Nothing actually uses these, so punt them. Some of the ports are using local "word" types, but we'll clean those up in a follow up.
2022-12-21sim: moxie: invert sim_cpu storageMike Frysinger1-4/+5
2022-11-02sim: common: change sim_{fetch,store}_register helpers to use void* buffersMike Frysinger1-2/+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/+1
These functions only read from memory, so mark the pointer as const.
2022-10-31sim: constify various integer readersMike Frysinger1-1/+1
These functions only read from memory, so mark the pointer as const.
2022-01-01Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker1-1/+1
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-11-28sim: iq2000/lm32/m32c/moxie/rx: switch to new target-newlib-syscall.hMike Frysinger1-6/+6
Use the new target-newlib-syscall.h to provide the target syscall defines. These code paths are written specifically for the newlib ABI rather than being generalized, so switching them to the defines rather than trying to go through the dynamic callback conversion seems like the best trade-off for now. Might have to reconsider this in the future.
2021-11-15sim: split program path out of argv vectorMike Frysinger1-4/+1
We use the program argv to both find the program to run (argv[0]) and to hold the arguments to the program. Most of the time this is fine, but if we want to let programs specify argv[0] independently (which is possible in standard *NIX programs), this double duty doesn't work. So let's split the path to the program to run out into a separate field by itself. This simplifies the various sim_open funcs too. By itself, this code is more of a logical cleanup than something that is super useful. But it will open up customization of argv[0] in a follow up commit. Split the changes to make it easier to review.
2021-06-18sim: split sim-signal.h include outMike Frysinger1-0/+1
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 Frysinger1-0/+3
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-05-16sim: switch config.h usage to defs.hMike Frysinger1-1/+3
The defs.h header will take care of including the various config.h headers. For now, it's just config.h, but we'll add more when we integrate gnulib in. This header should be used instead of config.h, and should be the first include in every .c file. We won't rely on the old behavior where we expected files to include the port's sim-main.h which then includes the common sim-basics.h which then includes config.h. We have a ton of code that includes things before sim-main.h, and it sometimes needs to be that way. Creating a dedicated header avoids the ordering mess and implicit inclusion that shows up otherwise.
2021-05-14sim: create header namespaceMike Frysinger1-1/+1
The gdb/callback.h & gdb/remote-sim.h headers have nothing to do with gdb and are really definitions for the libsim API under the sim/ tree. While gdb uses those headers as a client, it's not specific to it. So create a new sim/ namespace and move the headers there.
2021-05-04sim: remove sys/times.h in most placesMike Frysinger1-1/+0
The v850 port used this, and then it got copied to other ports even though it wasn't needed. Clean it up to avoid portability issues on platforms not providing this (e.g. mingw64 for Windows).
2021-04-18sim: moxie: switch syscalls to common nltvalsMike Frysinger1-5/+6
Rather than hand duplicate the syscall constants, switch to the common nltvals framework. I made sure the constants have the same values before & after too :).
2021-04-12sim: cgen: move cgen_cpu_max_extra_bytes logic into the common codeMike Frysinger1-1/+1
Every arch handles this the same way, so move it to the common code. This will also make unifying the sim_cpu structure easier.
2021-02-06sim: watchpoints: use common sim_pc_getMike Frysinger1-2/+0
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-01-31sim: moxie: cleanup build warningsMike Frysinger1-1/+1
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: watchpoints: change sizeof_pc to sizeof(sim_cia)Mike Frysinger1-1/+0
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-01Update copyright year range in all GDB filesJoel Brobecker1-1/+1
This commits the result of running gdb/copyright.py as per our Start of New Year procedure... gdb/ChangeLog Update copyright year range in copyright header of all GDB files.
2020-01-01Update copyright year range in all GDB files.Joel Brobecker1-1/+1
gdb/ChangeLog: Update copyright year range in all GDB files.
2019-12-14Add unlink support to moxie simulatorAnthony Green1-3/+16
This change adds support for the unlink system call, which is required by the GCC testsuite. It also switches read/write/open system calls to use the sim_io_* functions. 2019-12-14 Anthony Green <green@moxielogic.com> * interp.c (sim_engine_run): Make use of sim_io_* functions for read/write/open system calls. Implement the unlink system call.
2019-01-01Update copyright year range in all GDB files.Joel Brobecker1-1/+1
This commit applies all changes made after running the gdb/copyright.py script. Note that one file was flagged by the script, due to an invalid copyright header (gdb/unittests/basic_string_view/element_access/char/empty.cc). As the file was copied from GCC's libstdc++-v3 testsuite, this commit leaves this file untouched for the time being; a patch to fix the header was sent to gcc-patches first. gdb/ChangeLog: Update copyright year range in all GDB files.
2018-01-02Update copyright year range in all GDB filesJoel Brobecker1-1/+1
gdb/ChangeLog: Update copyright year range in all GDB files
2017-09-04Fix simulatorAnthony Green1-7/+11
2017-01-01update copyright year range in GDB filesJoel Brobecker1-1/+1
This applies the second part of GDB's End of Year Procedure, which updates the copyright year range in all of GDB's files. gdb/ChangeLog: Update copyright year range in all GDB files.
2016-01-06sim: sim_{create_inferior,open,parse_args}: constify argv/env slightlyMike Frysinger1-2/+4
2016-01-03 Mike Frysinger <vapier@gentoo.org> * sim-options.c (sim_parse_args): Mark argv array const. * sim-options.h (sim_parse_args): Likewise.
2016-01-03sim: parse_args: display getopt error ourselvesMike Frysinger1-3/+1
Fix a long standing todo where we let getopt write directly to stderr when an invalid option is passed. Use the sim io funcs instead as they go through the filtered callbacks that gdb wants.
2016-01-01GDB copyright headers update after running GDB's copyright.py script.Joel Brobecker1-1/+1
gdb/ChangeLog: Update year range in copyright notice of all files.
2015-12-30sim: arm/d10v/h8300/m68hc11/microblaze/mips/mn10300/moxie/sh/v850: convert ↵Mike Frysinger1-4/+6
to common sim_{fetch,store}_register
2015-11-15sim: sim-close: unify sim_close logicMike Frysinger1-7/+0
Other than the nice advantage of all sims having to declare one fewer common function, this also fixes leakage in pretty much every sim. Many were not freeing any resources, and a few were inconsistent as to the ones they did. Now we have a single module that takes care of all the logic for us. Most of the non-cgen based ones could be deleted outright. The cgen ones required adding a callback to the arch-specific cleanup func. The few that still have close callbacks are to manage their internal state. We do not convert erc32, m32c, ppc, rl78, or rx as they do not use the common sim core.
2015-10-11sim: moxie: fix leakage in error path [BZ #18273]Mike Frysinger1-0/+1
Reported-by: dcb <dcb314@hotmail.com>
2015-06-12sim: moxie: use new common trace definesMike Frysinger1-4/+9
Now that there's common helpers for printing trace data, switch to that to restore the insn tracing support for this target.
2015-06-12sim: moxie: rename TRACE to MOXIE_TRACE_INSNMike Frysinger1-73/+73
We want to add new common trace helpers including "TRACE", so rename the moxie one to MOXIE_TRACE_INSN. This also matches what the code is doing.
2015-04-17sim: replace CIA_{GET,SET} with CPU_PC_{GET,SET}Mike Frysinger1-7/+7
The CIA_{GET,SET} macros serve the same function as CPU_PC_{GET,SET} except the latter adds a layer of indirection via the sim state. This lets models set up different functions at runtime and doesn't reach so directly into the arch-specific cpu state. It also doesn't make sense to have two sets of macros that do exactly the same thing, so lets standardize on the one that gets us more.
2015-04-16sim: avr/mcore/moxie: fill out sim-cpu pc fetch/store helpersMike Frysinger1-1/+22
This makes the common sim-cpu logic work.
2015-04-05sim: moxie: fix running after nrun conversionMike Frysinger1-25/+20
The nrun conversion was slightly incorrect in how it stopped when an exception occurred. We still set cpu.asregs.exception, but nothing was checking it anymore. Convert all of that to sim_engine_halt. To keep things from regressing again, add a basic testsuite too.
2015-03-24sim: moxie: clean up build time warningsMike Frysinger1-44/+19
2015-03-24sim: moxie: convert to nrun.oMike Frysinger1-174/+49
This port already used a lot of common/ files, so cutting it over to nrun.o and using a few more common objects is pretty straight forward.
2015-03-24sim: moxie: switch to common sim-command.oMike Frysinger1-11/+0
2015-02-20sim: drop unused headersMike Frysinger1-2/+2
These look like left over hacks from the days where we had to protect ourselves from the compiler and C library. None of these checks are relevant, and we have common configure logic to do header tests. Punt them all now.
2015-02-19sim: drop unused sim_kill functionMike Frysinger1-8/+0
This has been deprecated for a long time and no one calls it.
2015-01-01Update year range in copyright notice of all files owned by the GDB project.Joel Brobecker1-1/+1
gdb/ChangeLog: Update year range in copyright notice of all files.
2014-12-27Update sto/ldo implementations with 16 bit offsetsAnthony Green1-20/+26
2014-12-25Whitespace cleanupAnthony Green1-4/+55