-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Linux] xenia-cpu-ppc-tests (Rebase of #803) #1339
base: master
Are you sure you want to change the base?
Conversation
b477dda
to
12b783f
Compare
Build is green on travis and appveyor |
Branch is ready for review as it is green. Here were my issues that were resolved.
|
So, in that specific function the difference between optimizing and not is the usage of AVX instructions. |
mov(qword[rsp + offsetof(StackLayout::Thunk, r[2])], r12); | ||
mov(qword[rsp + offsetof(StackLayout::Thunk, r[3])], r13); | ||
mov(qword[rsp + offsetof(StackLayout::Thunk, r[4])], r14); | ||
mov(qword[rsp + offsetof(StackLayout::Thunk, r[5])], r15); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
N.B: SysV does not have nonvolatile XMM registers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the suggested way of resolving this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry - I think this was a note for myself. I might suggest you just drop a comment here and state what I said, just so nobody goes "wut, why aren't xmm registers being saved"
Clang 6 would vectorize the arguments inside a different register in Release than in Debug. This led to inconsistent behavior depending on the optimization level. |
Rebased onto master and added the comment as per @DrChat request |
@Margen67 |
va_list are not guarenteed to maintain their values after being used. With clang on Linux, args is undefined after fetching length and will print "(null)". Copy args into another va_list before getting length to prevent this. Add tests.
Disable optimization on set zero to prevent clang from vectorizing the assigment to zero which would use different registers than expected. With -O0: RAX. With -O1: RDI.
Disable optimization on set zero to prevent clang from vectorizing the assigment to zero which would use different registers than expected.
Disable inlining on backend() which causes ppc issues on clang 7 in release builds.
Shim exports are called from GuestToHostThunk which dictates the calling convention. The default system calling convention is different depending on OS (Windows vs. everything else) and architecture. PR xenia-project#1339 addresses this for x64 Linux. There is no reason for explicit `__cdecl`. Also, it is not available in GCC. We could use `__attribute__((ms_abi))` or `__attribute__((sysv_abi))` but that just adds complexity.
Shim exports are called from GuestToHostThunk which dictates the calling convention. The default system calling convention is different depending on OS (Windows vs. everything else) and architecture. PR xenia-project#1339 addresses this for x64 Linux. There is no reason for explicit `__cdecl`. Also, it is not available in GCC. We could use `__attribute__((ms_abi))` or `__attribute__((sysv_abi))` but that just adds complexity.
Shim exports are called from GuestToHostThunk which dictates the calling convention. The default system calling convention is different depending on OS (Windows vs. everything else) and architecture. PR xenia-project#1339 addresses this for x64 Linux. There is no reason for explicit `__cdecl`. Also, it is not available in GCC. We could use `__attribute__((ms_abi))` or `__attribute__((sysv_abi))` but that just adds complexity.
Shim exports are called from GuestToHostThunk which dictates the calling convention. The default system calling convention is different depending on OS (Windows vs. everything else) and architecture. PR xenia-project#1339 addresses this for x64 Linux. There is no reason for explicit `__cdecl`. Also, it is not available in GCC. We could use `__attribute__((ms_abi))` or `__attribute__((sysv_abi))` but that just adds complexity.
Shim exports are called from GuestToHostThunk which dictates the calling convention. The default system calling convention is different depending on OS (Windows vs. everything else) and architecture. PR xenia-project#1339 addresses this for x64 Linux. There is no reason for explicit `__cdecl`. Also, it is not available in GCC. We could use `__attribute__((ms_abi))` or `__attribute__((sysv_abi))` but that just adds complexity.
Shim exports are called from GuestToHostThunk which dictates the calling convention. The default system calling convention is different depending on OS (Windows vs. everything else) and architecture. PR xenia-project#1339 addresses this for x64 Linux. There is no reason for explicit `__cdecl`. Also, it is not available in GCC. We could use `__attribute__((ms_abi))` or `__attribute__((sysv_abi))` but that just adds complexity.
Shim exports are called from GuestToHostThunk which dictates the calling convention. The default system calling convention is different depending on OS (Windows vs. everything else) and architecture. PR xenia-project#1339 addresses this for x64 Linux. There is no reason for explicit `__cdecl`. Also, it is not available in GCC. We could use `__attribute__((ms_abi))` or `__attribute__((sysv_abi))` but that just adds complexity.
Shim exports are called from GuestToHostThunk which dictates the calling convention. The default system calling convention is different depending on OS (Windows vs. everything else) and architecture. PR #1339 addresses this for x64 Linux. There is no reason for explicit `__cdecl`. Also, it is not available in GCC. We could use `__attribute__((ms_abi))` or `__attribute__((sysv_abi))` but that just adds complexity.
@@ -671,7 +671,7 @@ EMITTER_OPCODE_TABLE(OPCODE_VECTOR_SUB, VECTOR_SUB); | |||
// OPCODE_VECTOR_SHL | |||
// ============================================================================ | |||
template <typename T, std::enable_if_t<std::is_integral<T>::value, int> = 0> | |||
static __m128i EmulateVectorShl(void*, __m128i src1, __m128i src2) { | |||
static __m128i EmulateVectorShl(void*, __m128i& src1, __m128i& src2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
also, by the way.
The exception handler part has been merged into the main branch — thanks @uytvbn! 💚 I've also added RIP updating after an exception handler as that's needed for MMIO (it executes the |
…#2228 back to canary builds. This fixes various emulation crashes caused from different calling conventions on System-V ABI platforms compared to the Windows standard.
…#2228 back to canary builds. This fixes various emulation crashes caused from different calling conventions on System-V ABI platforms compared to the Windows standard.
… for Linux Upstream changes made from xenia-project#1339 and xenia-project#2228 back to canary builds. This fixes various emulation crashes caused from different calling conventions on System-V ABI platforms compared to Windows standard.
… for Linux Upstream changes made from xenia-project#1339 and xenia-project#2228 back to canary builds. This fixes various emulation crashes caused from different calling conventions on System-V ABI platforms compared to Windows standard.
Current Status on master
Currently on master, the ppc emulation tests are not tested on travis. If run manually, they fail due to gcc/clang using different registers than the MSVC compiler. Guest to host and host to guest calls fail.
Fix status of this PR
This PR takes the original commits of #803 which have merge conflicts and rebases them on current master. There was a large refactoring of
x64_backend.cc
and some work had to be done to resolve them.On top of that, I also enabled the tests on travis.
Currently, the tests run well on Debug and with the combination of this branch, #1317 and #1322 running roms actually execute code. There is more work to be done before an actual rom is playable but I was able to get guest to host logging calls from RDR. This may be fixed by getting the cpu (not cpu-ppc) tests green in another PR.
Original Description by @uytvbn in #803