mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-12 14:00:43 +02:00
Windows: Handle NtReadFile calls to RX protected RWX memory
Handling this safely requires blocking all compilation for the duration of the read, as fault-based tracking doesn't work when wine's unix side itself is the one performing the write into the RWX region (we cannot catch unix faults). Fixes a startup crash in Persona 5.
This commit is contained in:
1 parent
ec13e5d503
commit
8e9f593c39
4 files changed
+93
-23
No files matched your search
@@ -1004,7 +1004,25 @@ void BTCpuNotifyUnmapViewOfSection(void* Address, BOOL After, ULONG Status) {
|
||||
}
|
||||
}
|
||||
|
||||
void BTCpuNotifyReadFile(HANDLE Handle, void* Address, SIZE_T Size, BOOL After, NTSTATUS Status) {}
|
||||
void BTCpuNotifyReadFile(HANDLE Handle, void* Address, SIZE_T Size, BOOL After, NTSTATUS Status) {
|
||||
auto& InLockedRWXRead = GetFrontendThreadData(GetTLS().ThreadState())->InLockedRWXRead;
|
||||
if (!After) {
|
||||
ThreadCreationMutex.lock();
|
||||
CTX->GetCodeInvalidationMutex().lock();
|
||||
if (InvalidationTracker->BeginUntrackedWriteLocked(reinterpret_cast<uint64_t>(Address), static_cast<uint64_t>(Size))) {
|
||||
InLockedRWXRead = true;
|
||||
} else {
|
||||
CTX->GetCodeInvalidationMutex().unlock();
|
||||
ThreadCreationMutex.unlock();
|
||||
}
|
||||
} else {
|
||||
if (InLockedRWXRead) {
|
||||
InLockedRWXRead = false;
|
||||
CTX->GetCodeInvalidationMutex().unlock();
|
||||
ThreadCreationMutex.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOLEAN WINAPI BTCpuIsProcessorFeaturePresent(UINT Feature) {
|
||||
return CPUFeatures->IsFeaturePresent(Feature) ? TRUE : FALSE;
|
||||
|
||||
Reference in new issue
Block a user