1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #include "uno/mapping.h"
25 
26 #include <typeinfo>
27 #include <exception>
28 #include <cstddef>
29 #include "bridges/cpp_uno/shared/vtablefactory.hxx"
30 
31 namespace CPPU_CURRENT_NAMESPACE
32 {
33 
34   void dummy_can_throw_anything( char const * );
35 
36 
37 // ----- following decl from libstdc++-v3/libsupc++/unwind-cxx.h and unwind.h
38 
39 struct _Unwind_Exception
40 {
41     unsigned exception_class __attribute__((__mode__(__DI__)));
42     void * exception_cleanup;
43     unsigned private_1 __attribute__((__mode__(__word__)));
44     unsigned private_2 __attribute__((__mode__(__word__)));
45 } __attribute__((__aligned__));
46 
47 struct __cxa_exception
48 {
49     ::std::type_info *exceptionType;
50     void (*exceptionDestructor)(void *);
51 
52     ::std::unexpected_handler unexpectedHandler;
53     ::std::terminate_handler terminateHandler;
54 
55     __cxa_exception *nextException;
56 
57     int handlerCount;
58 
59     int handlerSwitchValue;
60     const unsigned char *actionRecord;
61     const unsigned char *languageSpecificData;
62     void *catchTemp;
63     void *adjustedPtr;
64 
65     _Unwind_Exception unwindHeader;
66 };
67 
68 extern "C" void *__cxa_allocate_exception(
69     std::size_t thrown_size ) throw();
70 extern "C" void __cxa_throw (
71     void *thrown_exception, std::type_info *tinfo, void (*dest) (void *) ) __attribute__((noreturn));
72 
73 struct __cxa_eh_globals
74 {
75     __cxa_exception *caughtExceptions;
76     unsigned int uncaughtExceptions;
77 };
78 extern "C" __cxa_eh_globals *__cxa_get_globals () throw();
79 
80 // -----
81 
82 //==================================================================================================
83 void raiseException(
84     uno_Any * pUnoExc, uno_Mapping * pUno2Cpp );
85 //==================================================================================================
86 void fillUnoException(
87     __cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno );
88 }
89 
90 namespace ia64
91 {
92     enum ia64limits { MAX_GPR_REGS = 8, MAX_SSE_REGS = 8, MAX_REG_SLOTS = 8 };
93 
94     bool return_in_hidden_param( typelib_TypeDescriptionReference *pTypeRef );
95     bool return_via_r8_buffer( typelib_TypeDescriptionReference *pTypeRef );
96 
97     struct RegReturn
98     {
99         long r8;
100         long r9;
101         long r10;
102         long r11;
103     };
104 }
105 
106 namespace bridges
107 {
108     namespace cpp_uno
109     {
110         namespace shared
111         {
112             /*
113                 http://www.swag.uwaterloo.ca/asx/ABI.html
114                 On Itanium, function pointers are pairs: the function address followed
115                 by the global pointer value that should be used when calling the
116                 function (code address, gp value)
117             */
118             struct VtableFactory::Slot
119             {
120                 sal_uInt64 code_address;
121                 sal_uInt64 gp_value;
122             };
123         }
124     }
125 }
126 /* vi:set tabstop=4 shiftwidth=4 expandtab: */
127