diff options
author | Jan Vorlicek <janvorli@microsoft.com> | 2016-06-22 21:00:20 +0300 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2016-06-22 21:00:20 +0300 |
commit | d8ba6a0def20c2ef44dbfa8a0f53eb0513043001 (patch) | |
tree | c9f66e680b0311765c4ff71db91511079d05416c /src/Native/Runtime/startup.cpp | |
parent | 0603b782dc0ab509b4f8c7fa3da1e8923fc24958 (diff) |
Implement Linux hardware and software exception handling (#1417)
This change implements code manager for Linux, context manipulation
and compiler changes necessary to enable exception handling.
All calls to libunwind are disabled for now on non-OSX though, since
our build system doesn't support specifying additional dynamic
libraries, which prevents us from using the libunwind.
Those pieces of code are under CAN_LINK_SHARED_LIBUNWIND ifdef so
that the ifdef can easily be located and removed after we add
the necessary support to the build system.
On OSX, the unwind functionality is part of the compiler support
libraries, so it works.
I have verified that everything works with the libunwind though
by manually invoking clang to link everything together and adding
the necessary libraries to its command line. The exception handling
test was passing with that.
Diffstat (limited to 'src/Native/Runtime/startup.cpp')
-rw-r--r-- | src/Native/Runtime/startup.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Native/Runtime/startup.cpp b/src/Native/Runtime/startup.cpp index 7e4505eb5..85b2bee1f 100644 --- a/src/Native/Runtime/startup.cpp +++ b/src/Native/Runtime/startup.cpp @@ -36,7 +36,12 @@ unsigned __int64 g_startupTimelineEvents[NUM_STARTUP_TIMELINE_EVENTS] = { 0 }; HANDLE RtuCreateRuntimeInstance(HANDLE hPalInstance); +#ifdef PLATFORM_UNIX +Int32 __stdcall RhpHardwareExceptionHandler(UIntNative faultCode, UIntNative faultAddress, PAL_LIMITED_CONTEXT* palContext, UIntNative* arg0Reg, UIntNative* arg1Reg); +#else Int32 __stdcall RhpVectoredExceptionHandler(PEXCEPTION_POINTERS pExPtrs); +#endif + void CheckForPalFallback(); void DetectCPUFeatures(); @@ -65,7 +70,11 @@ bool InitDLL(HANDLE hPalInstance) return false; #ifndef APP_LOCAL_RUNTIME +#ifndef PLATFORM_UNIX PalAddVectoredExceptionHandler(1, RhpVectoredExceptionHandler); +#else + PalSetHardwareExceptionHandler(RhpHardwareExceptionHandler); +#endif #endif // |