source: mainline/uspace/lib/cpp/src/internal/unwind.cpp@ ef9d0988

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since ef9d0988 was ef9d0988, checked in by Dzejrou <dzejrou@…>, 7 years ago

cpp: added stubs for dynamic_cast and level 1 unwinding

  • Property mode set to 100644
File size: 3.7 KB
Line 
1/*
2 * Copyright (c) 2017 Jaroslav Jindrak
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29namespace __cxxabiv1
30{
31 /**
32 * Stack unwinding functionality - Level 1.
33 */
34
35 enum _Unwind_Reason_Code
36 {
37 _URC_NO_REASON = 0,
38 _URC_FOREIGN_EXCEPTION_CAUGHT = 1,
39 _URC_FATAL_PHASE2_ERROR = 2,
40 _URC_FATAL_PHASE1_ERROR = 3,
41 _URC_NORMAL_STOP = 4,
42 _URC_END_OF_STACK = 5,
43 _URC_HANDLER_FOUND = 6,
44 _URC_INSTALL_CONTEXT = 7,
45 _URC_CONTINUE_UNWIND = 8
46 };
47
48 struct _Unwind_Exception;
49 using _Unwind_Exception_Cleanup_Fn = void (*)(_Unwind_Reason_Code, _Unwind_Exception*);
50
51 struct _Unwind_Exception
52 {
53 std::uint64_t exception_class;
54 _Unwind_Exception_Cleanup_Fn exception_cleanup;
55 std::uint64_t private_1;
56 std::uint64_t private_2;
57 };
58
59 /* Opaque structure. */
60 struct _Unwind_Context;
61
62 /**
63 * TODO: Explain parameter semantics.
64 */
65 using _Unwind_Stop_Fn = _Unwind_Reason_Code(*)(
66 int, _Unwind_Action, std::uint64_t, _Unwind_Exception*,
67 _Unwind_Context*, void*
68 );
69
70 _Unwind_Reason_Code _Unwind_ForcedUnwind(_Unwind_Exception*, _Unwind_Stop_Fn, void*)
71 {
72 // TODO: implement
73 }
74
75 void _Unwind_Resume(_Unwind_Exception*)
76 {
77 // TODO: implement
78 }
79
80 void _Unwind_DeleteException(_Unwind_Exception*)
81 {
82 // TODO: implement
83 }
84
85 std::uint64_t _Unwind_GetGR(_Unwind_Context*, int)
86 {
87 // TODO: implement
88 }
89
90 void _Unwind_SetGR(_Unwind_Context*, int, std::uint64_t)
91 {
92 // TODO: implement
93 }
94
95 std::uint64_t _Unwind_GetIP(_Unwind_Context*)
96 {
97 // TODO: implement
98 }
99
100 void _Unwind_SetIP(_Unwind_Context*, std::uint64_t)
101 {
102 // TODO: implement
103 }
104
105 std::uint64_t _Unwind_GetLanguageSpecificData(_Unwind_Context*)
106 {
107 // TODO: implement
108 }
109
110 std::uint64_t _Unwind_GetRegionStart(_Unwind_Context*)
111 {
112 // TODO: implement
113 }
114
115 /**
116 * TODO: Explain parameter semantics.
117 */
118 using __personality_routine = _Unwind_Reason_Code(*)(
119 int, _Unwind_Action, std::uint64_t, _Unwind_Exception*,
120 _Unwind_Context*, void*
121 );
122
123 /**
124 * Stack unwinding functionality - Level 2.
125 */
126 // TODO:
127}
Note: See TracBrowser for help on using the repository browser.