diff options
author | José Fonseca <jfonseca@vmware.com> | 2014-09-14 20:24:06 +0100 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2014-09-15 19:57:29 +0100 |
commit | 00a7bba24f967d40e6128d00c0f9ca4ff750a131 (patch) | |
tree | c7b244f3ebc1b0a6b0dc178bc4c23f98fe001d2b | |
parent | 3b591e0b0cefeab1e3d4a6dc6e4cd69536fa339d (diff) |
os: Move CLD instruction to top.
-rw-r--r-- | common/os_win32.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/common/os_win32.cpp b/common/os_win32.cpp index 43f49dd1..e1d114d4 100644 --- a/common/os_win32.cpp +++ b/common/os_win32.cpp @@ -256,6 +256,21 @@ static void (*gCallback)(void) = NULL; static LONG CALLBACK unhandledExceptionHandler(PEXCEPTION_POINTERS pExceptionInfo) { + /* + * Before Vista KiUserExceptionDispatcher does not clear the direction + * flag. + * + * See also: + * - http://code.google.com/p/nativeclient/issues/detail?id=1495 + */ +#ifdef _MSC_VER +#ifndef _WIN64 + __asm cld; +#endif +#else + asm("cld"); +#endif + PEXCEPTION_RECORD pExceptionRecord = pExceptionInfo->ExceptionRecord; /* @@ -299,17 +314,6 @@ unhandledExceptionHandler(PEXCEPTION_POINTERS pExceptionInfo) return EXCEPTION_CONTINUE_SEARCH; } - // Clear direction flag -#ifdef _MSC_VER -#ifndef _WIN64 - __asm { - cld - }; -#endif -#else - asm("cld"); -#endif - log("apitrace: warning: caught exception 0x%08lx\n", pExceptionRecord->ExceptionCode); static int recursion_count = 0; |