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 #ifndef _BRIDGES_CPP_UNO_X86_64_ABI_HXX_
25 #define _BRIDGES_CPP_UNO_X86_64_ABI_HXX_
26 
27 // This is an implementation of the x86-64 ABI as described in 'System V
28 // Application Binary Interface, AMD64 Architecture Processor Supplement'
29 // (http://www.x86-64.org/documentation/abi-0.95.pdf)
30 
31 #include <typelib/typedescription.hxx>
32 
33 namespace x86_64
34 {
35 
36 /* 6 general purpose registers are used for parameter passing */
37 const sal_uInt32 MAX_GPR_REGS = 6;
38 
39 /* 8 SSE registers are used for parameter passing */
40 const sal_uInt32 MAX_SSE_REGS = 8;
41 
42 /* Count number of required registers.
43 
44  Examine the argument and return set number of register required in each
45  class.
46 
47  Return false iff parameter should be passed in memory.
48 */
49 bool examine_argument( typelib_TypeDescriptionReference *pTypeRef, bool bInReturn, int &nUsedGPR, int &nUsedSSE );
50 
51 /** Does function that returns this type use a hidden parameter, or registers?
52 
53  The value can be returned either in a hidden 1st parameter (which is a
54  pointer to a structure allocated by the caller), or in registers (rax, rdx
55  for the integers, xmm0, xmm1 for the floating point numbers).
56 */
57 bool return_in_hidden_param( typelib_TypeDescriptionReference *pTypeRef );
58 
59 void fill_struct( typelib_TypeDescriptionReference *pTypeRef, const sal_uInt64* pGPR, const double* pSSE, void *pStruct );
60 
61 } // namespace x86_64
62 
63 #endif // _BRIDGES_CPP_UNO_X86_64_ABI_HXX_
64