diff options
Diffstat (limited to 'packaging/0030-Remove-exception-records-allocation-from-pal.h.patch')
-rw-r--r-- | packaging/0030-Remove-exception-records-allocation-from-pal.h.patch | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/packaging/0030-Remove-exception-records-allocation-from-pal.h.patch b/packaging/0030-Remove-exception-records-allocation-from-pal.h.patch new file mode 100644 index 0000000000..cf099e3a6e --- /dev/null +++ b/packaging/0030-Remove-exception-records-allocation-from-pal.h.patch @@ -0,0 +1,116 @@ +From 318d7a2dff13634670ef005c4af8115e5c780eb3 Mon Sep 17 00:00:00 2001 +From: Mikhail Labiuk <m.labiuk@samsung.com> +Date: Tue, 20 Feb 2018 16:59:27 +0300 +Subject: [PATCH 30/47] Remove exception records allocation from pal.h + +--- + src/pal/inc/pal.h | 24 ------------------------ + src/pal/src/exception/seh.cpp | 36 ++++++++++++++++++++++++++++++++++-- + 2 files changed, 34 insertions(+), 26 deletions(-) + +diff --git a/src/pal/inc/pal.h b/src/pal/inc/pal.h +index e241219..199ab94 100644 +--- a/src/pal/inc/pal.h ++++ b/src/pal/inc/pal.h +@@ -5794,11 +5794,6 @@ PAL_FreeExceptionRecords( + IN EXCEPTION_RECORD *exceptionRecord, + IN CONTEXT *contextRecord); + +-VOID +-AllocateExceptionRecords( +- EXCEPTION_RECORD** exceptionRecord, +- CONTEXT** contextRecord); +- + #define EXCEPTION_CONTINUE_SEARCH 0 + #define EXCEPTION_EXECUTE_HANDLER 1 + #define EXCEPTION_CONTINUE_EXECUTION -1 +@@ -5878,25 +5873,6 @@ public: + RecordsOnStack = false; + } + +- void EnsureExceptionRecordsOnHeap() +- { +- if( !RecordsOnStack || ExceptionPointers.ExceptionRecord == NULL) +- { +- return; +- } +- +- CONTEXT* contextRecordCopy; +- EXCEPTION_RECORD* exceptionRecordCopy; +- AllocateExceptionRecords(&exceptionRecordCopy, &contextRecordCopy); +- +- *exceptionRecordCopy = *ExceptionPointers.ExceptionRecord; +- ExceptionPointers.ExceptionRecord = exceptionRecordCopy; +- *contextRecordCopy = *ExceptionPointers.ContextRecord; +- ExceptionPointers.ContextRecord = contextRecordCopy; +- +- RecordsOnStack = false; +- } +- + CONTEXT* GetContextRecord() + { + return ExceptionPointers.ContextRecord; +diff --git a/src/pal/src/exception/seh.cpp b/src/pal/src/exception/seh.cpp +index 27766f2..8477fd6 100644 +--- a/src/pal/src/exception/seh.cpp ++++ b/src/pal/src/exception/seh.cpp +@@ -234,6 +234,38 @@ void ThrowExceptionHelper(PAL_SEHException* ex) + + /*++ + Function: ++ EnsureExceptionRecordsOnHeap ++ ++ Helper function to move records from stack to heap. ++ ++Parameters: ++ PAL_SEHException* exception ++--*/ ++static void EnsureExceptionRecordsOnHeap(PAL_SEHException* exception) ++{ ++ if( !exception->RecordsOnStack || ++ exception->ExceptionPointers.ExceptionRecord == NULL ) ++ { ++ return; ++ } ++ ++ CONTEXT* contextRecord = exception->ExceptionPointers.ContextRecord; ++ EXCEPTION_RECORD* exceptionRecord = exception->ExceptionPointers.ExceptionRecord; ++ ++ CONTEXT* contextRecordCopy; ++ EXCEPTION_RECORD* exceptionRecordCopy; ++ AllocateExceptionRecords(&exceptionRecordCopy, &contextRecordCopy); ++ ++ *exceptionRecordCopy = *exceptionRecord; ++ *contextRecordCopy = *contextRecord; ++ ++ exception->ExceptionPointers.ExceptionRecord = exceptionRecordCopy; ++ exception->ExceptionPointers.ContextRecord = contextRecordCopy; ++ exception->RecordsOnStack = false; ++} ++ ++/*++ ++Function: + SEHProcessException + + Send the PAL exception to any handler registered. +@@ -280,7 +312,7 @@ SEHProcessException(PAL_SEHException* exception) + } + } + +- exception->EnsureExceptionRecordsOnHeap(); ++ EnsureExceptionRecordsOnHeap(exception); + if (g_hardwareExceptionHandler(exception)) + { + // The exception happened in managed code and the execution should continue. +@@ -293,7 +325,7 @@ SEHProcessException(PAL_SEHException* exception) + + if (CatchHardwareExceptionHolder::IsEnabled()) + { +- exception->EnsureExceptionRecordsOnHeap(); ++ EnsureExceptionRecordsOnHeap(exception); + PAL_ThrowExceptionFromContext(exception->GetContextRecord(), exception); + } + } +-- +2.7.4 + |