31 lines
1.1 KiB
Diff
31 lines
1.1 KiB
Diff
# UNDF: UNDF-2026-XXXXXXXXX
|
|
--- a/src/core/kernel/support/PatchRdtsc.cpp
|
|
+++ b/src/core/kernel/support/PatchRdtsc.cpp
|
|
@@ -1,8 +1,8 @@
|
|
#include <cstdint>
|
|
#include <string>
|
|
-#include <vector>
|
|
+#include <unordered_set>
|
|
|
|
#include "core\kernel\init\CxbxKrnl.h"
|
|
|
|
-static std::vector<xbox::addr_xt> g_RdtscPatches;
|
|
+static std::unordered_set<xbox::addr_xt> g_RdtscPatches;
|
|
|
|
#define OPCODE_PATCH_RDTSC 0x90EF // OUT DX, EAX; NOP
|
|
|
|
@@ -14,7 +14,7 @@ bool IsRdtscInstruction(xbox::addr_xt addr)
|
|
// First the fastest check - does addr contain exact patch from PatchRdtsc?
|
|
// Second check - is addr on the rdtsc patch list?
|
|
return (*(uint16_t*)addr == OPCODE_PATCH_RDTSC)
|
|
- && (std::find(g_RdtscPatches.begin(), g_RdtscPatches.end(), addr) != g_RdtscPatches.end());
|
|
+ && (g_RdtscPatches.count(addr) != 0);
|
|
}
|
|
|
|
static void PatchRdtsc(xbox::addr_xt addr)
|
|
@@ -24,7 +24,7 @@ static void PatchRdtsc(xbox::addr_xt addr)
|
|
EmuLogInit(LOG_LEVEL::DEBUG, "Patching rdtsc opcode at 0x%.8X", (DWORD)addr);
|
|
*(uint16_t*)addr = OPCODE_PATCH_RDTSC;
|
|
- g_RdtscPatches.push_back(addr);
|
|
+ g_RdtscPatches.insert(addr);
|
|
}
|