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