diff options
Diffstat (limited to 'src/Runtime.Base')
-rw-r--r-- | src/Runtime.Base/src/System/Runtime/ExceptionHandling.cs | 19 | ||||
-rw-r--r-- | src/Runtime.Base/src/System/Runtime/ExceptionIDs.cs | 1 | ||||
-rw-r--r-- | src/Runtime.Base/src/System/Runtime/InternalCalls.cs | 4 |
3 files changed, 22 insertions, 2 deletions
diff --git a/src/Runtime.Base/src/System/Runtime/ExceptionHandling.cs b/src/Runtime.Base/src/System/Runtime/ExceptionHandling.cs index 78bf58608..5b02c8ef7 100644 --- a/src/Runtime.Base/src/System/Runtime/ExceptionHandling.cs +++ b/src/Runtime.Base/src/System/Runtime/ExceptionHandling.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; +using System.Runtime; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -400,7 +401,7 @@ namespace System.Runtime case ExceptionIDs.InvalidCast: return new InvalidCastException(); - + default: Debug.Assert(false, "unexpected ExceptionID"); FallbackFailFast(RhFailFastReason.InternalError, null); @@ -413,6 +414,7 @@ namespace System.Runtime { STATUS_REDHAWK_NULL_REFERENCE = 0x00000000u, STATUS_REDHAWK_WRITE_BARRIER_NULL_REFERENCE = 0x00000042u, + STATUS_REDHAWK_THREAD_ABORT = 0x00000043u, STATUS_DATATYPE_MISALIGNMENT = 0x80000002u, STATUS_ACCESS_VIOLATION = 0xC0000005u, @@ -542,6 +544,10 @@ namespace System.Runtime exceptionId = ExceptionIDs.NullReference; break; + case (uint)HwExceptionCode.STATUS_REDHAWK_THREAD_ABORT: + exceptionId = ExceptionIDs.ThreadAbort; + break; + case (uint)HwExceptionCode.STATUS_DATATYPE_MISALIGNMENT: exceptionId = ExceptionIDs.DataMisaligned; break; @@ -569,7 +575,16 @@ namespace System.Runtime break; } - Exception exceptionToThrow = GetClasslibException(exceptionId, faultingCodeAddress); + Exception exceptionToThrow; + + if (exceptionId == ExceptionIDs.ThreadAbort) + { + exceptionToThrow = InternalCalls.RhpGetThreadAbortException(); + } + else + { + exceptionToThrow = GetClasslibException(exceptionId, faultingCodeAddress); + } exInfo.Init(exceptionToThrow, instructionFault); DispatchEx(ref exInfo._frameIter, ref exInfo, MaxTryRegionIdx); diff --git a/src/Runtime.Base/src/System/Runtime/ExceptionIDs.cs b/src/Runtime.Base/src/System/Runtime/ExceptionIDs.cs index 52d5830c7..dc0b16a72 100644 --- a/src/Runtime.Base/src/System/Runtime/ExceptionIDs.cs +++ b/src/Runtime.Base/src/System/Runtime/ExceptionIDs.cs @@ -16,5 +16,6 @@ namespace System.Runtime NullReference = 8, AccessViolation = 9, DataMisaligned = 10, + ThreadAbort = 11, } } diff --git a/src/Runtime.Base/src/System/Runtime/InternalCalls.cs b/src/Runtime.Base/src/System/Runtime/InternalCalls.cs index 3fb169472..0aee9900a 100644 --- a/src/Runtime.Base/src/System/Runtime/InternalCalls.cs +++ b/src/Runtime.Base/src/System/Runtime/InternalCalls.cs @@ -397,6 +397,10 @@ namespace System.Runtime [ManuallyManaged(GcPollPolicy.Never)] internal extern static int RhpGetThunkBlockSize(); + [RuntimeImport(Redhawk.BaseName, "RhpGetThreadAbortException")] + [MethodImpl(MethodImplOptions.InternalCall)] + internal extern static Exception RhpGetThreadAbortException(); + //------------------------------------------------------------------------------------------------------------ // PInvoke-based internal calls // |