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