Commit Graph
133 Commits
Author SHA1 Message Date
Stefanos Kornilios Mitsis Poiitidis f0d3004363 Thunks: Add Thunk json, thunk guest folder 2021-03-10 15:51:34 +02:00
Scott Mansell 35c01038ba Seperate per-thread and per-frame state 2021-03-09 20:27:44 +13:00
Ryan Houdek a3ba1ae199 Deduplicates some configuration data
Configuration mapping was duplicated between three different tables.
Additionally default configuration values were strewn about. Making it confusing as to what the default value would end up being

Adds a new ConfigValues.inl header that defines a few things right next to each other.
Defines the enum name as usual.
Defines the JSON config option name.
Defines the Environment config option name
Defines the default value that the configuration should be
2021-03-08 22:53:41 -08:00
Stefanos Kornilios Mitsis Poiitidis 56d10dcbbb IR: Make OP_THUNK use an inline sha256 hash of the thunk name, update thunk scripts 2021-02-23 12:08:57 +02: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 61641dcc92 Adds interpreter handling to the x86 execve path
Will fix the same bugs as the 64bit path
2020-12-08 07:28:50 -08:00
Ryan Houdek 9882447ed5 Adds interpreter handling to the x64 execve path
Will fix some application launching problems
2020-12-08 07:28:50 -08:00
Ryan Houdek 3d21aaf617 Adds config option to syscall handler for determining if we're
interpreter
2020-12-08 07:28:50 -08:00
Ryan Houdek f091878100 More 32bit syscall fixes
fstatfs64 and statfs64 was wrong, the syscall doesn't quite match the
glibc definition

Fixes recvmsg. Specifically the aux data was failing, thus SCM_RIGHTS
wasn't getting passed correctly.

Fixes a couple of time syscalls where their arguments are optional.
2020-12-04 09:30:33 -08:00
Ryan Houdek 310252b97d A wackload of new 32bit syscall support
This implements a bunch of new 32bit syscalls which almost gets FEX to
be able to run Steam.

The main missing syscalls are mremap, shmat, and ioctl for supporting
Steam execution.
2020-12-03 20:03:15 -08:00
Stefanos Kornilios Mitsis Poiitidis d481bd4ffc Merge pull request #541 from Sonicadvance1/remove_sonicutils
Moves SonicUtils in to FEXCore
2020-12-03 16:54:56 +02:00
Stefanos Kornilios Mitsis Poiitidis 7c40083106 Merge pull request #539 from Sonicadvance1/more_64bit_syscall_movement
Moves 64bit sigaltstack and execve to 64bit files
2020-12-03 16:51:38 +02: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 638201254a Moves 64bit sigaltstack and execve to 64bit files
These need specific 32bit handling
2020-11-27 20:33:23 -08:00
Ryan Houdek 94b034db6c Moves shmat to 64bit memory specific file
This removes the bad attempt to keep shm regions in our 64GB shm region

This will need to be handled specially on the 32bit side through its
memory management once we have that wired up
2020-11-27 00:32:25 -08:00
Ryan Houdek e23ae78795 Merge pull request #537 from Sonicadvance1/move_memory_x64
Moves some memory op implementations to x64 file
2020-11-27 00:20:10 -08:00
Ryan Houdek 516db28a20 Moves some memory op implementations to x64 file
These will need to be unique for 32bit
2020-11-26 18:06:27 -08:00
Ryan Houdek b228d6bad1 Moves the getdents implementations for x64
These end up being different for x32 so move them now
2020-11-26 17:58:32 -08:00
Ryan Houdek 71a9f2cb71 Captures another CPU count file
Some application was using this to determine CPU count as well
2020-11-17 12:56:18 -08:00
Ryan Houdek a42bdd9c2f Fixes 64bit ppoll
32bit ppoll is completely wrong here.
Will be fixed in upcoming PR
2020-10-20 18:33:46 -07:00
Ryan Houdek db77d5f580 Shuffles more x86-64 specific syscalls to the correct folder 2020-10-13 16:56:09 -07:00
Ryan Houdek ee55204eaa Fixes 32bit syscalls
This doesn't change behaviour on the 64bit side of things.

Currently the 32bit syscall implementation is "best effort".
Anything that easily maps is passed through, and a few minor ones that
rely on iovec are handled.

Still around 80 syscalls that aren't punched through yet.

Few of these changes could have been split up so it's a bit of a
nightmare.
2020-10-06 18:46:26 -07:00
Ryan Houdek c39781275f Merge pull request #396 from FEX-Emu/skmp/execve-only-existing-files
syscalls: execve should fail on missing files
2020-09-22 15:25:08 -07:00
Stefanos Kornilios Mitsis Poiitidis a8a0a270f6 Syscalls: Execve should fail for not existing files 2020-09-23 01:22:14 +03:00
Stefanos Kornilios Mitsis Poiitidis 2425ab994b Thunks: Generation script refactor, generic callbacks 2020-09-22 14:35:38 +03:00
Ryan Houdek d0de92f97a Removes error and die in multithreaded forks
This can result in some terrible behaviour if something doesn't
immediately execve once it forks. Allow it instead of crashing out
though.
2020-09-16 11:29:57 -07:00
Ryan Houdek ddecec12ec Spam out a wackload more syscalls
Almost all of these end up being simple passthrough.
This covers most syscalls, the remaining ones are signal related, exec
related, or rseq required.

All of these syscalls exist prior to Linux 5.0. We are using these with
the expectation still that the host Linux implementation is 5.0 or
higher.
Once we implement newer syscalls we will need to start checking for host
Linux version. We don't really have a care about devices shipping older
4.x kernels atm.
2020-09-16 10:48:56 -07:00
Ryan Houdek 6f5e55c141 Merge pull request #372 from FEX-Emu/skmp/fix-brk-limit
Syscalls/BRK: Don't use more memory than mapped
2020-09-11 14:59:21 -07:00
Stefanos Kornilios Mitsis Poiitidis abcdff6a50 EmulatedFiles: Don't crash on too long paths 2020-09-12 00:53:39 +03:00
Stefanos Kornilios Mitsis Poiitidis b3ae845071 Syscalls/BRK: Don't use more memory than mapped 2020-09-12 00:39:11 +03:00
Stefanos Kornilios Mitsis Poiitidis 87dbefd0a3 Merge pull request #367 from Sonicadvance1/sigsuspend
Implements sigsuspend
2020-09-11 10:43:50 +03:00
Ryan Houdek 1309b4a0c5 Merge pull request #363 from Sonicadvance1/fix_thread_fork_shutdown
Ensures a process that has forked won't shutdown the other process
2020-09-11 00:05:22 -07:00
Stefanos Kornilios Mitsis Poiitidis f11b1a5c4b Merge pull request #360 from Sonicadvance1/memory_syscalls
Implements two more memory syscalls
2020-09-11 09:22:21 +03:00
Ryan Houdek fb6e3535d8 Implements capget and capset syscalls
These are safe to pass through to the host, there isn't any system data
handled here.

Some game I was testing used these
2020-09-10 22:30:51 -07:00
Ryan Houdek a3ee4dff45 Implements sigsuspend
This helps out Mono's garbage collector specifically. There is a minor
race that can currently occur with signal 63 but that technically should
only occur on a pause or stop condition.

Might need to change this behaviour if it becomes a problem
2020-09-10 21:50:29 -07:00
Ryan Houdek 0df06960e1 Ensures a process that has forked won't shutdown the other process
Since we track the PID and TID of the threads for signaling purposes, we
had the problem that if a process forked and the child then shuts down.
It was still tracking the parent thread as executing, thus it would send
it a tgkill to shut it down.

This was unintended behaviour and is now stopped
2020-09-10 18:21:16 -07:00
Ryan Houdek fb459701f4 Implements two more memory syscalls
These don't really do much in a coherent and UMA situation, but some
games are hitting them, so may as well as implement them
2020-09-10 16:38:37 -07:00
Ryan Houdek d39fe11427 Fixes getpriority syscall
Just use the syscall directly rather than call through the glibc
interface.

The getpriority syscall biases the return value so it never returns a
negative, while the glibc interface returns [-20,19), so you need to do
some errno juggling for the -1 return.

Just use the syscall directly instead

Fixes some game complaining heavily when getpriority results were wrong
2020-09-10 16:34:20 -07:00
Ryan Houdek 61072ba37e Has /proc/cpuinfo generated from CPUID
Instead of having this file mostly just copy and pasted, it'll now be
generated.
We end up losing a lot of supported flags with this change, which is for
the best since we wouldn't have actually supported those things.
2020-09-05 16:59:10 -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
Stefanos Kornilios Mitsis Poiitidis 45288506e1 Syscalls: Actually fix sched_getaffinity 2020-08-29 03:11:06 +03:00
Stefanos Kornilios Mitsis Poiitidis f16f7dcdd7 Syscalls: Fix sched_getaffinity 2020-08-29 00:18:20 +03:00
Ryan Houdek 758de4deaa Implements rt_sigpending
Any time a guest signal is blocked, add it to the guest signal mask.
This doesn't use a signal queue so repeat signals can end up being lost.
This is expected behaviour

This doesn't help with implementing the problem of unblocking signals
causing the masked signal to be resent
2020-08-20 13:47:03 -07:00
Ryan Houdek c7d14a33d4 Implements ioperm syscall as no permissions
This syscall requires the application to have root and will fail with
-EPERM otherwise.
Implementing this as just an -EPERM return allows Crispy Doom to run
2020-08-19 23:31:06 -07:00
Ryan Houdek 7700a4d24b Adds support for guest sigprocmask
This was causing our SIGBUS handling to fail in FTL
2020-08-18 21:00:33 +01:00
Stefanos Kornilios Mitsis Poiitidis cb34056f18 Merge pull request #294 from Sonicadvance1/aarch64_signals
Signals for AArch64
2020-08-12 19:47:10 +03:00
Ryan Houdek f705baf2f0 Extends SignalDelegator duty
It needs to track guest SigAltAction and have its own definitions for
sigaction and sa_mask. sa_mask specifically is defined differently
between the kernel and glibc.

Also fixes some issues with the SignalDelegator that posix tests found
2020-08-11 00:33:49 +01:00
Stefanos Kornilios Mitsis Poiitidis db633b8394 Thunklibs: Add partial X11, SDL, GL, EGL, asound, cmake integration 2020-08-08 14:48:20 +03:00