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