Work around a `ClrRestoreNonvolatileContext` issue for a case (#52342)
authorKoundinya Veluri <kouvel@users.noreply.github.com>
Thu, 6 May 2021 08:16:28 +0000 (01:16 -0700)
committerGitHub <noreply@github.com>
Thu, 6 May 2021 08:16:28 +0000 (01:16 -0700)
Work around a `ClrRestoreNonvolatileContext` issue for a case

src/coreclr/vm/exceptionhandling.cpp

index 03e87dd..11d0072 100644 (file)
@@ -1189,6 +1189,12 @@ ProcessCLRException(IN     PEXCEPTION_RECORD   pExceptionRecord
             RestoreSOToleranceState();
 #endif
 
+#ifdef TARGET_AMD64
+            // OSes older than Win8 have a bug where RtlUnwindEx passes meaningless ContextFlags to the personality routine in
+            // some cases.
+            pContextRecord->ContextFlags |= CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT;
+#endif
+
             ExceptionTracker::ResumeExecution(pContextRecord);
             UNREACHABLE();
         }