aboutsummaryrefslogtreecommitdiff
path: root/sim/bfin
AgeCommit message (Collapse)AuthorFilesLines
2022-10-31sim: common: change sim_read & sim_write to use void* buffersMike Frysinger3-19/+19
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-05-13sim: remove use of PTRAlan Modra1-2/+2
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-01-06sim: bfin: migrate to standard uintXX_t typesMike Frysinger1-2/+2
Move off the sim-specific unsignedXX types and to the standard uintXX_t types that C11 provides.
2022-01-01Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker76-76/+76
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-16sim: syscall: hoist argc/argn/argnlen to common codeMike Frysinger1-33/+0
Now that the callback framework supports argv & envp, we can move the Blackfin implementation of these syscalls to the common code.
2021-11-16sim: callback: expose argv & environMike Frysinger1-0/+4
Pass the existing strings data to the callbacks so that common libgloss syscalls can be implemented (which we'll do shortly).
2021-11-16sim: keep track of program environment stringsMike Frysinger1-0/+6
We've been passing the environment strings to sim_create_inferior, but most ports don't do anything with them. A few will use ad-hoc logic to stuff the stack for user-mode programs, but that's it. Let's formalize this across the board by storing the strings in the normal sim state. This will allow (in future commits) supporting more functionality in the run interface, and to unify some of the libgloss syscalls.
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-11-06sim: arm/bfin/rx: undefine page size from system headersMike Frysinger1-0/+2
Some targets (like cygwin) will export page size defines that clash with our local usage here. Undefine the system one to fix building for these targets.
2021-10-31sim: bfin: cast pointers using uintptr_tMike Frysinger28-61/+61
We can't assume that sizeof(long) == sizeof(void*), so change all these casts over to uintptr_t.
2021-10-03sim: filter out SIGSTKSZ [PR sim/28302]Mike Frysinger1-4/+1
We map target signals to host signals so we can propagate signals between the host & simulated worlds. That means we need to know the symbolic names & values of all signals that might be sent. The tools that generate that list use signal.h and include all symbols that start with "SIG" so as to automatically include any new symbols that the C library might add. Unfortunately, this also picks up "SIGSTKSZ" which is not actually a signal itself, but a signal related setting -- it's the size of the stack when a signal is handled. By itself this doesn't super matter as we will never see a signal with that same value (since the range of valid signals tend to be way less than 1024, and the size of the default signal stack will never be that small). But with recent glibc changes that make this into a dynamic value instead of a compile-time constant, some users see build failures when building the sim. As suggested by Adam Sampson, update our scripts to ignore this symbol to simplify everything and avoid the build failure. Bug: https://sourceware.org/PR28302
2021-09-13sim: bfin: add support for SDL2Mike Frysinger1-22/+115
This probably should have been ported long ago, but better late than never. We keep support for both versions for now since both projects tend to have long lifetimes. Maybe consider dropping SDL1 in another ten years.
2021-08-17sim: nltvals: localize TARGET_<ERRNO> definesMike Frysinger1-12/+10
Code should not be using these directly, instead they should be resolving these dynamically via cb_host_to_target_errno maps. Fix the Blackfin code and remove the defines out of the header so no new code can rely on them.
2021-08-17sim: rename ChangeLog files to ChangeLog-2021Mike Frysinger1-0/+0
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-06-30sim: bfin: merge with common configure scriptMike Frysinger4-2898/+6
Now that the model logic has been migrated into the runtime, there's nothing specific in the bfin configure code, so merge it into the common one.
2021-06-30sim: move default model to the runtime sim stateMike Frysinger5-31/+9
This kills off another compile-time option by moving the setting to the individual arch runtimes. This will allow dynamic selection by the arch when doing a single build with multiple arches. The sim_model_init rework is a little funky. In the past it was disabled entirely if no default model was set. We maintain the spirit of the logic by gating the fallback logic on whether the port has defined any models.
2021-06-30sim: namespace sim_machsMike Frysinger4-1/+10
We want to do a single build with all arches in one binary which means we need to namespace sim_machs on a per-arch basis. Move it from a global variable to the sim description structure so it can be setup at runtime. Changing the SIM_MODEL->num from an enum to an int is unfortunate, but we specifically don't want to maintain a centralized list anymore, and this was never used directly in common code, just passed to per-arch callbacks.
2021-06-29sim: model: constify sim_machs storageMike Frysinger2-1/+5
The array of pointers is never modified, so mark it const so it ends up in the read-only data section.
2021-06-27sim: bfin: move pkg-config & SDL checks to common codeMike Frysinger5-1193/+10
This reduces the unique logic in bfin/configure to make it easier to (eventually) unify it entirely.
2021-06-24sim: callback: extend syscall interface to handle 7 argsMike Frysinger2-4/+8
The Linux syscall interface, depending on architecture, handles up to 7 arguments. Extend the callback API to handle those.
2021-06-22sim: drop configure scripts for simple portsMike Frysinger2-0/+11
These ports only use the pieces that have been unified, so we can merge them into the common configure script and get rid of their unique one entirely. We still compile & link separate run programs, and have dedicated subdir Makefiles, but the configure script portion is merged.
2021-06-21sim: unify hardware settingsMike Frysinger3-49/+5
Move these options up to the common dir so we only test & export them once across all ports.
2021-06-21sim: hw: rework configure option & device selectionMike Frysinger4-123/+85
The sim-hardware configure option allows builders to select a set of device models to enable. But this seems like unnecessary overkill: the existence of individual device models doesn't affect performance at all as they are only enabled at runtime if the config uses them, and individually these are all <5KB a piece. Stripping off a total of ~50KB from a ~1MB binary doesn't seem useful, and it's extremely unlikely anyone will ever bother. So let's simplify the configure/make logic by turning sim-hardware into a boolean option like many of the other sim options. Any ports that have unique device models will declare them in their Makefile instead of at configure time. This will allow us to (eventually) unify the setting into the common dir.
2021-06-20sim: delete SIM_AC_COMMON macroMike Frysinger4-5/+5
Now that we've moved all content out to the common file, this is empty and can be deleted it entirely.
2021-06-20sim: unify general maintainer settingsMike Frysinger4-125/+6
Move these options up to the common dir so we only test & export them once across all ports. This takes a page from the cgen maint logic to make $(MAINT) work for non-automake Makefiles which will allow us to merge it together.
2021-06-20sim: move sim-inline to the common codeMike Frysinger3-36/+5
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: unify gettext/intl probing logicMike Frysinger2-85/+0
Move these options up to the common dir so we only test & export them once across all ports.
2021-06-19sim: unify toolchain dependency logicMike Frysinger2-624/+367
The common dir is already probing this info since it's using automake, so pass it down to the subdirs so they don't have to probe it at all.
2021-06-19sim: unify toolchain probing logicMike Frysinger2-1359/+26
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 Frysinger3-7645/+6
Move these options up to the common dir so we only test & export them once across all ports.
2021-06-19sim: unify various library testing logicMike Frysinger2-141/+6
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 Frysinger3-112/+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: move -Werror disabling to MakefileMike Frysinger2-5/+8
For the ports that still don't build with -Werror, rather than disable the flag at configure time, do it at make time. This will allow us to unify these tests in the common sim configure script.
2021-06-18sim: split sim-signal.h include outMike Frysinger3-1/+6
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 Frysinger5-56/+9
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-16sim: drop obsolete AC_EXEEXT callMike Frysinger2-2/+4
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: drop arch-specific config.hMike Frysinger3-280/+47
All of the settings in here are handled by the common top-level config.h, so drop the individual arch-config.h files entirely. This will also help guarantee that we don't add any new arch specific defines that would affect common code which will help with the effort of unifying them.
2021-06-15sim: move dv-sockser define to CPPFLAGSMike Frysinger3-8/+5
This is the only define left in m4/ that is not in the common config.h, so move it to sim_hw_cflags so we can drop the arch-specific config.h.
2021-06-14sim: drop redundant SIM_AC_OPTION_WARNINGSMike Frysinger3-104/+108
The common code already calls this, so no need to do so in arch dirs. We leave the calls that disable -Werror. This will help unify the configure scripts.
2021-06-12sim: start unifying portability shimsMike Frysinger2-19/+6
There are some functions that gnulib does not yet provide fallbacks for, so start a common file of our own for holding existing stubs.
2021-06-12sim: overhaul alignment settings managementMike Frysinger5-56/+12
Currently, the sim-config module will abort if alignment settings haven't been specified by the port's configure.ac. This is a bit weird when we've allowed SIM_AC_OPTION_ALIGNMENT to seem like it's optional to use. Thus everyone invokes it. There are 4 alignment settings, but really only 2 matters: strict and nonstrict. The "mixed" setting is just the default ("unset"), and "forced" isn't used directly by anyone (it's available as a runtime option for some ports). 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, then the build won't work (see above as if SIM_AC_OPTION_ALIGNMENT wasn't called). If default settings are provided, then that is used, but we allow the user to override at runtime. Otherwise, the "wire" settings are used and user runtime options to change are ignored. Most ports specify a default, or set the "wire" to nonstrict. A few set "wire" to strict, but it's not clear that's necessary as it doesn't make the code behavior, by default, any different. It might make things a little faster, but we should provide the user the choice of the compromises to make: force a specific mode at compile time for faster runtime, or allow the choice at runtime. More likely it seems like an oversight when these ports were initially created, and/or copied & pasted from existing ports. With all that backstory, let's get to what this commit does. First kill off the idea of a compile-time default alignment and set it to nonstrict in the common code. For any ports that want strict alignment by default, that code is moved to sim_open while initializing the sim. That means WITH_DEFAULT_ALIGNMENT can be completely removed. Moving the default alignment to the runtime also allows removal of setting the "wire" settings at configure time. Which allows removing of all arguments to SIM_AC_OPTION_ALIGNMENT and moving that call to common code. The macro logic can be reworked to not pass WITH_ALIGNMENT as -D CPPFLAG and instead move it to config.h. All of these taken together mean we can hoist the macro up to the top level and share it among all sims so behavior is consistent among all the ports.
2021-06-12sim: unify bug & package settingsMike Frysinger3-87/+2
Move these options up to the common dir so we only test & export them once across all ports. The AC_INIT macro does a lot of the heavy lifting already which allows further simplification.
2021-06-12sim: unify debug/stdio/trace/profile build settingsMike Frysinger2-150/+2
Move these options up to the common dir so we only test & export them once across all ports. The ppc code needs a little extra care with its trace settings as it's not exactly the same API as the common code. The other knobs are the same though.
2021-06-12sim: unify environment build settingsMike Frysinger3-32/+2
Move the --sim-enable-environment option up to the common dir so we only test & export it once across all ports.
2021-06-12sim: unify assert build settingsMike Frysinger4-28/+6
Move the --sim-enable-assert option up to the common dir so we only test & export it once across all ports.
2021-06-12sim: unify platform function & header testsMike Frysinger4-643/+8
Move the various platform tests up a level to avoid duplication across the ports. When building multiple versions, this speeds things up a bit. For now we move the obvious stuff up a level, but we don't turn own the config.h entirely just yet -- we still have some tests related to libraries that need consideration.
2021-05-28sim: bfin: fix the otp fix fixMike Frysinger2-2/+6
Need to shift the upper 32-bits and not just combine directly with the lower 32-bits.
2021-05-23sim: bfin: fix the otp fixMike Frysinger2-1/+7
I misread the code and thought data0/... were bu64 when they were actually bu32. Fix the call to assemble the 2 64-bit values instead of passing the 2 halves of the first 64-bit value.
2021-05-23sim: bfin: fix build warnings w/newer gccMike Frysinger2-1/+5
The bfin_otp_write_page_val func wants a pointer to an bu64[2] array, but this code passes it a pointer to a single bu64. It's in a struct with a known compatible layout: bu64 data0, data1, data2, data3; But gcc doesn't allow these kinds of tricks anymore. Use the more verbose form to make the compiler happy since this is not performance sensitive code.
2021-05-23sim: bfin: add strings.h for ffs()Mike Frysinger2-0/+6