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