mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-10 00:00:19 +02:00
When thread management was moved to the frontend, invalidation moved from being a global operation to per-thread but the WOW64 backend wasn't updated to account for this. Now for any invalidation event loop over all threads tracked by the frontend and invalidate the appropriate range.
36 lines
1.0 KiB
C++
36 lines
1.0 KiB
C++
// SPDX-License-Identifier: MIT
|
|
#pragma once
|
|
|
|
#include "IntervalList.h"
|
|
#include <mutex>
|
|
#include <unordered_map>
|
|
|
|
namespace FEXCore::Core {
|
|
struct InternalThreadState;
|
|
}
|
|
|
|
namespace FEXCore::Context {
|
|
class Context;
|
|
}
|
|
|
|
namespace FEX::Windows {
|
|
/**
|
|
* @brief Handles SMC and regular code invalidation
|
|
*/
|
|
class InvalidationTracker {
|
|
public:
|
|
InvalidationTracker(FEXCore::Context::Context& CTX, const std::unordered_map<DWORD, FEXCore::Core::InternalThreadState*>& Threads);
|
|
void HandleMemoryProtectionNotification(uint64_t Address, uint64_t Size, ULONG Prot);
|
|
void InvalidateContainingSection(uint64_t Address, bool Free);
|
|
void InvalidateAlignedInterval(uint64_t Address, uint64_t Size, bool Free);
|
|
void ReprotectRWXIntervals(uint64_t Address, uint64_t Size);
|
|
bool HandleRWXAccessViolation(uint64_t FaultAddress);
|
|
|
|
private:
|
|
IntervalList<uint64_t> RWXIntervals;
|
|
std::mutex RWXIntervalsLock;
|
|
FEXCore::Context::Context& CTX;
|
|
const std::unordered_map<DWORD, FEXCore::Core::InternalThreadState*>& Threads;
|
|
};
|
|
} // namespace FEX::Windows
|