diff --git a/src/core/kernel/exports/EmuKrnlKe.cpp b/src/core/kernel/exports/EmuKrnlKe.cpp index e78614bb8..45a3a521a 100644 --- a/src/core/kernel/exports/EmuKrnlKe.cpp +++ b/src/core/kernel/exports/EmuKrnlKe.cpp @@ -96,11 +96,10 @@ namespace NtDll // TODO : Move towards thread-simulation based Dpc emulation typedef struct _DpcData { CRITICAL_SECTION Lock; - HANDLE DpcEvent; xbox::LIST_ENTRY DpcQueue; // TODO : Use KeGetCurrentPrcb()->DpcListHead instead } DpcData; -DpcData g_DpcData = { 0 }; // Note : g_DpcData is initialized in InitDpcThread() +DpcData g_DpcData = { 0 }; // Note : g_DpcData is initialized in InitDpcData() xbox::ulonglong_xt LARGE_INTEGER2ULONGLONG(xbox::LARGE_INTEGER value) { @@ -479,14 +478,12 @@ void ExecuteDpcQueue() LeaveCriticalSection(&(g_DpcData.Lock)); } -void InitDpcThread() +void InitDpcData() { - DWORD dwThreadId = 0; - + // Let's initialize the Dpc handling thread too, + // here for now (should be called by our caller) InitializeCriticalSection(&(g_DpcData.Lock)); InitializeListHead(&(g_DpcData.DpcQueue)); - EmuLogEx(CXBXR_MODULE::INIT, LOG_LEVEL::DEBUG, "Creating DPC event\n"); - g_DpcData.DpcEvent = CreateEvent(/*lpEventAttributes=*/nullptr, /*bManualReset=*/FALSE, /*bInitialState=*/FALSE, /*lpName=*/nullptr); } static constexpr uint32_t XBOX_TSC_FREQUENCY = 733333333; // Xbox Time Stamp Counter Frequency = 733333333 (CPU Clock) @@ -498,13 +495,6 @@ ULONGLONG CxbxGetPerformanceCounter(bool acpi) return Timer_GetScaledPerformanceCounter(period); } -void CxbxInitPerformanceCounters() -{ - // Let's initialize the Dpc handling thread too, - // here for now (should be called by our caller) - InitDpcThread(); -} - // ****************************************************************** // * 0x005C - KeAlertResumeThread() // ****************************************************************** diff --git a/src/core/kernel/init/CxbxKrnl.cpp b/src/core/kernel/init/CxbxKrnl.cpp index 94f7db80b..3643381af 100644 --- a/src/core/kernel/init/CxbxKrnl.cpp +++ b/src/core/kernel/init/CxbxKrnl.cpp @@ -1205,8 +1205,8 @@ static void CxbxrKrnlInitHacks() Timer_Init(); // for unicode conversions setlocale(LC_ALL, "English"); - // Initialize time-related variables for the kernel and the timers - CxbxInitPerformanceCounters(); + // Initialize DPC global + InitDpcData(); #ifdef _DEBUG // PopupCustom(LOG_LEVEL::INFO, "Attach a Debugger"); // Debug child processes using https://marketplace.visualstudio.com/items?itemName=GreggMiskelly.MicrosoftChildProcessDebuggingPowerTool diff --git a/src/core/kernel/init/CxbxKrnl.h b/src/core/kernel/init/CxbxKrnl.h index 0a1a46fc4..5f89fb5b0 100644 --- a/src/core/kernel/init/CxbxKrnl.h +++ b/src/core/kernel/init/CxbxKrnl.h @@ -155,7 +155,7 @@ void CxbxKrnlPanic(); /*! empty function */ void CxbxKrnlNoFunc(); -void CxbxInitPerformanceCounters(); // Implemented in EmuKrnlKe.cpp +void InitDpcData(); // Implemented in EmuKrnlKe.cpp /*! kernel thunk table */ extern uint32_t CxbxKrnl_KernelThunkTable[379];