Commit Graph
460 Commits
Author SHA1 Message Date
Stefanos Kornilios Mitsis Poiitidis 106892f824 Thunks: Use shared_mutex 2020-07-20 14:58:49 +03:00
Stefanos Kornilios Mitsis Poiitidis 8c8e6294b6 Thunks: ALTINST, OP_THUNK, basic infrastructure 2020-07-20 13:52:28 +03:00
Ryan Houdek 9b78876862 Fixes LLVM not clearing code cache on ARM platforms
Surprised this hasn't caused issues before but was picked up on the
SolidRun Honeycomb LX2K
2020-07-19 12:08:27 +11:00
Scott Mansell 183c5d9e22 Filesystem HLE: Intercept /proc/${getpid}/exe too 2020-07-18 09:16:59 +12:00
Ryan Houdek 2536bfe42c Correctly fixes prefix ordering in the frontend
This was sort of partially worked around.
The issue comes down to REX.W and Operand size prefix ordering on an
instruction.
When an instruction has both prefixes, then the one that has occured
later will overwrite the previous one.
Additionally in the case of 66h being reused as an escape prefix, we
needed to ignore it in this case.

The previous workaround was that if an instruction happened to have both
widening and narrowing, then widening would win(for MODRM args),
but then later on in the instruction decoding the literal constant
decoding would properly check which order the flags came in.
This resulted in literal constants working, but not modrm bytes

Instead replace the "last" flag handling with a two deep stack that we
can push and pop the flags correctly on to it, this ensures that the
flags stay around in the 66h ignoring mode (so widening doesn't get
obliterated).

This effects every instruction that supports REX.W and 66h Operand size
prefix, so it could be fixing some unknown bugs elsewhere.
Very specifically this one was found in OpenSSL, because it looks like
GCC is padding a mov instruction with 66h.

Instruction Examples:
Only difference is the prefix order being swapped
0x00000000   4                 66488b1f  mov rbx, qword [rdi]
0x00000004   4                 48668b1f  mov bx, word [rdi]
2020-07-15 00:10:20 -07:00
Ryan Houdek ac68dc40e5 Fixes INC and DEC flag setting
These two instructions explicitly don't set the CF flag.
Otherwise they behave the same as ADD/SUB flag setting
Fixes part of curl
2020-07-15 00:09:16 -07:00
Ryan Houdek 2dd7a8d16d Disables CLMUL in CPUID
This would be a pain to support in NEON since it requires a 128bit
resulting multiply
2020-07-13 10:27:48 -07:00
Stefanos Kornilios Mitsis Poiitidis f3014e43b8 Merge pull request #268 from Sonicadvance1/minor_fixes
Minor fixes
2020-07-13 12:31:09 +03:00
Ryan Houdek 383b8b7bb5 Fixes VADDV assert and implementation detail
AArch64's ADDV instruction doesn't support 8byte elements, it instead
needs to use ADDP(scalar) for the operation.

Fixes an assert and minor behaviour difference there
2020-07-12 03:41:02 +01:00
Ryan Houdek 43a8915074 Works around some vixl asserts
These don't change behaviour, but in debug mode were causing asserts
2020-07-12 03:39:55 +01:00
Ryan Houdek 80b9b45b3e Cleans up a couple warnings 2020-07-11 06:21:28 +01:00
Ryan Houdek f593906c9a Fixes LORegion feature detection problem
LORegion is a requirement of ARMv8.1, but the hypervisor of the c630
isn't exposing the identification register correctly.
If the host supports atomics, just assume it supports LORegions as well

Fixes an assert when building vixl in debug
2020-07-11 06:21:08 +01:00
Ryan Houdek 1f727c5826 Fixes Vector_FToF op on AArch64 JIT
Only fixes asserts, no code emission changes
2020-07-11 06:20:57 +01:00
Ryan Houdek cb74beadb4 Fixes Zext on FPR->GPR conversion for AArch64
The 32bit and lower sizes were making vixl asserts fire.
Wouldn't actually change emitted code
2020-07-11 06:20:50 +01:00
Ryan Houdek d281e9f7ff Fixes LDIV bug in aarch64 JIT
vixl asserts were firing for the 16bit variant, and we needed to sext
the divisor for the 32bit variant
2020-07-11 06:20:40 +01:00
Ryan Houdek a1db6a0dec Adds new signal delegator class
Allows us to register host and guest signal delegators.
Currently only host signals are handled, guest signal delegation will
take a bit of work still.
2020-07-11 06:12:06 +01:00
Stefanos Kornilios Mitsis Poiitidis 630d66942c uname: Should return x86_64, not x64_64
Run into this in CS:GO.
With this fix it progresses much further, but still doesn't get to the menu.
2020-07-08 20:58:57 +03:00
Stefanos Kornilios Mitsis Poiitidis 951ff40904 Frontend: Fix 15-byte long opcode assert 2020-07-08 14:00:14 +03:00
Ryan Houdek 15d6f48ca2 Merge pull request #258 from FEX-Emu/skmp/more-syscalls
syscalls: fork, vfork, eventfd2
2020-07-06 09:51:41 -07:00
Stefanos Kornilios Mitsis Poiitidis 560d467058 VURAvg: Fix arm64 jit 2020-07-04 21:52:15 +03:00
Stefanos Kornilios Mitsis Poiitidis 8eaa11f4f2 VURAvg: Fix llvm implementation 2020-07-04 20:51:13 +03:00
Stefanos Kornilios Mitsis Poiitidis c19e8b3d2f Implement PAVGB/PAVGW 2020-07-04 19:30:53 +03:00
Stefanos Kornilios Mitsis Poiitidis fc2d7656e0 syscalls: Warn on clone + ptrace instead of assert 2020-07-04 19:04:08 +03:00
Stefanos Kornilios Mitsis Poiitidis cb8f250078 syscalls: fork, vfork, eventfd2 2020-07-03 11:17:51 +03:00
Ryan Houdek 9c99dbfbdc Fixes AtomicSwap IR op on x86
lock prefix needed to go before the xchg, not before the move that was
there
2020-07-02 22:18:44 -07:00
Ryan Houdek 95f1775df5 Merge pull request #255 from FEX-Emu/skmp/implement-execve
syscalls: implement execve
2020-07-02 14:41:13 -07:00
Ryan Houdek 59cc3b576e Merge pull request #256 from FEX-Emu/skmp/implement-some-syscalls
syscalls: Implement a few easy ones
2020-07-02 14:40:25 -07:00
Ryan Houdek 03e084c7f0 Merge pull request #248 from FEX-Emu/fork_syscall
clone: Some support for fork, Flag validation
2020-07-02 14:39:23 -07:00
Stefanos Kornilios Mitsis Poiitidis 370397198b syscalls: (*)get/setxattr 2020-07-02 19:46:41 +03:00
Stefanos Kornilios Mitsis Poiitidis 9c48c7f487 syscalls: truncate,creat,chown,fchown,lchown,setpgid,getpgid,setfsuid,setfsgid,getsid,sync,syncfs 2020-07-02 19:34:21 +03:00
Stefanos Kornilios Mitsis Poiitidis 8234ffce3d syscalls: implement execve 2020-07-02 18:14:28 +03:00
Stefanos Kornilios Mitsis Poiitidis 0a66654161 Merge pull request #252 from Sonicadvance1/remove_strace_compile_time
Removes syscall strace parsing if not enabled
2020-07-02 12:48:23 +03:00
Ryan Houdek 4612fb5a67 Implements support for cache clearing in the ARM64 JIT
Previously the ARM64 JIT didn't support cache clearing at all.
This adds support for clearing the JIT cache while keeping dispatcher
helpers around and the ASM dispatcher alive.
2020-07-01 23:07:09 -07:00
Ryan Houdek bb60044e12 Splits JitArm64 IR handlers to a jump table
Improves compilation time by multiple minutes
Clang was taking multiple minutes to compile JIT.cpp for ARM.
This drops it down to a handful of seconds instead.

No functional behaviour change, only movement.
JIT compile times might deviate slightly moving from a switch to a jump
table, but will be negligible in either direction.
2020-07-02 02:46:14 +01:00
Ryan Houdek 62f9917b79 Removes syscall strace parsing if not enabled
This was spending ~60seconds of time compiling on my c630.
Something about fmt string formatting causing heavy compile times on
ARM.
Better to just compile it out anyway.
2020-07-01 06:11:35 +01:00
Ryan Houdek ce15a1bdcd Corrects MM register alignment in CoreState
This was misaligned by 8 bytes, which worked fine on x86, but crashed
when loaded on ARM.

Now it is correctly aligned to 128bit
2020-07-01 06:08:39 +01:00
Stefanos Kornilios Mitsis Poiitidis 2ccaea7d66 clone: Validate flags, cleanup 2020-06-30 16:23:43 +03:00
Ryan Houdek 8a5813e4d0 [WIP] Fork syscall support
Bit buggy
2020-06-30 16:22:47 +03:00
Ryan Houdek bd26d15879 Fixes LLVM multiblock
The break ir op is actually a block ender and it happened that in
regular code paths they were already ending the blocks correctly.

This enforces block ending in the Unimplemented op so multiblock still
generates the invalid code path correctly and it compiles.
We hit these a few times in multiblock for times in the code where it is
checking for CPU features and choosing a code path depending on CPUID
results.

Potentially these could be made in to no-ops since we'll never hit these
codepaths in practice, but it is nicer to break in case we actually do
hit one of these paths.
2020-06-26 12:31:15 -07:00
Ryan Houdek b73b585db3 Merge pull request #246 from FEX-Emu/skmp/fix-syscall-forward-macro
Syscalls/x64: Fix SYSCALL_FORWARD_ERRNO
2020-06-25 04:58:15 -07:00
Stefanos Kornilios Mitsis Poiitidis 7b7c4a9730 Syscalls/x64: Fix SYSCALL_FORWARD_ERRNO 2020-06-25 14:51:01 +03:00
Stefanos Kornilios Mitsis Poiitidis 4e515abb33 Syscalls: Add a wrapping class for better backtrace 2020-06-25 14:29:02 +03:00
Ryan Houdek 8e95d502f3 Merge pull request #226 from FEX-Emu/skmp/add-all-syscall
Dynamic Syscall Regsistration, Automatic Strace generation
2020-06-25 03:18:43 -07:00
Ryan Houdek 2bcc46c9e5 Implements FFREEP support in the OpDispatcher
There's some history for this instruction. It is not in the official
instruction documentations from AMD or Intel but it is supported on
almost every x87 supporting CPU (I think there was some Cyrix that
missed it?)

This was originally implemented by accident on the Intel 80287 CPU.
It was then periodically documented in random documentation.

The instruction behaves exactly like FFREE but then pops the stack after
the operation.
For our current implementation of FFREE, which is a NOP, we just need to
pop the stack.
2020-06-20 08:11:26 -07:00
Stefanos Kornilios Mitsis Poiitidis df1ed9442b Syscalls/x64: Add stubs for all syscalls, remove some syscall entries that are too new 2020-06-19 20:30:06 +03:00
Stefanos Kornilios Mitsis Poiitidis 7c2efe0155 Syscalls: Cleanup headers, add names, add NotImplemented 2020-06-19 13:07:07 +03:00
Stefanos Kornilios Mitsis Poiitidis eddd3dd4ed Syscalls/x64: Cleanup and document syscall registration/forwarding logic 2020-06-19 09:45:00 +03:00
Stefanos Kornilios Mitsis Poiitidis db213f94f3 Syscalls: Implement tkill, tgkill 2020-06-18 20:18:56 +03:00
Stefanos Kornilios Mitsis Poiitidis 0bf585bf76 Syscalls: Dynamic registration, auto strace generation 2020-06-18 19:57:58 +03:00
Scott Mansell 41635ee8be Implement fallocate syscall 2020-06-17 23:47:52 +12:00