Commit Graph
44 Commits
Author SHA1 Message Date
Ryan Houdek 0e11dea46f Adds kernel version check to FEXLoader
We require kernel 4.17 minimum on the host to run correctly
2021-01-15 13:55:04 -08:00
Stefanos Kornilios Mitsis Poiitidis f951bc969e Merge pull request #628 from Sonicadvance1/more_syscalls
Implements more syscalls
2021-01-13 20:45:02 +02:00
Ryan Houdek 433162004a Implements more syscalls 2021-01-12 14:50:17 -08:00
Ryan Houdek aa3b77e4c8 Uninstalls LogManager handlers on shutdown
In case something manages to have stayed alive and tried throwing a
message, this will no longer crash.

Noticed this with the previous commit
2021-01-11 09:03:56 -08:00
Ryan Houdek f83698cb50 Uninstalls SignalDelegator signals on destruction
Tear this down earlier so if we catch a signal on shutdown then we don't
crash in the handler.

Fixes some pain around debugging shutdown crashes
2021-01-11 09:01:06 -08:00
Ryan Houdek 8f1978a33a Shebang improvements
Fixes a problem where a space between the shebang and application
argument would result in us trying to execute a null program.

Additionally it now captures all the arguments passed in the shebang
header rather than just the application and first argument.
2021-01-10 02:15:51 -08:00
Stefanos Kornilios Mitsis Poiitidis ef75b8e4ec Merge pull request #582 from Sonicadvance1/move_syscalls
Moves FEXCore's SignalDelegator and SyscallHandler to the frontend
2020-12-16 12:52:39 +02:00
Ryan Houdek 9f5a507f67 Disables lower 32bit mapping check when ASAN is compiled in
LLVM ASAN sticks some things in the upper range of the 32bit memory
range.
So we have to just allow it when using LLVM asan
2020-12-14 03:59:04 -08:00
Ryan Houdek 37983006f0 Moves FEXCore's SignalDelegator and SyscallHandler to the frontend
Sadly these things can't be split without breaking functionality so it
turns in to a bit of a mess.

SyscallHandler is very much something that is a Linux only construct and
shouldn't be in FEXCore itself. Lets the frontend register a
Syscallhandler with FEXCore. FEXCore itself is then aware of the current
syscall ABI and handles the ABI in an optimal fashion.
So it is not a 100% clean break otherwise we would lose performance.

The SignalDelegator then needs to move to the frontend since the
SyscallHandler requires it for signal based syscalls.
The CPU backend signal handling still needs to happen in FEXCore because
it is a very tight coupling with the CPU backend.
Once we need to support more Signal handling we can give the backends
cleaner support to select which specific OS handler to handle.
2020-12-13 22:38:04 -08:00
Ryan Houdek 36b24ad141 Removes all uses of non-unified memory and SHM regions
Let's just delete the whole thing!
2020-12-10 02:09:52 -08:00
Ryan Houdek 01831ec264 Check for binfmt_misc install and run directly only if installed
If we want to execve files directly we need to ensure that the
binfmt_misc interpreter path is installed.
If it isn't installed then we need to fall down the regular path of
pushing FEX to the front of the argument list.
2020-12-09 20:34:03 -08:00
Ryan Houdek db49ab4149 Changes the frontend FEXLoader argument loading path
If the interpreter was executed then don't even try handling arguments.
They will all get passed to the guest application
2020-12-08 07:28:50 -08:00
Ryan Houdek f14cd54791 Switches over to having a correctly layered configuration system
Instead of having the configuration being loaded and stored in to a
frontend system. First moves the backing store of the configuration in
to FEXCore.

Each layer that is constructed then loads its particular configuration.
After the layers are loaded, then a meta layer is constructed that
merges the layers flat.

This means we will no longer hit the problem where a configuration is
stored in the "main" configuration file, then environment and arguments
passed manage to overwrite it.

The order of the layers going from inner most layer to outer most, with
outermost overwriting previous layer configurations is as follows:

Main < Global application < Local application < Arguments < Environment

One step that needs to be changed in the future is that FEXCore can then
just load its configuration from the layers directly since the data is
in FEXCore now. This will be reserved for a future change so we are less
disruptive.
2020-12-07 11:15:48 -08:00
Ryan Houdek a28df9f5c1 Moves SonicUtils in to FEXCore
Removes the extraneous and dead VM CPU backend
2020-11-29 00:30:28 -08:00
Ryan Houdek 2ce8148f3f Shebang rootfs prefix improvements
If we are passed a shebang application then append the rootfs prefix for
absolute paths.
Fixes the issue where bash scripts weren't working on ARM.

Also fixes a crash that can occur if FEX wasn't passed in arguments
or if the argument passed in didn't exist.
It'll now instead exit cleanly and state that the application doesn't
exist respectively.
2020-11-24 19:25:27 -08:00
Ryan Houdek eb094bcf98 Adds support for shebang redirection
If a file has as shebang interpreter then switch over to that.
Fixes launching a bunch of titles in Steam where their launcher is a
bash script
2020-11-17 12:18:30 -08:00
Stefanos Kornilios Mitsis Poiitidis 11e12a9b36 Add --unsafe-no-pf 2020-11-17 11:11:13 +02:00
Stefanos Kornilios Mitsis Poiitidis 8fc6f73571 IR: InvalidateFlags + --abi-local-flags
- InvalidateFlags pseudo-op is a hint for the Dead Flags Elimination pass that flags are not needed past that point
- Adds a new option, --abi-local-flags, that invalidates the flags on CALLs or RETs. This might break code that doesn't follow the ABI rules.
2020-11-17 11:08:29 +02:00
Stefanos Kornilios Mitsis Poiitidis 2dad4718d6 IR: Add DumpIR option, --dump-ir command line
This dumps the IR before and after optimizations

--dump-ir can be

"no" -> Do not dump
"stderr" -> Dump to stderr
"stdout" -> Dump to stdout
"some/path" -> Dump to "some/path/$GuestRip-pre.ir" and "some/path/$GuestRip-post.ir"
2020-11-16 16:14:07 +02:00
Ryan Houdek 672be71903 Forces FEXLoader to use unified memory
The non-unified memory path is completely untested and broken now with
the ELFLoader.
Just not allow it now
2020-09-17 15:39:52 -07:00
Stefanos Kornilios Mitsis Poiitidis df3bdf361f SMC: Add --smc-full-checks, implement frontend, irint, irjit, unit test 2020-09-16 01:15:21 +03:00
Ryan Houdek 0819a40c57 Adds option to disable TSO
This is a knowingly wrong option for anything running in a threaded
environment
2020-09-05 16:58:03 -07:00
Ryan Houdek 50349db4c6 Moves our entire execution model over to signal execution
This requires implementing custom ASM dispatchers for the interpreter
side of things so it works correctly.
Allows all of our CPU backends to safely support signaling.
This is a bit of a nightmare change and requires rethinking logic about
debugging in some instances.
2020-09-02 16:00:17 -07:00
Ryan Houdek 0ce8415e7a Adds a new option for directing where debug logs go
Not interfering with things using terminal GUIs is important.
Add an option that allows us to redirect output to a file
2020-08-02 17:50:21 -07:00
Stefanos Kornilios Mitsis Poiitidis 8c8e6294b6 Thunks: ALTINST, OP_THUNK, basic infrastructure 2020-07-20 13:52:28 +03:00
Ryan Houdek 48c73ca780 Adds support for -E to the ELFLoader
Now you can pass environment variables to the guest using -E

ex. `./Bin/ELFLoader -E DISPLAY=:0 -E GALLIUM_HUD=fps,cpu /usr/bin/glxgears`
2020-07-11 09:38:57 +01:00
Ryan Houdek cf546268ea Ensures that Unified Memory is enabled by default 2020-06-12 15:08:16 -07:00
Ryan Houdek 7302ad1996 Adds new FEX config for telling the guest how many CPU cores it can have
This is just a virtual number that the guest can query through the
various means. Will affect mesa with how many helper threads it
generates at the very least
2020-06-04 00:03:41 -07:00
Ryan Houdek d2cf07a4fd Passes the running mode through from FEX to FEXCore 2020-05-14 00:56:31 -07:00
Ryan Houdek 66dc5ebc54 Merge pull request #179 from FEX-Emu/skmp/fix-exit-code
Propagate guest exit code
2020-05-01 16:58:07 -07:00
Stefanos Kornilios Mitsis Poiitidis d58961ef1e Propagate guest exit code 2020-05-02 02:34:50 +03:00
Stefanos Kornilios Mitsis Poiitidis 3c9be4625c Add silent log 2020-05-02 01:45:22 +03:00
David Miller d93c66e5f6 Added EnvLoader to fontend binaries, called prior to ArgLoader 2020-04-24 19:35:59 -04:00
Ryan Houdek 780278a7f6 Fixes memory allocation
4GB virtual memory is too small and causes things to fault.
Previously we were at `1 << 36` but it caused oom issues on devices with
smaller amounts of memory.
This time ensure the the SHM memory is allocated with MEM_NORESERVE so
devices can actually allocate the virtual memory region.
2020-04-12 18:39:00 -07:00
Ryan Houdek 3424326987 Removes accurate-std command line argument
This is an option that has been removed
2020-04-09 18:01:29 -07:00
Ryan Houdek 5298379fb9 Ensure the ELFLoader doesn't end up in the lower 32bit address space
We need to reserve that space for EXEC apps and 32bit apps. Hard throw a
warning if any of our mapping space ends up in the lower 32bits.

PIE and potentially a custom dynamic linker can enforce this.
2020-04-08 13:35:29 -07:00
Ryan Houdek 15d5ba6fc1 Adds RootFS search path in ELFLoader
Fixes #69, makes it less annoying to run things on non x86 hosts
2020-04-04 23:17:40 -07:00
Ryan Houdek 3fd1475d30 Plumbs ELFLoader arguments through the CodeLoader
This is necessary for execve in the future to keep everything in sync
2020-03-21 15:19:31 -07:00
Ryan Houdek 03f068ec1d Adds support for unified memory option in ELFLoader application 2020-03-06 09:08:50 +02:00
Ryan Houdek 3a460b4bf0 Support setting the library rootfs in the ELFLoader 2020-03-06 09:08:46 +02:00
Ryan Houdek 13d681558e Adds accurate STD output option to ELFLoader 2020-03-06 09:08:44 +02:00
Scott Mansell 213b739f12 Add GdbServer intergraton 2020-03-06 09:08:34 +02:00
Scott Mansell 81b9810f36 FEXCore: Refactor context start/pause/step interface 2020-03-06 09:08:28 +02:00
Ryan Houdek 369686c992 Initial Commit 2020-03-06 09:08:13 +02:00