summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/unwind-midipix.c36
-rw-r--r--gcc/unwind-midipix.h78
2 files changed, 114 insertions, 0 deletions
diff --git a/gcc/unwind-midipix.c b/gcc/unwind-midipix.c
new file mode 100644
index 000000000..61907e176
--- /dev/null
+++ b/gcc/unwind-midipix.c
@@ -0,0 +1,36 @@
+/*****************************************************************************/
+/* */
+/* midipix unwind functionality */
+/* */
+/* Copyright (C) 2019 Z. Gilboa */
+/* */
+/* This program is free software: you can redistribute it and/or modify */
+/* it under the terms of the GNU General Public License as published by */
+/* the Free Software Foundation, either version 3 of the License, or */
+/* (at your option) any later version. */
+/* */
+/* This program is distributed in the hope that it will be useful, */
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
+/* GNU General Public License for more details. */
+/* */
+/* You should have received a copy of the GNU General Public License */
+/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
+/* */
+/*****************************************************************************/
+
+#define TARGET_PERSONALITY_FUNCTION
+
+#include "unwind-midipix.h"
+#include "unwind-c.c"
+
+int __gcc_personality_seh0(
+ struct _nt_exception_record * erec,
+ void * this_frame,
+ mcontext_t * tctx,
+ struct _nt_dispatcher_context * dctx)
+{
+ return __unwind_exception_filter(
+ erec,this_frame,tctx,dctx,
+ __gcc_personality_imp);
+}
diff --git a/gcc/unwind-midipix.h b/gcc/unwind-midipix.h
new file mode 100644
index 000000000..e27ab617a
--- /dev/null
+++ b/gcc/unwind-midipix.h
@@ -0,0 +1,78 @@
+#ifndef _UNWIND_H
+#define _UNWIND_H
+
+#include <stdint.h>
+#include <sys/unwind.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef long _sleb128_t;
+typedef unsigned long _uleb128_t;
+
+typedef uintptr_t _Unwind_Word;
+typedef intptr_t _Unwind_Sword;
+
+typedef uintptr_t _Unwind_Ptr;
+typedef uintptr_t _Unwind_Internal_Ptr;
+typedef uintptr_t _Unwind_Exception_Class;
+
+typedef int _Unwind_Action;
+typedef enum __unwind_reason_code _Unwind_Reason_Code;
+
+typedef __unwind_personality_routine _Unwind_Personality_Fn;
+typedef __unwind_exception_cleanup_routine _Unwind_Exception_Cleanup_Fn;
+
+
+#define _Unwind_Exception __unwind_exception
+#define _Unwind_Context __unwind_context
+
+#define _URC_NO_REASON __URC_NO_REASON
+#define _URC_FOREIGN_EXCEPTION_CAUGHT __URC_FOREIGN_EXCEPTION
+#define _URC_FATAL_PHASE2_ERROR __URC_FATAL_PHASE2
+#define _URC_FATAL_PHASE1_ERROR __URC_FATAL_PHASE1
+#define _URC_NORMAL_STOP __URC_NORMAL_STOP
+#define _URC_END_OF_STACK __URC_END_OF_STACK
+#define _URC_HANDLER_FOUND __URC_HANDLER_FOUND
+#define _URC_INSTALL_CONTEXT __URC_INSTALL_CONTEXT
+#define _URC_CONTINUE_UNWIND __URC_CONTINUE_UNWIND
+
+#define _UA_SEARCH_PHASE __UA_SEARCH_PHASE
+#define _UA_CLEANUP_PHASE __UA_CLEANUP_PHASE
+#define _UA_HANDLER_FRAME __UA_HANDLER_FRAME
+#define _UA_FORCE_UNWIND __UA_FORCE_UNWIND
+#define _UA_END_OF_STACK __UA_END_OF_STACK
+
+#define _Unwind_RaiseException __unwind_raise_exception
+#define _Unwind_DeleteException __unwind_delete_exception
+
+#define _Unwind_Resume __unwind_resume
+#define _Unwind_Resume_or_Rethrow __unwind_resume_or_rethrow
+
+#define _Unwind_ForcedUnwind __unwind_force
+#define _Unwind_GetLanguageSpecificData __unwind_get_language_specific_data
+
+#define _Unwind_Backtrace __unwind_backtrace
+#define _Unwind_Calltrace __unwind_calltrace
+
+#define _Unwind_GetIP __unwind_get_ip
+#define _Unwind_SetIP __unwind_set_ip
+
+#define _Unwind_GetGR __unwind_get_gr
+#define _Unwind_SetGR __unwind_set_gr
+
+#define _Unwind_GetDataRelBase __unwind_get_data_rel_base
+#define _Unwind_GetTextRelBase __unwind_get_text_rel_base
+
+#define _Unwind_GetCFA __unwind_get_cfa
+#define _Unwind_GetIPInfo __unwind_get_ip_info
+
+#define _Unwind_GetRegionStart __unwind_get_region_start
+#define _Unwind_FindEnclosingFunction __unwind_find_enclosing_function
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif