Remove __try/__catch blocks: Vectored Exceptions made this unnecessary

This commit is contained in:
Luke Usher 2018-08-16 19:00:58 +01:00
parent 62f2f8dc80
commit 1ff481ac0a
4 changed files with 31 additions and 72 deletions

View File

@ -195,14 +195,7 @@ void SetupPerTitleKeys()
void CxbxLaunchXbe(void(*Entry)())
{
__try
{
Entry();
}
__except (EmuException(GetExceptionInformation()))
{
EmuLog(LOG_PREFIX, LOG_LEVEL::WARNING, "Problem with ExceptionFilter");
}
Entry();
}
// Entry point address XOR keys per Xbe type (Retail, Debug or Chihiro) :
@ -693,8 +686,8 @@ bool IsRdtscInstruction(xbaddr addr)
// Note : Check second opcode first, as that's most likely to fail fast
return (opAddr[1] == 0x90) // NOP
&& (opAddr[0] == 0xEF) // OUT DX, EAX
// Note : It's not needed to check for g_SkipRdtscPatching,
// as when that's set, the g_RdtscPatches vector will be empty
// Note : It's not needed to check for g_SkipRdtscPatching,
// as when that's set, the g_RdtscPatches vector will be empty
// anyway, failing this lookup :
&& (std::find(g_RdtscPatches.begin(), g_RdtscPatches.end(), addr) != g_RdtscPatches.end());
}

View File

@ -161,18 +161,12 @@ DWORD ExecuteDpcQueue()
// Set DpcRoutineActive to support KeIsExecutingDpc:
KeGetCurrentPrcb()->DpcRoutineActive = TRUE; // Experimental
DbgPrintf(LOG_PREFIX, "Global DpcQueue, calling DPC at 0x%.8X\n", pkdpc->DeferredRoutine);
__try {
// Call the Deferred Procedure :
pkdpc->DeferredRoutine(
pkdpc,
pkdpc->DeferredContext,
pkdpc->SystemArgument1,
pkdpc->SystemArgument2);
} __except (EmuException(GetExceptionInformation()))
{
EmuLog(LOG_PREFIX, LOG_LEVEL::WARNING, "Problem with ExceptionFilter!");
}
// Call the Deferred Procedure :
pkdpc->DeferredRoutine(
pkdpc,
pkdpc->DeferredContext,
pkdpc->SystemArgument1,
pkdpc->SystemArgument2);
KeGetCurrentPrcb()->DpcRoutineActive = FALSE; // Experimental
}
@ -206,16 +200,11 @@ DWORD ExecuteDpcQueue()
DbgPrintf(LOG_PREFIX, "Global TimerQueue, calling DPC at 0x%.8X\n", pkdpc->DeferredRoutine);
__try {
pkdpc->DeferredRoutine(
pkdpc,
pkdpc->DeferredContext,
pkdpc->SystemArgument1,
pkdpc->SystemArgument2);
} __except (EmuException(GetExceptionInformation()))
{
EmuLog(LOG_PREFIX, LOG_LEVEL::WARNING, "Problem with ExceptionFilter!");
}
pkdpc->DeferredRoutine(
pkdpc,
pkdpc->DeferredContext,
pkdpc->SystemArgument1,
pkdpc->SystemArgument2);
}
}

View File

@ -167,28 +167,21 @@ static unsigned int WINAPI PCSTProxy
}
// use the special calling convention
__try
// Given the non-standard calling convention (requiring
// the first argument in ebp+4) we need the below __asm.
//
// Otherwise, this call would have looked something like this :
// ((xboxkrnl::PKSYSTEM_ROUTINE)SystemRoutine)(
// (xboxkrnl::PKSTART_ROUTINE)StartRoutine,
// StartContext);
__asm
{
// Given the non-standard calling convention (requiring
// the first argument in ebp+4) we need the below __asm.
//
// Otherwise, this call would have looked something like this :
// ((xboxkrnl::PKSYSTEM_ROUTINE)SystemRoutine)(
// (xboxkrnl::PKSTART_ROUTINE)StartRoutine,
// StartContext);
__asm
{
mov esi, SystemRoutine
push StartContext
push StartRoutine
push offset callComplete
lea ebp, [esp - 4]
jmp near esi
}
}
__except (EmuException(GetExceptionInformation()))
{
EmuLog(LOG_PREFIX, LOG_LEVEL::WARNING, "Problem with ExceptionFilter!");
mov esi, SystemRoutine
push StartContext
push StartRoutine
push offset callComplete
lea ebp, [esp - 4]
jmp near esi
}
callComplete:
@ -207,16 +200,7 @@ void PspSystemThreadStartup
IN PVOID StartContext
)
{
__try
{
(StartRoutine)(StartContext);
}
__except (EmuException(GetExceptionInformation()))
// TODO : Call PspUnhandledExceptionInSystemThread(GetExceptionInformation())
{
EmuLog(LOG_PREFIX, LOG_LEVEL::WARNING, "Problem with ExceptionFilter!"); // TODO : Disable?
}
(StartRoutine)(StartContext);
xboxkrnl::PsTerminateSystemThread(STATUS_SUCCESS);
}

View File

@ -1424,15 +1424,8 @@ typedef struct {
void WINAPI EmuFiberStartup(fiber_context_t* context)
{
__try
{
LPFIBER_START_ROUTINE pfStartRoutine = (LPFIBER_START_ROUTINE)context->lpStartRoutine;
pfStartRoutine(context->lpParameter);
}
__except (EmuException(GetExceptionInformation()))
{
EmuLog(LOG_PREFIX, LOG_LEVEL::WARNING, "Problem with ExceptionFilter");
}
LPFIBER_START_ROUTINE pfStartRoutine = (LPFIBER_START_ROUTINE)context->lpStartRoutine;
pfStartRoutine(context->lpParameter);
}
// ******************************************************************