1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #include "uno/mapping.h"
29 
30 #include <typeinfo>
31 #include <exception>
32 #include <cstddef>
33 #include "bridges/cpp_uno/shared/vtablefactory.hxx"
34 
35 namespace CPPU_CURRENT_NAMESPACE
36 {
37 
38   void dummy_can_throw_anything( char const * );
39 
40 
41 // ----- following decl from libstdc++-v3/libsupc++/unwind-cxx.h and unwind.h
42 
43 struct _Unwind_Exception
44 {
45     unsigned exception_class __attribute__((__mode__(__DI__)));
46     void * exception_cleanup;
47     unsigned private_1 __attribute__((__mode__(__word__)));
48     unsigned private_2 __attribute__((__mode__(__word__)));
49 } __attribute__((__aligned__));
50 
51 struct __cxa_exception
52 {
53     ::std::type_info *exceptionType;
54     void (*exceptionDestructor)(void *);
55 
56     ::std::unexpected_handler unexpectedHandler;
57     ::std::terminate_handler terminateHandler;
58 
59     __cxa_exception *nextException;
60 
61     int handlerCount;
62 
63     int handlerSwitchValue;
64     const unsigned char *actionRecord;
65     const unsigned char *languageSpecificData;
66     void *catchTemp;
67     void *adjustedPtr;
68 
69     _Unwind_Exception unwindHeader;
70 };
71 
72 extern "C" void *__cxa_allocate_exception(
73     std::size_t thrown_size ) throw();
74 extern "C" void __cxa_throw (
75     void *thrown_exception, std::type_info *tinfo, void (*dest) (void *) ) __attribute__((noreturn));
76 
77 struct __cxa_eh_globals
78 {
79     __cxa_exception *caughtExceptions;
80     unsigned int uncaughtExceptions;
81 };
82 extern "C" __cxa_eh_globals *__cxa_get_globals () throw();
83 
84 // -----
85 
86 //==================================================================================================
87 void raiseException(
88     uno_Any * pUnoExc, uno_Mapping * pUno2Cpp );
89 //==================================================================================================
90 void fillUnoException(
91     __cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno );
92 }
93 
94 namespace ia64
95 {
96     enum ia64limits { MAX_GPR_REGS = 8, MAX_SSE_REGS = 8, MAX_REG_SLOTS = 8 };
97 
98     bool return_in_hidden_param( typelib_TypeDescriptionReference *pTypeRef );
99     bool return_via_r8_buffer( typelib_TypeDescriptionReference *pTypeRef );
100 
101     struct RegReturn
102     {
103         long r8;
104         long r9;
105         long r10;
106         long r11;
107     };
108 }
109 
110 namespace bridges
111 {
112     namespace cpp_uno
113     {
114         namespace shared
115         {
116             /*
117                 http://www.swag.uwaterloo.ca/asx/ABI.html
118                 On Itanium, function pointers are pairs: the function address followed
119                 by the global pointer value that should be used when calling the
120                 function (code address, gp value)
121             */
122             struct VtableFactory::Slot
123             {
124                 sal_uInt64 code_address;
125                 sal_uInt64 gp_value;
126             };
127         }
128     }
129 }
130 /* vi:set tabstop=4 shiftwidth=4 expandtab: */
131