Commit Graph
276 Commits
Author SHA1 Message Date
Ryan Houdek fd857e4966 Makes threaded compilation not rely on a global mutex
As we run more threaded applications it is becoming apparent that this
needs to be fixed now.
This duplicates the FrontendDecoder and Passmanager per thread so they
no longer block each other while compiling.
Increases a bit of memory usage but completely worth it.
2020-05-27 10:18:02 -07:00
Stefanos Kornilios Mitsis Poiitidis 2fd8e617ff Merge pull request #207 from Sonicadvance1/interpreter_fallback
Adds support for interpreter fallback
2020-05-27 14:20:58 +03:00
Stefanos Kornilios Mitsis Poiitidis 22a4c5185d Merge pull request #208 from Sonicadvance1/fence_ops
Implements fence ops
2020-05-27 14:18:21 +03:00
Ryan Houdek 77e444e8a5 Fixes SCAS
Adds a couple of assets in the other repeat instructions.
Jump targets were accidently inverted.
SCAS and LODS are the two repeat instructions we don't have unit tests
for.
Unit tests are forthcoming for this
2020-05-26 22:51:11 -07:00
Ryan Houdek 38ff936c81 Adds support for interpreter fallback
The IRHeader itself contains a flag for if a block should fallback to
the interpreter.
This is necessary for the case that an IR is loaded and the Frontend
object no longer has the data necessary to know if it should do an
interpreter fallback.
This is super useful for bisecting JIT versus Intepreter failures, and
also cases where falling back to intepreter for compatibility is a lot
more simple than wiring things through the JIT (ala x87)

This isn't currently utilized, but will be once x87 work lands
2020-05-26 19:08:18 -07:00
Ryan Houdek 5569894d81 Implements fence ops
These map directly to x86 fence instructions, which have equivalent ARM
versions as well.
2020-05-26 19:04:35 -07:00
Ryan Houdek f23a0997e7 Merge pull request #200 from Sonicadvance1/finish_x87_table
Finishes x87 instruction table flags
2020-05-26 01:31:32 -07:00
Ryan Houdek 56128d98b0 Merge pull request #202 from Sonicadvance1/fix_pid_tid_problem
Forces the primary application thread to be host primary thread
2020-05-26 00:41:07 -07:00
Stefanos Kornilios Mitsis Poiitidis 25ddef17c1 Merge pull request #203 from Sonicadvance1/fix_includes
Fixes some missing includes
2020-05-26 10:04:08 +03:00
Stefanos Kornilios Mitsis Poiitidis 7a9a95583c Merge pull request #190 from Sonicadvance1/fix_128bit_div
Fixes 128bit divisions on AArch64
2020-05-26 09:34:32 +03:00
Ryan Houdek 7c8f7c732f Fixes some missing includes 2020-05-25 20:04:17 -07:00
Ryan Houdek 0130b41a10 Forces the primary application thread to be host primary thread
This is a bit of a peculiar one, we want to ensure a single threaded
application is running on the emulator's primary thread.
This mitigates the problem that an application can do a getpid versus
gettid comparison and notice a problem.
Some games rely on getpid being the actual process ID and will spin
forever if it isn't the case.

This is also necessary for wine bringup since thread creation needs a
bit more finesse there.

Fixes #186
2020-05-25 19:56:05 -07:00
Ryan Houdek 566d83e334 Finishes x87 instruction table flags 2020-05-25 18:02:27 -07:00
Stefanos Kornilios Mitsis Poiitidis ec8eac2836 Merge pull request #197 from Sonicadvance1/remove_xop
Removes XOP frontend handling
2020-05-25 17:16:44 +03:00
Stefanos Kornilios Mitsis Poiitidis a69a821773 Merge pull request #192 from Sonicadvance1/fix_aarch64_llvm9
Fixes LLVM on AArch64
2020-05-25 17:06:28 +03:00
Ryan Houdek 45bf39ca0f Removes XOP frontend handling
This keeps the XOP instruction tables around but removes the decoding
assert.
This lets us implement the POP instruction that overlapped the XOP
prefix without having to deal with XOP at all.

I don't believe we have any real need to support XOP, but if it is a
thing later then it'll be easy to add back
2020-05-25 00:53:14 -07:00
Ryan Houdek 7c98f5a3ac Fixes LLVM on AArch64
LLVM-9 doesn have the include, while LLVM-10 does
2020-05-24 00:19:54 -07:00
Ryan Houdek 61c0fde8fe Fixes ASHR on AArch64
Smaller than 8byte wasn't sexting to the full register so it was causing issues
2020-05-24 00:18:51 -07:00
Ryan Houdek 600ad7f597 Fixes 128bit divisions on AArch64
These were only doing 64bit divisions.
Function calls are a bit ugly but once the new RA lands we can clean them up
2020-05-23 23:45:52 -07:00
Ryan Houdek 64556e3eac Ensures passmanager gets the syscall handler during core init 2020-05-14 01:04:04 -07:00
Ryan Houdek d2cf07a4fd Passes the running mode through from FEX to FEXCore 2020-05-14 00:56:31 -07:00
Stefanos Kornilios Mitsis Poiitidis a65bb87fa8 Merge pull request #183 from Sonicadvance1/fix_frontend_imm
Fixes a bug in the frontend regarding constants
2020-05-12 19:52:43 +03:00
Ryan Houdek 0b88984005 Fixes a bug in the frontend regarding constants
Optimization passes found a bug in the frontend regarding constants.

Specifically in the case of instructions that have a 32bit constant that
are sign extended to 64bit was being incorrectly set to have a size of
32bits (the size of the constant).
So an optimization pass would rematerialize constants of the expected
size, thus ~0ULL would turn in to ~0U and generate invalid code.

Now watch the destination size and set the constant to that size, which
matches what its size will be.
2020-05-11 16:10:50 -07:00
Ryan Houdek e6e4634651 Ensures LLVM JIT doesn't crash if DebugInfo isn't provided
IR doesn't have DebugInfo, all the other backends already handle this
2020-05-09 12:21:54 -07:00
Ryan Houdek 718b3e6b4c Refactors PassManager to ingest IREmitter class instead of OpDispatcher
The Passmanager passes need very little or zero x86 knowledge to do
their work. They don't need the x86 OpDispatcher handling code at all.
Convert this entirely over to using the IREmitter class so it can
actually optimize IR code from the IRLoader frontend
2020-05-09 12:14:59 -07:00
Ryan Houdek dc87134af3 Switches the OpcodeDispatcher over to using the new IREmitter class 2020-05-08 19:08:14 -07:00
Ryan Houdek c25f2845d3 Adds the ability for the frontend codeloader to load IR
This will be used by the IR unit test loader.
Will give the backend IR so it doesn't even parse any x86 code
2020-05-07 17:40:29 -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
Ryan Houdek 0d89de2799 Merge pull request #175 from Sonicadvance1/xmm_to_mmx
Implements three XMM <-> MMX conversion instructions
2020-05-01 00:52:46 -07:00
Scott Mansell 22a557b2db Remove stray debug code 2020-05-01 19:12:00 +12:00
Ryan Houdek deb5bd8fe8 Implements three XMM <-> MMX conversion instructions
CVTPI2PS does MMX->XMM integer to float conversion with lower 64bit
insert

CVTPS2PI/CVTTPS2PI does an XMM->XMM float to integer conversion
2020-04-29 19:03:48 -07:00
Ryan Houdek 9848f7eac8 Implements the XLAT instruction
This is a fairly straightforward instruction, it's just <segment>:[rBX + AL]
Needs the previous changes since we weren't handling GS correctly
2020-04-29 18:26:03 -07:00
Ryan Houdek 6a98e93666 Implements the segment reading and writing instructions 2020-04-29 18:25:46 -07:00
Ryan Houdek a0f412d85a Update the new register segment reading and writing table flags
These are instructions that can executed at any CPL level
2020-04-29 18:25:46 -07:00
Ryan Houdek 53798f194e Fix the Frontend's handling of the GS prefix
We were accidently treating it as FS each time it was encountered
2020-04-29 18:25:46 -07:00
Ryan Houdek e49a66f740 Implements support for the three loop instructions
loop, loope, loopne
2020-04-29 17:20:09 -07:00
Ryan Houdek 8f2f046fc8 Merge pull request #157 from Sonicadvance1/rcp
Implements support for rcpps/rcpss
2020-04-29 16:03:38 -07:00
Ryan Houdek 056d017ac8 Merge pull request #160 from Sonicadvance1/horizontal_arith
Implements four new vector horizontal ALU ops
2020-04-29 12:56:26 -07:00
Ryan Houdek f99482ed84 Implements four new vector horizontal ALU ops
haddps, hsubps, haddpd, hsubpd
2020-04-29 12:47:27 -07:00
Ryan Houdek f0229fba38 Implements the two new ops in the LLVM JIT 2020-04-29 12:47:27 -07:00
Ryan Houdek f6814de357 Implements the two new ops in the x86-64 JIT 2020-04-29 12:47:27 -07:00
Ryan Houdek 1645e65ff3 Implements the two new ops in the AArch64 JIT 2020-04-29 12:47:27 -07:00
Ryan Houdek 1c572e71c7 Implements the two new ops in the interpreter 2020-04-29 12:47:27 -07:00
Ryan Houdek fee4aeaf88 Merge pull request #167 from Sonicadvance1/fix_exec
Fixes loading EXEC applications in to memory.
2020-04-29 12:31:33 -07:00
Ryan Houdek 2005a2ea3d Merge pull request #164 from Sonicadvance1/fwait
Implements fwait as a nop
2020-04-29 12:30:45 -07:00
Ryan Houdek f1403e5f54 Merge pull request #161 from Sonicadvance1/jrcxz
Implements JRCXZ in the OpcodeDispatcher
2020-04-29 12:30:25 -07:00
Ryan Houdek 3d782f0930 Merge pull request #156 from Sonicadvance1/movsldup
Implements support for movsldup
2020-04-29 12:27:37 -07:00
Ryan Houdek 169875c34d Merge pull request #155 from Sonicadvance1/non_temporal
Implements two non-temporal XMM move instructions
2020-04-29 12:27:22 -07:00