xref: /AOO42X/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/abi.hxx (revision 9bce9b0d387299c68bd81d539e1478357a103de5)
1*809f4227SJim Jagielski /**************************************************************
2*809f4227SJim Jagielski  *
3*809f4227SJim Jagielski  * Licensed to the Apache Software Foundation (ASF) under one
4*809f4227SJim Jagielski  * or more contributor license agreements.  See the NOTICE file
5*809f4227SJim Jagielski  * distributed with this work for additional information
6*809f4227SJim Jagielski  * regarding copyright ownership.  The ASF licenses this file
7*809f4227SJim Jagielski  * to you under the Apache License, Version 2.0 (the
8*809f4227SJim Jagielski  * "License"); you may not use this file except in compliance
9*809f4227SJim Jagielski  * with the License.  You may obtain a copy of the License at
10*809f4227SJim Jagielski  *
11*809f4227SJim Jagielski  *   http://www.apache.org/licenses/LICENSE-2.0
12*809f4227SJim Jagielski  *
13*809f4227SJim Jagielski  * Unless required by applicable law or agreed to in writing,
14*809f4227SJim Jagielski  * software distributed under the License is distributed on an
15*809f4227SJim Jagielski  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*809f4227SJim Jagielski  * KIND, either express or implied.  See the License for the
17*809f4227SJim Jagielski  * specific language governing permissions and limitations
18*809f4227SJim Jagielski  * under the License.
19*809f4227SJim Jagielski  *
20*809f4227SJim Jagielski  *************************************************************/
21*809f4227SJim Jagielski 
22*809f4227SJim Jagielski 
23*809f4227SJim Jagielski 
24*809f4227SJim Jagielski #ifndef _BRIDGES_CPP_UNO_X86_64_ABI_HXX_
25*809f4227SJim Jagielski #define _BRIDGES_CPP_UNO_X86_64_ABI_HXX_
26*809f4227SJim Jagielski 
27*809f4227SJim Jagielski // This is an implementation of the x86-64 ABI as described in 'System V
28*809f4227SJim Jagielski // Application Binary Interface, AMD64 Architecture Processor Supplement'
29*809f4227SJim Jagielski // (http://www.x86-64.org/documentation/abi-0.95.pdf)
30*809f4227SJim Jagielski 
31*809f4227SJim Jagielski #include <typelib/typedescription.hxx>
32*809f4227SJim Jagielski 
33*809f4227SJim Jagielski namespace x86_64
34*809f4227SJim Jagielski {
35*809f4227SJim Jagielski 
36*809f4227SJim Jagielski /* 6 general purpose registers are used for parameter passing */
37*809f4227SJim Jagielski const sal_uInt32 MAX_GPR_REGS = 6;
38*809f4227SJim Jagielski 
39*809f4227SJim Jagielski /* 8 SSE registers are used for parameter passing */
40*809f4227SJim Jagielski const sal_uInt32 MAX_SSE_REGS = 8;
41*809f4227SJim Jagielski 
42*809f4227SJim Jagielski /* Count number of required registers.
43*809f4227SJim Jagielski 
44*809f4227SJim Jagielski  Examine the argument and return set number of register required in each
45*809f4227SJim Jagielski  class.
46*809f4227SJim Jagielski 
47*809f4227SJim Jagielski  Return false iff parameter should be passed in memory.
48*809f4227SJim Jagielski */
49*809f4227SJim Jagielski bool examine_argument( typelib_TypeDescriptionReference *pTypeRef, bool bInReturn, int &nUsedGPR, int &nUsedSSE );
50*809f4227SJim Jagielski 
51*809f4227SJim Jagielski /** Does function that returns this type use a hidden parameter, or registers?
52*809f4227SJim Jagielski 
53*809f4227SJim Jagielski  The value can be returned either in a hidden 1st parameter (which is a
54*809f4227SJim Jagielski  pointer to a structure allocated by the caller), or in registers (rax, rdx
55*809f4227SJim Jagielski  for the integers, xmm0, xmm1 for the floating point numbers).
56*809f4227SJim Jagielski */
57*809f4227SJim Jagielski bool return_in_hidden_param( typelib_TypeDescriptionReference *pTypeRef );
58*809f4227SJim Jagielski 
59*809f4227SJim Jagielski void fill_struct( typelib_TypeDescriptionReference *pTypeRef, const sal_uInt64* pGPR, const double* pSSE, void *pStruct );
60*809f4227SJim Jagielski 
61*809f4227SJim Jagielski } // namespace x86_64
62*809f4227SJim Jagielski 
63*809f4227SJim Jagielski #endif // _BRIDGES_CPP_UNO_X86_64_ABI_HXX_
64