summaryrefslogtreecommitdiff
path: root/src/vm
diff options
context:
space:
mode:
Diffstat (limited to 'src/vm')
-rw-r--r--src/vm/exceptmacros.h6
-rw-r--r--src/vm/i386/excepcpu.h31
-rw-r--r--src/vm/i386/excepx86.cpp29
3 files changed, 59 insertions, 7 deletions
diff --git a/src/vm/exceptmacros.h b/src/vm/exceptmacros.h
index 9b6c5549f7..2af064c96d 100644
--- a/src/vm/exceptmacros.h
+++ b/src/vm/exceptmacros.h
@@ -296,7 +296,7 @@ VOID DECLSPEC_NORETURN RaiseTheExceptionInternalOnly(OBJECTREF throwable, BOOL r
void UnwindAndContinueRethrowHelperInsideCatch(Frame* pEntryFrame, Exception* pException);
VOID DECLSPEC_NORETURN UnwindAndContinueRethrowHelperAfterCatch(Frame* pEntryFrame, Exception* pException);
-#if defined(FEATURE_PAL) && defined(WIN64EXCEPTIONS)
+#ifdef FEATURE_PAL
VOID DECLSPEC_NORETURN DispatchManagedException(PAL_SEHException& ex, bool isHardwareException);
#define INSTALL_MANAGED_EXCEPTION_DISPATCHER \
@@ -334,14 +334,14 @@ VOID DECLSPEC_NORETURN DispatchManagedException(PAL_SEHException& ex, bool isHar
UNREACHABLE(); \
}
-#else // FEATURE_PAL && WIN64EXCEPTIONS
+#else // FEATURE_PAL
#define INSTALL_MANAGED_EXCEPTION_DISPATCHER
#define UNINSTALL_MANAGED_EXCEPTION_DISPATCHER
#define INSTALL_UNHANDLED_MANAGED_EXCEPTION_TRAP
#define UNINSTALL_UNHANDLED_MANAGED_EXCEPTION_TRAP
-#endif // FEATURE_PAL && WIN64EXCEPTIONS
+#endif // FEATURE_PAL
#define INSTALL_UNWIND_AND_CONTINUE_HANDLER_NO_PROBE \
{ \
diff --git a/src/vm/i386/excepcpu.h b/src/vm/i386/excepcpu.h
index 3f2f0810a7..ff540e784b 100644
--- a/src/vm/i386/excepcpu.h
+++ b/src/vm/i386/excepcpu.h
@@ -28,12 +28,37 @@ class Thread;
// Actually, the handler getting set is properly registered
#endif
+#ifdef FEATURE_PAL
+
+extern VOID SetSEHRecord(PEXCEPTION_REGISTRATION_RECORD record);
+extern VOID ResetSEHRecord(PEXCEPTION_REGISTRATION_RECORD record);
+
+#define INSTALL_SEH_RECORD(record) \
+ SetSEHRecord(record); \
+
+#define UNINSTALL_SEH_RECORD(record) \
+ ResetSEHRecord(record);
+
+#else // FEATURE_PAL
+
+#define INSTALL_SEH_RECORD(record) \
+ { \
+ (record)->Next = (PEXCEPTION_REGISTRATION_RECORD)__readfsdword(0); \
+ __writefsdword(0, (DWORD) (record)); \
+ }
+
+#define UNINSTALL_SEH_RECORD(record) \
+ { \
+ __writefsdword(0, (DWORD) ((record)->Next)); \
+ }
+
+#endif // FEATURE_PAL
+
#define INSTALL_EXCEPTION_HANDLING_RECORD(record) \
{ \
PEXCEPTION_REGISTRATION_RECORD __record = (record); \
_ASSERTE(__record < GetCurrentSEHRecord()); \
- __record->Next = (PEXCEPTION_REGISTRATION_RECORD)__readfsdword(0); \
- __writefsdword(0, (DWORD)__record); \
+ INSTALL_SEH_RECORD(record); \
}
//
@@ -44,7 +69,7 @@ class Thread;
{ \
PEXCEPTION_REGISTRATION_RECORD __record = (record); \
_ASSERTE(__record == GetCurrentSEHRecord()); \
- __writefsdword(0, (DWORD)__record->Next); \
+ UNINSTALL_SEH_RECORD(record); \
}
// stackOverwriteBarrier is used to detect overwriting of stack which will mess up handler registration
diff --git a/src/vm/i386/excepx86.cpp b/src/vm/i386/excepx86.cpp
index 025098c3ad..71200f671f 100644
--- a/src/vm/i386/excepx86.cpp
+++ b/src/vm/i386/excepx86.cpp
@@ -1971,11 +1971,17 @@ PTR_CONTEXT GetCONTEXTFromRedirectedStubStackFrame(CONTEXT * pContext)
}
#if !defined(DACCESS_COMPILE)
+#ifdef FEATURE_PAL
+static PEXCEPTION_REGISTRATION_RECORD CurrentSEHRecord = EXCEPTION_CHAIN_END;
+#endif
PEXCEPTION_REGISTRATION_RECORD GetCurrentSEHRecord()
{
WRAPPER_NO_CONTRACT;
+#ifdef FEATURE_PAL
+ LPVOID fs0 = CurrentSEHRecord;
+#else // FEATURE_PAL
LPVOID fs0 = (LPVOID)__readfsdword(0);
#if 0 // This walk is too expensive considering we hit it every time we a CONTRACT(NOTHROW)
@@ -2006,11 +2012,26 @@ PEXCEPTION_REGISTRATION_RECORD GetCurrentSEHRecord()
pEHR = pEHR->Next;
}
#endif
-#endif
+#endif // 0
+#endif // FEATURE_PAL
return (EXCEPTION_REGISTRATION_RECORD*) fs0;
}
+#ifdef FEATURE_PAL
+VOID SetSEHRecord(PEXCEPTION_REGISTRATION_RECORD record)
+{
+ WRAPPER_NO_CONTRACT;
+ record->Next = CurrentSEHRecord;
+ CurrentSEHRecord = record;
+}
+
+VOID ResetSEHRecord(PEXCEPTION_REGISTRATION_RECORD record)
+{
+ CurrentSEHRecord = record->Next;
+}
+#endif // FEATURE_PAL
+
PEXCEPTION_REGISTRATION_RECORD GetFirstCOMPlusSEHRecord(Thread *pThread) {
WRAPPER_NO_CONTRACT;
#ifndef FEATURE_PAL
@@ -3748,4 +3769,10 @@ AdjustContextForVirtualStub(
return TRUE;
}
+#ifdef FEATURE_PAL
+VOID DECLSPEC_NORETURN DispatchManagedException(PAL_SEHException& ex, bool isHardwareException)
+{
+ UNREACHABLE();
+}
+#endif
#endif // !DACCESS_COMPILE