Merge pull request #1445 from PatrickvL/X86_expand

X86 expand
This commit is contained in:
Luke Usher 2018-09-22 22:53:35 +01:00 committed by GitHub
commit ac719e2a40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 1492 additions and 212 deletions

View File

@ -1805,7 +1805,9 @@ void CxbxKrnlShutDown()
int BootFlags = 0;
g_EmuShared->SetBootFlags(&BootFlags);
delete g_NV2A; // TODO : g_pXbox
// NOTE: This causes a hang when exiting while NV2A is processing
// This is okay for now: It won't leak memory or resources since TerminateProcess will free everything
// delete g_NV2A; // TODO : g_pXbox
if (CxbxKrnl_hEmuParent != NULL)
SendMessage(CxbxKrnl_hEmuParent, WM_PARENTNOTIFY, WM_DESTROY, 0);

View File

@ -296,8 +296,8 @@ void genericException(EXCEPTION_POINTERS *e) {
static thread_local bool bOverrideException;
bool IsRdtscInstruction(xbaddr addr);
ULONGLONG CxbxRdTsc(bool xbox);
bool IsRdtscInstruction(xbaddr addr); // Implemented in CxbxKrnl.cpp
void EmuX86_Opcode_RDTSC(EXCEPTION_POINTERS *e); // Implemented in EmuX86.cpp
bool lleTryHandleException(EXCEPTION_POINTERS *e)
{
// Initalize local thread variable
@ -315,13 +315,8 @@ bool lleTryHandleException(EXCEPTION_POINTERS *e)
// Check if this exception came from rdtsc
if (IsRdtscInstruction(e->ContextRecord->Eip)) {
// If so, use a return value that updates with Xbox frequency;
// Avoid the overhead of xboxkrnl::KeQueryPerformanceCounter,
// by calling directly into it's backing implementation:
ULARGE_INTEGER PerformanceCount;
PerformanceCount.QuadPart = CxbxRdTsc(/*xbox=*/true);
e->ContextRecord->Eax = PerformanceCount.LowPart;
e->ContextRecord->Edx = PerformanceCount.HighPart;
e->ContextRecord->Eip += 2;
EmuX86_Opcode_RDTSC(e);
e->ContextRecord->Eip += 2; // Skip OPCODE_PATCH_RDTSC 0xEF 0x90 (OUT DX, EAX; NOP)
return true;
}
break;

File diff suppressed because it is too large Load Diff

View File

@ -1690,6 +1690,7 @@ static LRESULT WINAPI EmuMsgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar
case WM_CLOSE:
DestroyWindow(hWnd);
CxbxKrnlShutDown();
break;
case WM_SETFOCUS: