-
Notifications
You must be signed in to change notification settings - Fork 517
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
Patch insertq
#635
base: main
Are you sure you want to change the base?
Patch insertq
#635
Conversation
Surely need to add a check for cpu's (AMD) that has SSE4.2a |
one game that uses it , is shadowman remaster |
Reviewable |
src/core/cpu_patches.cpp
Outdated
@@ -108,9 +118,7 @@ static Xbyak::Reg AllocateScratchRegister( | |||
UNREACHABLE_MSG("Out of scratch registers!"); | |||
} | |||
|
|||
#ifdef __APPLE__ |
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.
This was very intentionally ifdef'd out on non-Apple as it relies on their conventions for TLS in the GS segment register.
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.
Hmm in that case I could push/pop instead of using the Allocate functions if that has no side effects, or use some different storage
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.
From my experiements writing this system you cannot reliably use the stack or any registers without saving them somewhere first. The stack because some games have functions that use stack area below the stack pointer, so you don't have any way to know for sure whether you're clobbering data or not.
My solution was to save registers to TLS since it needs to be per-thread storage (and I have some code that saves the stack to TLS and allows arbitrary use of a replacement stack to save registers), but it still relies on the Apple TLS convention as you can do a simple write to gs + offset without any scratch 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.
Just to be clear, if there's a way to implement the save on other OSes without any scratch space that would resolve the issue. The rest of the code shouldn't have any OS-specific issues.
e77e045
to
cde1621
Compare
13c17b9
to
d46b944
Compare
e196849
to
62a28b2
Compare
Changed some stuff so it works with the illegal instruction handler, feel free to review |
No description provided.