Commit Graph
565 Commits
Author SHA1 Message Date
Stefanos Kornilios Mitsis Poiitidis bec3cfff14 X86Tables: Fix MOVD SRC/DST size 2020-09-15 12:58:50 +03:00
Ryan Houdek e9b74b0230 Initial Callback support
This interface is for native host code to be able to call back in to JIT
to execute guest code.
This is mainly for thunks but could be used for other purposes.
This can cross a couple ABI boundaries so one must be careful when
calling in to this
2020-09-11 15:48:51 -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 ad13c82918 Merge pull request #371 from Sonicadvance1/sigaction_gt64
Don't allow an application to try and set a signal past 64
2020-09-11 10:45:00 +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 e08972b06a Don't allow an application to try and set a signal past 64
We only have 64, this is invalid!
2020-09-11 00:35:39 -07:00
Scott Mansell abd98be5f1 Make Interpreter Reentrant; alloca SSAs on Stack 2020-09-11 19:31:31 +12: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
Stefanos Kornilios Mitsis Poiitidis 27dbc66e2e Merge pull request #361 from Sonicadvance1/cvtpd2dq
Implements missing CVTPD2DQ
2020-09-11 09:20:48 +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 8aeb6718ac Merge pull request #362 from Sonicadvance1/fix_guest_signal_dfl
Fixes guest default signal handling and pending signals
2020-09-10 19:00:29 -07:00
Ryan Houdek 095e3ee0f6 Merge pull request #359 from Sonicadvance1/fix_getpriority
Fixes getpriority syscall
2020-09-10 18:53:33 -07:00
Ryan Houdek 98aef5ee19 Merge pull request #355 from Sonicadvance1/initial_32bit_unittest
Adds initial 32bit unit tests
2020-09-10 18:50:06 -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 290e2b55c4 Fixes guest default signal handling and pending signals
glibc raise() actually disables all signals, raises the signal that the
user wants, then reenables the previous signal mask.

On the reenabling of the previous signal mask, that is when the pending
signal fires.
This needs to be accurately handled, so check for pending signals
getting unmasked in sigprocmask

This also then needs to be further fixed to handle default signal
handling, where if a signal was sent that is default ignored (NOT set to
ignore!) then it would just exit the application before.
Now something likg SIGCHLD with the default handler (aka ignore) won't
kill the process
2020-09-10 18:16:24 -07:00
Ryan Houdek 7a80f2bcbb Implements missing CVTPD2DQ
Without impementing MXCSR still, this matches the already implemented
CVTTPD2DQ
2020-09-10 16:50:05 -07:00
Ryan Houdek 07cb2c5ca2 Merge pull request #337 from FEX-Emu/skmp/dead-flags-mb
IR: Add DeadFlagStoreElimination
2020-09-10 16:43:52 -07:00
Ryan Houdek f61a2a74c1 Merge pull request #350 from FEX-Emu/skmp/fix-loopcc
loopOp: Constant takes size in bits, not bytes
2020-09-10 16:43:31 -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 5b0386ad83 Ensures the RIP only gets stored as 32bit in 32bit mode 2020-09-07 00:04:30 -07:00
Stefanos Kornilios Mitsis Poiitidis 0adb874755 IR/ConstProp: Disable BFE identity as it breaks cs:go 2020-09-07 00:58:29 +03:00
Stefanos Kornilios Mitsis Poiitidis e2fc0f03c9 loopOp: Constant takes size in bits, not bytes 2020-09-07 00:51:38 +03:00
Ryan Houdek 4b17521ab9 Merge pull request #343 from Sonicadvance1/cpuid_improvements
Has /proc/cpuinfo generated from CPUID
2020-09-06 12:40:03 -07:00
Ryan Houdek 6e28fd68c3 Merge pull request #344 from Sonicadvance1/rcpc
Adds support for RCPC load instructions
2020-09-06 12:31:28 -07:00
Stefanos Kornilios Mitsis Poiitidis 54bf7a095a Merge pull request #349 from Sonicadvance1/fix_altstack_disable
Fixes guest disabling sigaltstack.
2020-09-06 17:40:26 +03:00
Ryan Houdek 50227ba379 Fixes guest disabling sigaltstack.
Previously we never checked for SS_DISABLE.
We were also only ever checking for ss_sp being a valid memory range
when we should have been checking for the absense of SS_DISABLE.

Fixes #326
2020-09-05 21:59:52 -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 c12847cbcb Cleans up CPUID
Instead of saying we support the world, actually go through each
individual flag and say that we support the correct things.
Puts FEX plus the git hash in to the model name for now.
Once we have a tagged release in the future we can change this to have
its version tag inside of it.
2020-09-05 16:59:10 -07:00
Ryan Houdek 2175e9d9c8 Adds support for RCPC load instructions
If the host CPU supports RCPC instructions then it'll use those
instruction of atomics for LoadMemTSO ops.

This pushed my worst case FTL test from 16FPS to 17FPS .

There is another extension to RCPC to add short immediate offset support
which the c630 doesn't support any way. For future optimization on
hardware we can use that.
2020-09-05 16:58:50 -07:00
Ryan Houdek 5fe7466d92 Adds check for RCPC support 2020-09-05 16:58:50 -07:00
Ryan Houdek ee8dfc96fa Adds support for the AArch64 JIT to disable TSO
AArch64 is the only backend that currently needs to do something
different for TSO
2020-09-05 16:58:03 -07: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
Stefanos Kornilios Mitsis Poiitidis 0e0fddafec arm64: Return DebugData if passed 2020-09-03 07:06:18 +03:00
Stefanos Kornilios Mitsis Poiitidis 3083f9e12e Merge pull request #332 from FEX-Emu/skmp/iterative-rclse
IR: Iterative RCLSE
2020-09-03 05:18:11 +03:00
Stefanos Kornilios Mitsis Poiitidis e7cbe2ca91 Merge pull request #338 from FEX-Emu/skmp/identity-opts
IR: Add identity opts for AND/OR/XOR
2020-09-03 05:17:10 +03:00
Stefanos Kornilios Mitsis Poiitidis dd5c3a5e44 Merge pull request #333 from Sonicadvance1/more_signals
Moves our entire execution model over to signal execution
2020-09-03 02:12:21 +03:00
Ryan Houdek cf5afbcd8d Some minor optimizations in the AArch64 ASM dispatcher
Ensures the top of the loop is 16byte aligned to give Cortex's
prefetcher the best chance of loading the code.

If the address size is a power of two (We always do 64GB or 32GB VM atm)
then do the address size masking in one instruction instead of loading a
64bit constant first

Move some accessed constants to a literal pool at the end of the ASM
dispatcher.
2020-09-02 16:00:17 -07:00
Ryan Houdek a75a7b3dcd Fixes a crash in the AArch64 JIT from the previous signal work
Was accidently setting the buffer size then unmapping at that new size.
Make sure to unmap then resize.
Also cleans up which buffer is actually being touched here, only the
initial buffer ever changes here.
2020-09-02 16:00:17 -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 dbdc7e6b54 Merge pull request #340 from FEX-Emu/skmp/avoid-tzcnt
JIT/x86: Don't use tzcnt
2020-09-02 13:07:12 -07:00
Stefanos Kornilios Mitsis Poiitidis 273db52545 JIT/x86: Don't use tzcnt 2020-09-02 22:57:34 +03:00
Stefanos Kornilios Mitsis Poiitidis 2fb68583a0 IR: Add DeadFlagStoreElimination
Mutlblock pass that eliminates flag stores that are never read.

This is a sibling to RCLSE and will likely be absorbed by it when we add MB support there.
2020-09-02 21:57:39 +03:00
Stefanos Kornilios Mitsis Poiitidis b9ed084cc5 IR: Add identity opts for AND/OR/XOR 2020-09-02 21:50:54 +03:00
Stefanos Kornilios Mitsis Poiitidis aa3dc52799 RCLSE: Iterate until there are no changes 2020-09-02 21:34:39 +03:00
Stefanos Kornilios Mitsis Poiitidis 15da415ac6 arm64: Add movn to LoadConstant 2020-09-02 19:48:49 +03:00