this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Added libffi build Removed old libncurses wrapper

+9274 -267
+1
src/CMakeLists.txt
··· 72 72 add_subdirectory(duct/src) 73 73 add_subdirectory(libresolv) 74 74 add_subdirectory(libstdcxx) 75 + add_subdirectory(libffi) 75 76 add_subdirectory(external/libobjc2) 76 77 add_subdirectory(external/libkqueue) 77 78 add_subdirectory(external/libdispatch)
+38
src/libffi/CMakeLists.txt
··· 1 + project(libffi) 2 + 3 + cmake_minimum_required(VERSION 2.4.0) 4 + 5 + enable_language(C ASM) 6 + 7 + if(COMMAND cmake_policy) 8 + cmake_policy(SET CMP0003 NEW) 9 + endif(COMMAND cmake_policy) 10 + 11 + add_definitions(-D__APPLE__ -D__MACH__) 12 + add_definitions(-DTARGET_OS_MAC=1) 13 + add_definitions(-DHAVE_STDINT_H=1) 14 + add_definitions(-D__APPLE__ -D__DYNAMIC__) 15 + add_definitions(-D__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__=1080) 16 + 17 + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -nostdinc -D__DARWIN_UNIX03 -fPIC -w") 18 + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -nostdlib -Wl,--version-script=${DARLING_TOP_DIRECTORY}/darwin.map") 19 + 20 + SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib${SUFFIX}/darling") 21 + SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) 22 + SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) 23 + 24 + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 25 + 26 + set(ffi_SRCS 27 + ffi.c 28 + types.c 29 + x86/darwin64.S 30 + x86/x86-darwin.S 31 + x86/x86-ffi64.c 32 + x86/x86-ffi_darwin.c 33 + ) 34 + 35 + add_library(ffi SHARED ${ffi_SRCS}) 36 + target_link_libraries(ffi system) 37 + 38 + install(TARGETS ffi DESTINATION lib${SUFFIX}/darling)
+20
src/libffi/LICENSE
··· 1 + libffi - Copyright (c) 1996-2003 Red Hat, Inc. 2 + 3 + Permission is hereby granted, free of charge, to any person obtaining 4 + a copy of this software and associated documentation files (the 5 + ``Software''), to deal in the Software without restriction, including 6 + without limitation the rights to use, copy, modify, merge, publish, 7 + distribute, sublicense, and/or sell copies of the Software, and to 8 + permit persons to whom the Software is furnished to do so, subject to 9 + the following conditions: 10 + 11 + The above copyright notice and this permission notice shall be included 12 + in all copies or substantial portions of the Software. 13 + 14 + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 + IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 + OTHER DEALINGS IN THE SOFTWARE.
+500
src/libffi/README
··· 1 + This directory contains the libffi package, which is not part of GCC but 2 + shipped with GCC as convenience. 3 + 4 + Status 5 + ====== 6 + 7 + libffi-2.00 has not been released yet! This is a development snapshot! 8 + 9 + libffi-1.20 was released on October 5, 1998. Check the libffi web 10 + page for updates: <URL:http://sources.redhat.com/libffi/>. 11 + 12 + 13 + What is libffi? 14 + =============== 15 + 16 + Compilers for high level languages generate code that follow certain 17 + conventions. These conventions are necessary, in part, for separate 18 + compilation to work. One such convention is the "calling 19 + convention". The "calling convention" is essentially a set of 20 + assumptions made by the compiler about where function arguments will 21 + be found on entry to a function. A "calling convention" also specifies 22 + where the return value for a function is found. 23 + 24 + Some programs may not know at the time of compilation what arguments 25 + are to be passed to a function. For instance, an interpreter may be 26 + told at run-time about the number and types of arguments used to call 27 + a given function. Libffi can be used in such programs to provide a 28 + bridge from the interpreter program to compiled code. 29 + 30 + The libffi library provides a portable, high level programming 31 + interface to various calling conventions. This allows a programmer to 32 + call any function specified by a call interface description at run 33 + time. 34 + 35 + Ffi stands for Foreign Function Interface. A foreign function 36 + interface is the popular name for the interface that allows code 37 + written in one language to call code written in another language. The 38 + libffi library really only provides the lowest, machine dependent 39 + layer of a fully featured foreign function interface. A layer must 40 + exist above libffi that handles type conversions for values passed 41 + between the two languages. 42 + 43 + 44 + Supported Platforms and Prerequisites 45 + ===================================== 46 + 47 + Libffi has been ported to: 48 + 49 + SunOS 4.1.3 & Solaris 2.x (SPARC-V8, SPARC-V9) 50 + 51 + Irix 5.3 & 6.2 (System V/o32 & n32) 52 + 53 + Intel x86 - Linux (System V ABI) 54 + 55 + Alpha - Linux and OSF/1 56 + 57 + m68k - Linux (System V ABI) 58 + 59 + PowerPC - Linux (System V ABI, Darwin, AIX) 60 + 61 + ARM - Linux (System V ABI) 62 + 63 + Libffi has been tested with the egcs 1.0.2 gcc compiler. Chances are 64 + that other versions will work. Libffi has also been built and tested 65 + with the SGI compiler tools. 66 + 67 + On PowerPC, the tests failed (see the note below). 68 + 69 + You must use GNU make to build libffi. SGI's make will not work. 70 + Sun's probably won't either. 71 + 72 + If you port libffi to another platform, please let me know! I assume 73 + that some will be easy (x86 NetBSD), and others will be more difficult 74 + (HP). 75 + 76 + 77 + Installing libffi 78 + ================= 79 + 80 + [Note: before actually performing any of these installation steps, 81 + you may wish to read the "Platform Specific Notes" below.] 82 + 83 + First you must configure the distribution for your particular 84 + system. Go to the directory you wish to build libffi in and run the 85 + "configure" program found in the root directory of the libffi source 86 + distribution. 87 + 88 + You may want to tell configure where to install the libffi library and 89 + header files. To do that, use the --prefix configure switch. Libffi 90 + will install under /usr/local by default. 91 + 92 + If you want to enable extra run-time debugging checks use the the 93 + --enable-debug configure switch. This is useful when your program dies 94 + mysteriously while using libffi. 95 + 96 + Another useful configure switch is --enable-purify-safety. Using this 97 + will add some extra code which will suppress certain warnings when you 98 + are using Purify with libffi. Only use this switch when using 99 + Purify, as it will slow down the library. 100 + 101 + Configure has many other options. Use "configure --help" to see them all. 102 + 103 + Once configure has finished, type "make". Note that you must be using 104 + GNU make. SGI's make will not work. Sun's probably won't either. 105 + You can ftp GNU make from prep.ai.mit.edu:/pub/gnu. 106 + 107 + To ensure that libffi is working as advertised, type "make test". 108 + 109 + To install the library and header files, type "make install". 110 + 111 + 112 + Using libffi 113 + ============ 114 + 115 + The Basics 116 + ---------- 117 + 118 + Libffi assumes that you have a pointer to the function you wish to 119 + call and that you know the number and types of arguments to pass it, 120 + as well as the return type of the function. 121 + 122 + The first thing you must do is create an ffi_cif object that matches 123 + the signature of the function you wish to call. The cif in ffi_cif 124 + stands for Call InterFace. To prepare a call interface object, use the 125 + following function: 126 + 127 + ffi_status ffi_prep_cif(ffi_cif *cif, ffi_abi abi, 128 + unsigned int nargs, 129 + ffi_type *rtype, ffi_type **atypes); 130 + 131 + CIF is a pointer to the call interface object you wish 132 + to initialize. 133 + 134 + ABI is an enum that specifies the calling convention 135 + to use for the call. FFI_DEFAULT_ABI defaults 136 + to the system's native calling convention. Other 137 + ABI's may be used with care. They are system 138 + specific. 139 + 140 + NARGS is the number of arguments this function accepts. 141 + libffi does not yet support vararg functions. 142 + 143 + RTYPE is a pointer to an ffi_type structure that represents 144 + the return type of the function. Ffi_type objects 145 + describe the types of values. libffi provides 146 + ffi_type objects for many of the native C types: 147 + signed int, unsigned int, signed char, unsigned char, 148 + etc. There is also a pointer ffi_type object and 149 + a void ffi_type. Use &ffi_type_void for functions that 150 + don't return values. 151 + 152 + ATYPES is a vector of ffi_type pointers. ARGS must be NARGS long. 153 + If NARGS is 0, this is ignored. 154 + 155 + 156 + ffi_prep_cif will return a status code that you are responsible 157 + for checking. It will be one of the following: 158 + 159 + FFI_OK - All is good. 160 + 161 + FFI_BAD_TYPEDEF - One of the ffi_type objects that ffi_prep_cif 162 + came across is bad. 163 + 164 + 165 + Before making the call, the VALUES vector should be initialized 166 + with pointers to the appropriate argument values. 167 + 168 + To call the the function using the initialized ffi_cif, use the 169 + ffi_call function: 170 + 171 + void ffi_call(ffi_cif *cif, void *fn, void *rvalue, void **avalues); 172 + 173 + CIF is a pointer to the ffi_cif initialized specifically 174 + for this function. 175 + 176 + FN is a pointer to the function you want to call. 177 + 178 + RVALUE is a pointer to a chunk of memory that is to hold the 179 + result of the function call. Currently, it must be 180 + at least one word in size (except for the n32 version 181 + under Irix 6.x, which must be a pointer to an 8 byte 182 + aligned value (a long long). It must also be at least 183 + word aligned (depending on the return type, and the 184 + system's alignment requirements). If RTYPE is 185 + &ffi_type_void, this is ignored. If RVALUE is NULL, 186 + the return value is discarded. 187 + 188 + AVALUES is a vector of void* that point to the memory locations 189 + holding the argument values for a call. 190 + If NARGS is 0, this is ignored. 191 + 192 + 193 + If you are expecting a return value from FN it will have been stored 194 + at RVALUE. 195 + 196 + 197 + 198 + An Example 199 + ---------- 200 + 201 + Here is a trivial example that calls puts() a few times. 202 + 203 + #include <stdio.h> 204 + #include <ffi.h> 205 + 206 + int main() 207 + { 208 + ffi_cif cif; 209 + ffi_type *args[1]; 210 + void *values[1]; 211 + char *s; 212 + int rc; 213 + 214 + /* Initialize the argument info vectors */ 215 + args[0] = &ffi_type_uint; 216 + values[0] = &s; 217 + 218 + /* Initialize the cif */ 219 + if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 220 + &ffi_type_uint, args) == FFI_OK) 221 + { 222 + s = "Hello World!"; 223 + ffi_call(&cif, puts, &rc, values); 224 + /* rc now holds the result of the call to puts */ 225 + 226 + /* values holds a pointer to the function's arg, so to 227 + call puts() again all we need to do is change the 228 + value of s */ 229 + s = "This is cool!"; 230 + ffi_call(&cif, puts, &rc, values); 231 + } 232 + 233 + return 0; 234 + } 235 + 236 + 237 + 238 + Aggregate Types 239 + --------------- 240 + 241 + Although libffi has no special support for unions or bit-fields, it is 242 + perfectly happy passing structures back and forth. You must first 243 + describe the structure to libffi by creating a new ffi_type object 244 + for it. Here is the definition of ffi_type: 245 + 246 + typedef struct _ffi_type 247 + { 248 + unsigned size; 249 + short alignment; 250 + short type; 251 + struct _ffi_type **elements; 252 + } ffi_type; 253 + 254 + All structures must have type set to FFI_TYPE_STRUCT. You may set 255 + size and alignment to 0. These will be calculated and reset to the 256 + appropriate values by ffi_prep_cif(). 257 + 258 + elements is a NULL terminated array of pointers to ffi_type objects 259 + that describe the type of the structure elements. These may, in turn, 260 + be structure elements. 261 + 262 + The following example initializes a ffi_type object representing the 263 + tm struct from Linux's time.h: 264 + 265 + struct tm { 266 + int tm_sec; 267 + int tm_min; 268 + int tm_hour; 269 + int tm_mday; 270 + int tm_mon; 271 + int tm_year; 272 + int tm_wday; 273 + int tm_yday; 274 + int tm_isdst; 275 + /* Those are for future use. */ 276 + long int __tm_gmtoff__; 277 + __const char *__tm_zone__; 278 + }; 279 + 280 + { 281 + ffi_type tm_type; 282 + ffi_type *tm_type_elements[12]; 283 + int i; 284 + 285 + tm_type.size = tm_type.alignment = 0; 286 + tm_type.elements = &tm_type_elements; 287 + 288 + for (i = 0; i < 9; i++) 289 + tm_type_elements[i] = &ffi_type_sint; 290 + 291 + tm_type_elements[9] = &ffi_type_slong; 292 + tm_type_elements[10] = &ffi_type_pointer; 293 + tm_type_elements[11] = NULL; 294 + 295 + /* tm_type can now be used to represent tm argument types and 296 + return types for ffi_prep_cif() */ 297 + } 298 + 299 + 300 + 301 + Platform Specific Notes 302 + ======================= 303 + 304 + Intel x86 305 + --------- 306 + 307 + There are no known problems with the x86 port. 308 + 309 + Sun SPARC - SunOS 4.1.3 & Solaris 2.x 310 + ------------------------------------- 311 + 312 + You must use GNU Make to build libffi on Sun platforms. 313 + 314 + MIPS - Irix 5.3 & 6.x 315 + --------------------- 316 + 317 + Irix 6.2 and better supports three different calling conventions: o32, 318 + n32 and n64. Currently, libffi only supports both o32 and n32 under 319 + Irix 6.x, but only o32 under Irix 5.3. Libffi will automatically be 320 + configured for whichever calling convention it was built for. 321 + 322 + By default, the configure script will try to build libffi with the GNU 323 + development tools. To build libffi with the SGI development tools, set 324 + the environment variable CC to either "cc -32" or "cc -n32" before 325 + running configure under Irix 6.x (depending on whether you want an o32 326 + or n32 library), or just "cc" for Irix 5.3. 327 + 328 + With the n32 calling convention, when returning structures smaller 329 + than 16 bytes, be sure to provide an RVALUE that is 8 byte aligned. 330 + Here's one way of forcing this: 331 + 332 + double struct_storage[2]; 333 + my_small_struct *s = (my_small_struct *) struct_storage; 334 + /* Use s for RVALUE */ 335 + 336 + If you don't do this you are liable to get spurious bus errors. 337 + 338 + "long long" values are not supported yet. 339 + 340 + You must use GNU Make to build libffi on SGI platforms. 341 + 342 + ARM - System V ABI 343 + ------------------ 344 + 345 + The ARM port was performed on a NetWinder running ARM Linux ELF 346 + (2.0.31) and gcc 2.8.1. 347 + 348 + 349 + 350 + PowerPC System V ABI 351 + -------------------- 352 + 353 + There are two `System V ABI's which libffi implements for PowerPC. 354 + They differ only in how small structures are returned from functions. 355 + 356 + In the FFI_SYSV version, structures that are 8 bytes or smaller are 357 + returned in registers. This is what GCC does when it is configured 358 + for solaris, and is what the System V ABI I have (dated September 359 + 1995) says. 360 + 361 + In the FFI_GCC_SYSV version, all structures are returned the same way: 362 + by passing a pointer as the first argument to the function. This is 363 + what GCC does when it is configured for linux or a generic sysv 364 + target. 365 + 366 + EGCS 1.0.1 (and probably other versions of EGCS/GCC) also has a 367 + inconsistency with the SysV ABI: When a procedure is called with many 368 + floating-point arguments, some of them get put on the stack. They are 369 + all supposed to be stored in double-precision format, even if they are 370 + only single-precision, but EGCS stores single-precision arguments as 371 + single-precision anyway. This causes one test to fail (the `many 372 + arguments' test). 373 + 374 + 375 + What's With The Crazy Comments? 376 + =============================== 377 + 378 + You might notice a number of cryptic comments in the code, delimited 379 + by /*@ and @*/. These are annotations read by the program LCLint, a 380 + tool for statically checking C programs. You can read all about it at 381 + <http://larch-www.lcs.mit.edu:8001/larch/lclint/index.html>. 382 + 383 + 384 + History 385 + ======= 386 + 387 + 1.20 Oct-5-98 388 + Raffaele Sena produces ARM port. 389 + 390 + 1.19 Oct-5-98 391 + Fixed x86 long double and long long return support. 392 + m68k bug fixes from Andreas Schwab. 393 + Patch for DU assembler compatibility for the Alpha from Richard 394 + Henderson. 395 + 396 + 1.18 Apr-17-98 397 + Bug fixes and MIPS configuration changes. 398 + 399 + 1.17 Feb-24-98 400 + Bug fixes and m68k port from Andreas Schwab. PowerPC port from 401 + Geoffrey Keating. Various bug x86, Sparc and MIPS bug fixes. 402 + 403 + 1.16 Feb-11-98 404 + Richard Henderson produces Alpha port. 405 + 406 + 1.15 Dec-4-97 407 + Fixed an n32 ABI bug. New libtool, auto* support. 408 + 409 + 1.14 May-13-97 410 + libtool is now used to generate shared and static libraries. 411 + Fixed a minor portability problem reported by Russ McManus 412 + <mcmanr@eq.gs.com>. 413 + 414 + 1.13 Dec-2-96 415 + Added --enable-purify-safety to keep Purify from complaining 416 + about certain low level code. 417 + Sparc fix for calling functions with < 6 args. 418 + Linux x86 a.out fix. 419 + 420 + 1.12 Nov-22-96 421 + Added missing ffi_type_void, needed for supporting void return 422 + types. Fixed test case for non MIPS machines. Cygnus Support 423 + is now Cygnus Solutions. 424 + 425 + 1.11 Oct-30-96 426 + Added notes about GNU make. 427 + 428 + 1.10 Oct-29-96 429 + Added configuration fix for non GNU compilers. 430 + 431 + 1.09 Oct-29-96 432 + Added --enable-debug configure switch. Clean-ups based on LCLint 433 + feedback. ffi_mips.h is always installed. Many configuration 434 + fixes. Fixed ffitest.c for sparc builds. 435 + 436 + 1.08 Oct-15-96 437 + Fixed n32 problem. Many clean-ups. 438 + 439 + 1.07 Oct-14-96 440 + Gordon Irlam rewrites v8.S again. Bug fixes. 441 + 442 + 1.06 Oct-14-96 443 + Gordon Irlam improved the sparc port. 444 + 445 + 1.05 Oct-14-96 446 + Interface changes based on feedback. 447 + 448 + 1.04 Oct-11-96 449 + Sparc port complete (modulo struct passing bug). 450 + 451 + 1.03 Oct-10-96 452 + Passing struct args, and returning struct values works for 453 + all architectures/calling conventions. Expanded tests. 454 + 455 + 1.02 Oct-9-96 456 + Added SGI n32 support. Fixed bugs in both o32 and Linux support. 457 + Added "make test". 458 + 459 + 1.01 Oct-8-96 460 + Fixed float passing bug in mips version. Restructured some 461 + of the code. Builds cleanly with SGI tools. 462 + 463 + 1.00 Oct-7-96 464 + First release. No public announcement. 465 + 466 + 467 + Authors & Credits 468 + ================= 469 + 470 + libffi was written by Anthony Green <green@cygnus.com>. 471 + 472 + Portions of libffi were derived from Gianni Mariani's free gencall 473 + library for Silicon Graphics machines. 474 + 475 + The closure mechanism was designed and implemented by Kresten Krab 476 + Thorup. 477 + 478 + The Sparc port was derived from code contributed by the fine folks at 479 + Visible Decisions Inc <http://www.vdi.com>. Further enhancements were 480 + made by Gordon Irlam at Cygnus Solutions <http://www.cygnus.com>. 481 + 482 + The Alpha port was written by Richard Henderson at Cygnus Solutions. 483 + 484 + Andreas Schwab ported libffi to m68k Linux and provided a number of 485 + bug fixes. 486 + 487 + Geoffrey Keating ported libffi to the PowerPC. 488 + 489 + Raffaele Sena ported libffi to the ARM. 490 + 491 + Jesper Skov and Andrew Haley both did more than their fair share of 492 + stepping through the code and tracking down bugs. 493 + 494 + Thanks also to Tom Tromey for bug fixes and configuration help. 495 + 496 + Thanks to Jim Blandy, who provided some useful feedback on the libffi 497 + interface. 498 + 499 + If you have a problem, or have found a bug, please send a note to 500 + green@cygnus.com.
+13
src/libffi/README.MacOSX
··· 1 + This is the Xcode/Mac OS X version of libffi. 2 + 3 + It has an Xcode project that builds libffi as a statically linkable library. 4 + 5 + The unit tests assume said library has been built and installed. For now, there is no "in place" unit tests. 6 + 7 + To run the unit tests, invoke: 8 + 9 + python ./tests/run-tests.py 10 + 11 + You must be within the libffi directory when you do this. The whole thing is horribly sensitive to path related issues. At some point, the unit tests will be re-worked to be properly invoked from Xcode. 12 + 13 + Note that this is the libffi source with files renamed to be Xcode build friendly. As well, all non-MacOSX related build stuff is stripped.
+226
src/libffi/ffi.c
··· 1 + /* ----------------------------------------------------------------------- 2 + prep_cif.c - Copyright (c) 1996, 1998 Red Hat, Inc. 3 + 4 + Permission is hereby granted, free of charge, to any person obtaining 5 + a copy of this software and associated documentation files (the 6 + ``Software''), to deal in the Software without restriction, including 7 + without limitation the rights to use, copy, modify, merge, publish, 8 + distribute, sublicense, and/or sell copies of the Software, and to 9 + permit persons to whom the Software is furnished to do so, subject to 10 + the following conditions: 11 + 12 + The above copyright notice and this permission notice shall be included 13 + in all copies or substantial portions of the Software. 14 + 15 + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS 16 + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 + IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR 19 + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20 + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21 + OTHER DEALINGS IN THE SOFTWARE. 22 + ----------------------------------------------------------------------- */ 23 + 24 + #include <ffi.h> 25 + #include <ffi_common.h> 26 + 27 + #include <stdbool.h> 28 + #include <stdlib.h> 29 + 30 + /* Round up to FFI_SIZEOF_ARG. */ 31 + #define STACK_ARG_SIZE(x) ALIGN(x, FFI_SIZEOF_ARG) 32 + 33 + /* Perform machine independent initialization of aggregate type 34 + specifications. */ 35 + 36 + static ffi_status 37 + initialize_aggregate( 38 + /*@out@*/ ffi_type* arg) 39 + { 40 + /*@-usedef@*/ 41 + 42 + if (arg == NULL || arg->elements == NULL || 43 + arg->size != 0 || arg->alignment != 0) 44 + return FFI_BAD_TYPEDEF; 45 + 46 + ffi_type** ptr = &(arg->elements[0]); 47 + 48 + while ((*ptr) != NULL) 49 + { 50 + if (((*ptr)->size == 0) && (initialize_aggregate(*ptr) != FFI_OK)) 51 + return FFI_BAD_TYPEDEF; 52 + 53 + /* Perform a sanity check on the argument type */ 54 + FFI_ASSERT_VALID_TYPE(*ptr); 55 + 56 + #ifdef POWERPC_DARWIN 57 + int curalign = (*ptr)->alignment; 58 + 59 + if (ptr != &(arg->elements[0])) 60 + { 61 + if (curalign > 4 && curalign != 16) 62 + curalign = 4; 63 + } 64 + 65 + arg->size = ALIGN(arg->size, curalign); 66 + arg->size += (*ptr)->size; 67 + arg->alignment = (arg->alignment > curalign) ? 68 + arg->alignment : curalign; 69 + #else 70 + arg->size = ALIGN(arg->size, (*ptr)->alignment); 71 + arg->size += (*ptr)->size; 72 + arg->alignment = (arg->alignment > (*ptr)->alignment) ? 73 + arg->alignment : (*ptr)->alignment; 74 + #endif 75 + 76 + ptr++; 77 + } 78 + 79 + /* Structure size includes tail padding. This is important for 80 + structures that fit in one register on ABIs like the PowerPC64 81 + Linux ABI that right justify small structs in a register. 82 + It's also needed for nested structure layout, for example 83 + struct A { long a; char b; }; struct B { struct A x; char y; }; 84 + should find y at an offset of 2*sizeof(long) and result in a 85 + total size of 3*sizeof(long). */ 86 + arg->size = ALIGN(arg->size, arg->alignment); 87 + 88 + if (arg->size == 0) 89 + return FFI_BAD_TYPEDEF; 90 + 91 + return FFI_OK; 92 + 93 + /*@=usedef@*/ 94 + } 95 + 96 + #ifndef __CRIS__ 97 + /* The CRIS ABI specifies structure elements to have byte 98 + alignment only, so it completely overrides this functions, 99 + which assumes "natural" alignment and padding. */ 100 + 101 + /* Perform machine independent ffi_cif preparation, then call 102 + machine dependent routine. */ 103 + 104 + #if defined(X86_DARWIN) 105 + 106 + static inline bool 107 + struct_on_stack( 108 + int size) 109 + { 110 + if (size > 8) 111 + return true; 112 + 113 + /* This is not what the ABI says, but is what is really implemented */ 114 + switch (size) 115 + { 116 + case 1: 117 + case 2: 118 + case 4: 119 + case 8: 120 + return false; 121 + 122 + default: 123 + return true; 124 + } 125 + } 126 + 127 + #endif // defined(X86_DARWIN) 128 + 129 + // Arguments' ffi_type->alignment must be nonzero. 130 + ffi_status 131 + ffi_prep_cif( 132 + /*@out@*/ /*@partial@*/ ffi_cif* cif, 133 + ffi_abi abi, 134 + unsigned int nargs, 135 + /*@dependent@*/ /*@out@*/ /*@partial@*/ ffi_type* rtype, 136 + /*@dependent@*/ ffi_type** atypes) 137 + { 138 + if (cif == NULL) 139 + return FFI_BAD_TYPEDEF; 140 + 141 + if (abi <= FFI_FIRST_ABI || abi > FFI_DEFAULT_ABI) 142 + return FFI_BAD_ABI; 143 + 144 + unsigned int bytes = 0; 145 + unsigned int i; 146 + ffi_type** ptr; 147 + 148 + cif->abi = abi; 149 + cif->arg_types = atypes; 150 + cif->nargs = nargs; 151 + cif->rtype = rtype; 152 + cif->flags = 0; 153 + 154 + /* Initialize the return type if necessary */ 155 + /*@-usedef@*/ 156 + if ((cif->rtype->size == 0) && (initialize_aggregate(cif->rtype) != FFI_OK)) 157 + return FFI_BAD_TYPEDEF; 158 + /*@=usedef@*/ 159 + 160 + /* Perform a sanity check on the return type */ 161 + FFI_ASSERT_VALID_TYPE(cif->rtype); 162 + 163 + /* x86-64 and s390 stack space allocation is handled in prep_machdep. */ 164 + #if !defined M68K && !defined __x86_64__ && !defined S390 && !defined PA 165 + /* Make space for the return structure pointer */ 166 + if (cif->rtype->type == FFI_TYPE_STRUCT 167 + #ifdef SPARC 168 + && (cif->abi != FFI_V9 || cif->rtype->size > 32) 169 + #endif 170 + #ifdef X86_DARWIN 171 + && (struct_on_stack(cif->rtype->size)) 172 + #endif 173 + ) 174 + bytes = STACK_ARG_SIZE(sizeof(void*)); 175 + #endif 176 + 177 + for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) 178 + { 179 + /* Initialize any uninitialized aggregate type definitions */ 180 + if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK)) 181 + return FFI_BAD_TYPEDEF; 182 + 183 + if ((*ptr)->alignment == 0) 184 + return FFI_BAD_TYPEDEF; 185 + 186 + /* Perform a sanity check on the argument type, do this 187 + check after the initialization. */ 188 + FFI_ASSERT_VALID_TYPE(*ptr); 189 + 190 + #if defined(X86_DARWIN) 191 + { 192 + int align = (*ptr)->alignment; 193 + 194 + if (align > 4) 195 + align = 4; 196 + 197 + if ((align - 1) & bytes) 198 + bytes = ALIGN(bytes, align); 199 + 200 + bytes += STACK_ARG_SIZE((*ptr)->size); 201 + } 202 + #elif !defined __x86_64__ && !defined S390 && !defined PA 203 + #ifdef SPARC 204 + if (((*ptr)->type == FFI_TYPE_STRUCT 205 + && ((*ptr)->size > 16 || cif->abi != FFI_V9)) 206 + || ((*ptr)->type == FFI_TYPE_LONGDOUBLE 207 + && cif->abi != FFI_V9)) 208 + bytes += sizeof(void*); 209 + else 210 + #endif 211 + { 212 + /* Add any padding if necessary */ 213 + if (((*ptr)->alignment - 1) & bytes) 214 + bytes = ALIGN(bytes, (*ptr)->alignment); 215 + 216 + bytes += STACK_ARG_SIZE((*ptr)->size); 217 + } 218 + #endif 219 + } 220 + 221 + cif->bytes = bytes; 222 + 223 + /* Perform machine dependent cif processing */ 224 + return ffi_prep_cif_machdep(cif); 225 + } 226 + #endif /* not __CRIS__ */
+362
src/libffi/include/ffi.h
··· 1 + /* -----------------------------------------------------------------*-C-*- 2 + libffi PyOBJC - Copyright (c) 1996-2003 Red Hat, Inc. 3 + 4 + Permission is hereby granted, free of charge, to any person obtaining 5 + a copy of this software and associated documentation files (the 6 + ``Software''), to deal in the Software without restriction, including 7 + without limitation the rights to use, copy, modify, merge, publish, 8 + distribute, sublicense, and/or sell copies of the Software, and to 9 + permit persons to whom the Software is furnished to do so, subject to 10 + the following conditions: 11 + 12 + The above copyright notice and this permission notice shall be included 13 + in all copies or substantial portions of the Software. 14 + 15 + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS 16 + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 + IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR 19 + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20 + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21 + OTHER DEALINGS IN THE SOFTWARE. 22 + 23 + ----------------------------------------------------------------------- */ 24 + 25 + /* ------------------------------------------------------------------- 26 + The basic API is described in the README file. 27 + 28 + The raw API is designed to bypass some of the argument packing 29 + and unpacking on architectures for which it can be avoided. 30 + 31 + The closure API allows interpreted functions to be packaged up 32 + inside a C function pointer, so that they can be called as C functions, 33 + with no understanding on the client side that they are interpreted. 34 + It can also be used in other cases in which it is necessary to package 35 + up a user specified parameter and a function pointer as a single 36 + function pointer. 37 + 38 + The closure API must be implemented in order to get its functionality, 39 + e.g. for use by gij. Routines are provided to emulate the raw API 40 + if the underlying platform doesn't allow faster implementation. 41 + 42 + More details on the raw and closure API can be found in: 43 + 44 + http://gcc.gnu.org/ml/java/1999-q3/msg00138.html 45 + 46 + and 47 + 48 + http://gcc.gnu.org/ml/java/1999-q3/msg00174.html 49 + -------------------------------------------------------------------- */ 50 + 51 + #ifndef LIBFFI_H 52 + #define LIBFFI_H 53 + 54 + #ifdef __cplusplus 55 + extern "C" { 56 + #endif 57 + 58 + #include "fficonfig.h" 59 + 60 + /* Specify which architecture libffi is configured for. */ 61 + #ifdef MACOSX 62 + # if defined(__i386__) || defined(__x86_64__) 63 + # define X86_DARWIN 64 + # elif defined(__ppc__) || defined(__ppc64__) 65 + # define POWERPC_DARWIN 66 + # else 67 + # error "Unsupported MacOS X CPU type" 68 + # endif 69 + #else 70 + #error "Unsupported OS type" 71 + #endif 72 + 73 + /* ---- System configuration information --------------------------------- */ 74 + 75 + #include "ffitarget.h" 76 + 77 + #ifndef LIBFFI_ASM 78 + 79 + #include <stddef.h> 80 + #include <limits.h> 81 + 82 + /* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example). 83 + But we can find it either under the correct ANSI name, or under GNU 84 + C's internal name. */ 85 + #ifdef LONG_LONG_MAX 86 + # define FFI_LONG_LONG_MAX LONG_LONG_MAX 87 + #else 88 + # ifdef LLONG_MAX 89 + # define FFI_LONG_LONG_MAX LLONG_MAX 90 + # else 91 + # ifdef __GNUC__ 92 + # define FFI_LONG_LONG_MAX __LONG_LONG_MAX__ 93 + # endif 94 + # endif 95 + #endif 96 + 97 + #if SCHAR_MAX == 127 98 + # define ffi_type_uchar ffi_type_uint8 99 + # define ffi_type_schar ffi_type_sint8 100 + #else 101 + #error "char size not supported" 102 + #endif 103 + 104 + #if SHRT_MAX == 32767 105 + # define ffi_type_ushort ffi_type_uint16 106 + # define ffi_type_sshort ffi_type_sint16 107 + #elif SHRT_MAX == 2147483647 108 + # define ffi_type_ushort ffi_type_uint32 109 + # define ffi_type_sshort ffi_type_sint32 110 + #else 111 + #error "short size not supported" 112 + #endif 113 + 114 + #if INT_MAX == 32767 115 + # define ffi_type_uint ffi_type_uint16 116 + # define ffi_type_sint ffi_type_sint16 117 + #elif INT_MAX == 2147483647 118 + # define ffi_type_uint ffi_type_uint32 119 + # define ffi_type_sint ffi_type_sint32 120 + #elif INT_MAX == 9223372036854775807 121 + # define ffi_type_uint ffi_type_uint64 122 + # define ffi_type_sint ffi_type_sint64 123 + #else 124 + #error "int size not supported" 125 + #endif 126 + 127 + #if LONG_MAX == 2147483647 128 + # if FFI_LONG_LONG_MAX != 9223372036854775807 129 + # error "no 64-bit data type supported" 130 + # endif 131 + #elif LONG_MAX != 9223372036854775807 132 + #error "long size not supported" 133 + #endif 134 + 135 + #if LONG_MAX == 2147483647 136 + # define ffi_type_ulong ffi_type_uint32 137 + # define ffi_type_slong ffi_type_sint32 138 + #elif LONG_MAX == 9223372036854775807 139 + # define ffi_type_ulong ffi_type_uint64 140 + # define ffi_type_slong ffi_type_sint64 141 + #else 142 + #error "long size not supported" 143 + #endif 144 + 145 + /* The closure code assumes that this works on pointers, i.e. a size_t 146 + can hold a pointer. */ 147 + 148 + typedef struct _ffi_type { 149 + size_t size; 150 + unsigned short alignment; 151 + unsigned short type; 152 + /*@null@*/ struct _ffi_type** elements; 153 + } ffi_type; 154 + 155 + /* These are defined in types.c */ 156 + extern ffi_type ffi_type_void; 157 + extern ffi_type ffi_type_uint8; 158 + extern ffi_type ffi_type_sint8; 159 + extern ffi_type ffi_type_uint16; 160 + extern ffi_type ffi_type_sint16; 161 + extern ffi_type ffi_type_uint32; 162 + extern ffi_type ffi_type_sint32; 163 + extern ffi_type ffi_type_uint64; 164 + extern ffi_type ffi_type_sint64; 165 + extern ffi_type ffi_type_float; 166 + extern ffi_type ffi_type_double; 167 + extern ffi_type ffi_type_longdouble; 168 + extern ffi_type ffi_type_pointer; 169 + 170 + typedef enum ffi_status { 171 + FFI_OK = 0, 172 + FFI_BAD_TYPEDEF, 173 + FFI_BAD_ABI 174 + } ffi_status; 175 + 176 + typedef unsigned FFI_TYPE; 177 + 178 + typedef struct ffi_cif { 179 + ffi_abi abi; 180 + unsigned nargs; 181 + /*@dependent@*/ ffi_type** arg_types; 182 + /*@dependent@*/ ffi_type* rtype; 183 + unsigned bytes; 184 + unsigned flags; 185 + #ifdef FFI_EXTRA_CIF_FIELDS 186 + FFI_EXTRA_CIF_FIELDS; 187 + #endif 188 + } ffi_cif; 189 + 190 + /* ---- Definitions for the raw API -------------------------------------- */ 191 + 192 + #ifndef FFI_SIZEOF_ARG 193 + # if LONG_MAX == 2147483647 194 + # define FFI_SIZEOF_ARG 4 195 + # elif LONG_MAX == 9223372036854775807 196 + # define FFI_SIZEOF_ARG 8 197 + # endif 198 + #endif 199 + 200 + typedef union { 201 + ffi_sarg sint; 202 + ffi_arg uint; 203 + float flt; 204 + char data[FFI_SIZEOF_ARG]; 205 + void* ptr; 206 + } ffi_raw; 207 + 208 + void 209 + ffi_raw_call( 210 + /*@dependent@*/ ffi_cif* cif, 211 + void (*fn)(void), 212 + /*@out@*/ void* rvalue, 213 + /*@dependent@*/ ffi_raw* avalue); 214 + 215 + void 216 + ffi_ptrarray_to_raw( 217 + ffi_cif* cif, 218 + void** args, 219 + ffi_raw* raw); 220 + 221 + void 222 + ffi_raw_to_ptrarray( 223 + ffi_cif* cif, 224 + ffi_raw* raw, 225 + void** args); 226 + 227 + size_t 228 + ffi_raw_size( 229 + ffi_cif* cif); 230 + 231 + /* This is analogous to the raw API, except it uses Java parameter 232 + packing, even on 64-bit machines. I.e. on 64-bit machines 233 + longs and doubles are followed by an empty 64-bit word. */ 234 + void 235 + ffi_java_raw_call( 236 + /*@dependent@*/ ffi_cif* cif, 237 + void (*fn)(void), 238 + /*@out@*/ void* rvalue, 239 + /*@dependent@*/ ffi_raw* avalue); 240 + 241 + void 242 + ffi_java_ptrarray_to_raw( 243 + ffi_cif* cif, 244 + void** args, 245 + ffi_raw* raw); 246 + 247 + void 248 + ffi_java_raw_to_ptrarray( 249 + ffi_cif* cif, 250 + ffi_raw* raw, 251 + void** args); 252 + 253 + size_t 254 + ffi_java_raw_size( 255 + ffi_cif* cif); 256 + 257 + /* ---- Definitions for closures ----------------------------------------- */ 258 + 259 + #if FFI_CLOSURES 260 + 261 + typedef struct ffi_closure { 262 + char tramp[FFI_TRAMPOLINE_SIZE]; 263 + ffi_cif* cif; 264 + void (*fun)(ffi_cif*,void*,void**,void*); 265 + void* user_data; 266 + } ffi_closure; 267 + 268 + ffi_status 269 + ffi_prep_closure( 270 + ffi_closure* closure, 271 + ffi_cif* cif, 272 + void (*fun)(ffi_cif*,void*,void**,void*), 273 + void* user_data); 274 + 275 + typedef struct ffi_raw_closure { 276 + char tramp[FFI_TRAMPOLINE_SIZE]; 277 + ffi_cif* cif; 278 + 279 + #if !FFI_NATIVE_RAW_API 280 + /* if this is enabled, then a raw closure has the same layout 281 + as a regular closure. We use this to install an intermediate 282 + handler to do the transaltion, void** -> ffi_raw*. */ 283 + void (*translate_args)(ffi_cif*,void*,void**,void*); 284 + void* this_closure; 285 + #endif 286 + 287 + void (*fun)(ffi_cif*,void*,ffi_raw*,void*); 288 + void* user_data; 289 + } ffi_raw_closure; 290 + 291 + ffi_status 292 + ffi_prep_raw_closure( 293 + ffi_raw_closure* closure, 294 + ffi_cif* cif, 295 + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), 296 + void* user_data); 297 + 298 + ffi_status 299 + ffi_prep_java_raw_closure( 300 + ffi_raw_closure* closure, 301 + ffi_cif* cif, 302 + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), 303 + void* user_data); 304 + 305 + #else 306 + #error FFI_CLOSURES not defined 307 + #endif 308 + 309 + /* ---- Public interface definition -------------------------------------- */ 310 + 311 + ffi_status 312 + ffi_prep_cif( 313 + /*@out@*/ /*@partial@*/ ffi_cif* cif, 314 + ffi_abi abi, 315 + unsigned int nargs, 316 + /*@dependent@*/ /*@out@*/ /*@partial@*/ ffi_type* rtype, 317 + /*@dependent@*/ ffi_type** atypes); 318 + 319 + void 320 + ffi_call( 321 + /*@dependent@*/ ffi_cif* cif, 322 + void (*fn)(void), 323 + /*@out@*/ void* rvalue, 324 + /*@dependent@*/ void** avalue); 325 + 326 + /* Useful for eliminating compiler warnings */ 327 + #define FFI_FN(f) ((void (*)(void))f) 328 + 329 + #endif // #ifndef LIBFFI_ASM 330 + /* ---- Definitions shared with assembly code ---------------------------- */ 331 + 332 + /* If these change, update src/mips/ffitarget.h. */ 333 + #define FFI_TYPE_VOID 0 334 + #define FFI_TYPE_INT 1 335 + #define FFI_TYPE_FLOAT 2 336 + #define FFI_TYPE_DOUBLE 3 337 + 338 + #ifdef HAVE_LONG_DOUBLE 339 + # define FFI_TYPE_LONGDOUBLE 4 340 + #else 341 + # define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE 342 + #endif 343 + 344 + #define FFI_TYPE_UINT8 5 345 + #define FFI_TYPE_SINT8 6 346 + #define FFI_TYPE_UINT16 7 347 + #define FFI_TYPE_SINT16 8 348 + #define FFI_TYPE_UINT32 9 349 + #define FFI_TYPE_SINT32 10 350 + #define FFI_TYPE_UINT64 11 351 + #define FFI_TYPE_SINT64 12 352 + #define FFI_TYPE_STRUCT 13 353 + #define FFI_TYPE_POINTER 14 354 + 355 + /* This should always refer to the last type code (for sanity checks) */ 356 + #define FFI_TYPE_LAST FFI_TYPE_POINTER 357 + 358 + #ifdef __cplusplus 359 + } 360 + #endif 361 + 362 + #endif // #ifndef LIBFFI_H
+98
src/libffi/include/ffi_common.h
··· 1 + /* ----------------------------------------------------------------------- 2 + ffi_common.h - Copyright (c) 1996 Red Hat, Inc. 3 + 4 + Common internal definitions and macros. Only necessary for building 5 + libffi. 6 + ----------------------------------------------------------------------- */ 7 + 8 + #ifndef FFI_COMMON_H 9 + #define FFI_COMMON_H 10 + 11 + #ifdef __cplusplus 12 + extern "C" { 13 + #endif 14 + 15 + #include "fficonfig.h" 16 + 17 + /* Do not move this. Some versions of AIX are very picky about where 18 + this is positioned. */ 19 + #ifdef __GNUC__ 20 + # define alloca __builtin_alloca 21 + #else 22 + # if HAVE_ALLOCA_H 23 + # include <alloca.h> 24 + # else 25 + # ifdef _AIX 26 + # pragma alloca 27 + # else 28 + # ifndef alloca /* predefined by HP cc +Olibcalls */ 29 + char* alloca(); 30 + # endif 31 + # endif 32 + # endif 33 + #endif 34 + 35 + /* Check for the existence of memcpy. */ 36 + #if STDC_HEADERS 37 + # include <string.h> 38 + #else 39 + # ifndef HAVE_MEMCPY 40 + # define memcpy(d, s, n) bcopy((s), (d), (n)) 41 + # endif 42 + #endif 43 + 44 + #ifdef FFI_DEBUG 45 + #include <stdio.h> 46 + 47 + /*@exits@*/ void 48 + ffi_assert( 49 + /*@temp@*/ char* expr, 50 + /*@temp@*/ char* file, 51 + int line); 52 + void 53 + ffi_stop_here(void); 54 + void 55 + ffi_type_test( 56 + /*@temp@*/ /*@out@*/ ffi_type* a, 57 + /*@temp@*/ char* file, 58 + int line); 59 + 60 + # define FFI_ASSERT(x) ((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__)) 61 + # define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l))) 62 + # define FFI_ASSERT_VALID_TYPE(x) ffi_type_test(x, __FILE__, __LINE__) 63 + #else 64 + # define FFI_ASSERT(x) 65 + # define FFI_ASSERT_AT(x, f, l) 66 + # define FFI_ASSERT_VALID_TYPE(x) 67 + #endif // #ifdef FFI_DEBUG 68 + 69 + #define ALIGN(v, a) (((size_t)(v) + (a) - 1) & ~((a) - 1)) 70 + 71 + /* Perform machine dependent cif processing */ 72 + ffi_status 73 + ffi_prep_cif_machdep( 74 + ffi_cif* cif); 75 + 76 + /* Extended cif, used in callback from assembly routine */ 77 + typedef struct extended_cif { 78 + /*@dependent@*/ ffi_cif* cif; 79 + /*@dependent@*/ void* rvalue; 80 + /*@dependent@*/ void** avalue; 81 + } extended_cif; 82 + 83 + /* Terse sized type definitions. */ 84 + typedef unsigned int UINT8 __attribute__((__mode__(__QI__))); 85 + typedef signed int SINT8 __attribute__((__mode__(__QI__))); 86 + typedef unsigned int UINT16 __attribute__((__mode__(__HI__))); 87 + typedef signed int SINT16 __attribute__((__mode__(__HI__))); 88 + typedef unsigned int UINT32 __attribute__((__mode__(__SI__))); 89 + typedef signed int SINT32 __attribute__((__mode__(__SI__))); 90 + typedef unsigned int UINT64 __attribute__((__mode__(__DI__))); 91 + typedef signed int SINT64 __attribute__((__mode__(__DI__))); 92 + typedef float FLOAT32; 93 + 94 + #ifdef __cplusplus 95 + } 96 + #endif 97 + 98 + #endif // #ifndef FFI_COMMON_H
+154
src/libffi/include/fficonfig.h
··· 1 + /* Manually created fficonfig.h for Darwin on PowerPC or Intel 2 + 3 + This file is manually generated to do away with the need for autoconf and 4 + therefore make it easier to cross-compile and build fat binaries. 5 + 6 + NOTE: This file was added by PyObjC. 7 + */ 8 + 9 + #if defined(__APPLE__) && defined(__MACH__) && !defined(MACOSX) 10 + #define MACOSX 11 + #endif 12 + 13 + #ifndef MACOSX 14 + #error "This file is only supported on Mac OS X" 15 + #endif 16 + 17 + #if defined(__i386__) 18 + # define BYTEORDER 1234 19 + # undef HOST_WORDS_BIG_ENDIAN 20 + # undef WORDS_BIGENDIAN 21 + # define SIZEOF_DOUBLE 8 22 + # define HAVE_LONG_DOUBLE 1 23 + # define SIZEOF_LONG_DOUBLE 16 24 + 25 + #elif defined(__x86_64__) 26 + # define BYTEORDER 1234 27 + # undef HOST_WORDS_BIG_ENDIAN 28 + # undef WORDS_BIGENDIAN 29 + # define SIZEOF_DOUBLE 8 30 + # define HAVE_LONG_DOUBLE 1 31 + # define SIZEOF_LONG_DOUBLE 16 32 + 33 + #elif defined(__ppc__) 34 + # define BYTEORDER 4321 35 + # define HOST_WORDS_BIG_ENDIAN 1 36 + # define WORDS_BIGENDIAN 1 37 + # define SIZEOF_DOUBLE 8 38 + # if __GNUC__ >= 4 39 + # define HAVE_LONG_DOUBLE 1 40 + # define SIZEOF_LONG_DOUBLE 16 41 + # else 42 + # undef HAVE_LONG_DOUBLE 43 + # define SIZEOF_LONG_DOUBLE 8 44 + # endif 45 + 46 + #elif defined(__ppc64__) 47 + # define BYTEORDER 4321 48 + # define HOST_WORDS_BIG_ENDIAN 1 49 + # define WORDS_BIGENDIAN 1 50 + # define SIZEOF_DOUBLE 8 51 + # define HAVE_LONG_DOUBLE 1 52 + # define SIZEOF_LONG_DOUBLE 16 53 + 54 + #else 55 + #error "Unknown CPU type" 56 + #endif 57 + 58 + /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP 59 + systems. This function is required for `alloca.c' support on those systems. */ 60 + #undef CRAY_STACKSEG_END 61 + 62 + /* Define to 1 if using `alloca.c'. */ 63 + /* #undef C_ALLOCA */ 64 + 65 + /* Define to the flags needed for the .section .eh_frame directive. */ 66 + #define EH_FRAME_FLAGS "aw" 67 + 68 + /* Define this if you want extra debugging. */ 69 + #undef FFI_DEBUG 70 + 71 + /* Define this is you do not want support for the raw API. */ 72 + #define FFI_NO_RAW_API 1 73 + 74 + /* Define this if you do not want support for aggregate types. */ 75 + /* #undef FFI_NO_STRUCTS */ 76 + 77 + /* Define to 1 if you have `alloca', as a function or macro. */ 78 + #define HAVE_ALLOCA 1 79 + 80 + /* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). */ 81 + #define HAVE_ALLOCA_H 1 82 + 83 + /* Define if your assembler supports .register. */ 84 + /* #undef HAVE_AS_REGISTER_PSEUDO_OP */ 85 + 86 + /* Define if your assembler and linker support unaligned PC relative relocs. */ 87 + /* #undef HAVE_AS_SPARC_UA_PCREL */ 88 + 89 + /* Define to 1 if you have the `memcpy' function. */ 90 + #define HAVE_MEMCPY 1 91 + 92 + /* Define if mmap with MAP_ANON(YMOUS) works. */ 93 + #define HAVE_MMAP_ANON 1 94 + 95 + /* Define if mmap of /dev/zero works. */ 96 + /* #undef HAVE_MMAP_DEV_ZERO */ 97 + 98 + /* Define if read-only mmap of a plain file works. */ 99 + #define HAVE_MMAP_FILE 1 100 + 101 + /* Define if .eh_frame sections should be read-only. */ 102 + /* #undef HAVE_RO_EH_FRAME */ 103 + 104 + /* Define to 1 if your C compiler doesn't accept -c and -o together. */ 105 + /* #undef NO_MINUS_C_MINUS_O */ 106 + 107 + /* Name of package */ 108 + #define PACKAGE "libffi" 109 + 110 + /* Define to the address where bug reports for this package should be sent. */ 111 + #define PACKAGE_BUGREPORT "http://gcc.gnu.org/bugs.html" 112 + 113 + /* Define to the full name of this package. */ 114 + #define PACKAGE_NAME "libffi" 115 + 116 + /* Define to the full name and version of this package. */ 117 + #define PACKAGE_STRING "libffi 2.1" 118 + 119 + /* Define to the one symbol short name of this package. */ 120 + #define PACKAGE_TARNAME "libffi" 121 + 122 + /* Define to the version of this package. */ 123 + #define PACKAGE_VERSION "2.1" 124 + 125 + /* If using the C implementation of alloca, define if you know the 126 + direction of stack growth for your system; otherwise it will be 127 + automatically deduced at run-time. 128 + STACK_DIRECTION > 0 => grows toward higher addresses 129 + STACK_DIRECTION < 0 => grows toward lower addresses 130 + STACK_DIRECTION = 0 => direction of growth unknown */ 131 + /* #undef STACK_DIRECTION */ 132 + 133 + /* Define to 1 if you have the ANSI C header files. */ 134 + #define STDC_HEADERS 1 135 + 136 + /* Define this if you are using Purify and want to suppress spurious messages. */ 137 + /* #undef USING_PURIFY */ 138 + 139 + /* Version number of package */ 140 + #define VERSION "2.1-pyobjc" 141 + 142 + #ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE 143 + # ifdef LIBFFI_ASM 144 + # define FFI_HIDDEN(name) .hidden name 145 + # else 146 + # define FFI_HIDDEN __attribute__((visibility ("hidden"))) 147 + # endif 148 + #else 149 + # ifdef LIBFFI_ASM 150 + # define FFI_HIDDEN(name) 151 + # else 152 + # define FFI_HIDDEN 153 + # endif 154 + #endif
+13
src/libffi/include/ffitarget.h
··· 1 + /* Dispatch to the right ffitarget file. This file is PyObjC specific; in a 2 + normal build, the build environment copies the file to the right location or 3 + sets up the right include flags. We want to do neither because that would 4 + make building fat binaries harder. 5 + */ 6 + 7 + #if defined(__i386__) || defined(__x86_64__) 8 + #include "x86-ffitarget.h" 9 + #elif defined(__ppc__) || defined(__ppc64__) 10 + #include "ppc-ffitarget.h" 11 + #else 12 + #error "Unsupported CPU type" 13 + #endif
+104
src/libffi/include/ppc-ffitarget.h
··· 1 + /* -----------------------------------------------------------------*-C-*- 2 + ppc-ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. 3 + Target configuration macros for PowerPC. 4 + 5 + Permission is hereby granted, free of charge, to any person obtaining 6 + a copy of this software and associated documentation files (the 7 + ``Software''), to deal in the Software without restriction, including 8 + without limitation the rights to use, copy, modify, merge, publish, 9 + distribute, sublicense, and/or sell copies of the Software, and to 10 + permit persons to whom the Software is furnished to do so, subject to 11 + the following conditions: 12 + 13 + The above copyright notice and this permission notice shall be included 14 + in all copies or substantial portions of the Software. 15 + 16 + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 + IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 + OTHER DEALINGS IN THE SOFTWARE. 23 + ----------------------------------------------------------------------- */ 24 + 25 + #ifndef LIBFFI_TARGET_H 26 + #define LIBFFI_TARGET_H 27 + 28 + /* ---- System specific configurations ----------------------------------- */ 29 + 30 + #if (defined(POWERPC) && defined(__powerpc64__)) || \ 31 + (defined(POWERPC_DARWIN) && defined(__ppc64__)) 32 + #define POWERPC64 33 + #endif 34 + 35 + #ifndef LIBFFI_ASM 36 + 37 + typedef unsigned long ffi_arg; 38 + typedef signed long ffi_sarg; 39 + 40 + typedef enum ffi_abi { 41 + FFI_FIRST_ABI = 0, 42 + 43 + #ifdef POWERPC 44 + FFI_SYSV, 45 + FFI_GCC_SYSV, 46 + FFI_LINUX64, 47 + # ifdef POWERPC64 48 + FFI_DEFAULT_ABI = FFI_LINUX64, 49 + # else 50 + FFI_DEFAULT_ABI = FFI_GCC_SYSV, 51 + # endif 52 + #endif 53 + 54 + #ifdef POWERPC_AIX 55 + FFI_AIX, 56 + FFI_DARWIN, 57 + FFI_DEFAULT_ABI = FFI_AIX, 58 + #endif 59 + 60 + #ifdef POWERPC_DARWIN 61 + FFI_AIX, 62 + FFI_DARWIN, 63 + FFI_DEFAULT_ABI = FFI_DARWIN, 64 + #endif 65 + 66 + #ifdef POWERPC_FREEBSD 67 + FFI_SYSV, 68 + FFI_GCC_SYSV, 69 + FFI_LINUX64, 70 + FFI_DEFAULT_ABI = FFI_SYSV, 71 + #endif 72 + 73 + FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 74 + } ffi_abi; 75 + 76 + #endif // #ifndef LIBFFI_ASM 77 + 78 + /* ---- Definitions for closures ----------------------------------------- */ 79 + 80 + #define FFI_CLOSURES 1 81 + #define FFI_NATIVE_RAW_API 0 82 + 83 + /* Needed for FFI_SYSV small structure returns. */ 84 + #define FFI_SYSV_TYPE_SMALL_STRUCT (FFI_TYPE_LAST) 85 + 86 + #if defined(POWERPC64) /*|| defined(POWERPC_AIX)*/ 87 + # define FFI_TRAMPOLINE_SIZE 48 88 + #elif defined(POWERPC_AIX) 89 + # define FFI_TRAMPOLINE_SIZE 24 90 + #else 91 + # define FFI_TRAMPOLINE_SIZE 40 92 + #endif 93 + 94 + #ifndef LIBFFI_ASM 95 + # if defined(POWERPC_DARWIN) || defined(POWERPC_AIX) 96 + typedef struct ffi_aix_trampoline_struct { 97 + void* code_pointer; /* Pointer to ffi_closure_ASM */ 98 + void* toc; /* TOC */ 99 + void* static_chain; /* Pointer to closure */ 100 + } ffi_aix_trampoline_struct; 101 + # endif 102 + #endif // #ifndef LIBFFI_ASM 103 + 104 + #endif // #ifndef LIBFFI_TARGET_H
+88
src/libffi/include/x86-ffitarget.h
··· 1 + /* -----------------------------------------------------------------*-C-*- 2 + x86-ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. 3 + Target configuration macros for x86 and x86-64. 4 + 5 + Permission is hereby granted, free of charge, to any person obtaining 6 + a copy of this software and associated documentation files (the 7 + ``Software''), to deal in the Software without restriction, including 8 + without limitation the rights to use, copy, modify, merge, publish, 9 + distribute, sublicense, and/or sell copies of the Software, and to 10 + permit persons to whom the Software is furnished to do so, subject to 11 + the following conditions: 12 + 13 + The above copyright notice and this permission notice shall be included 14 + in all copies or substantial portions of the Software. 15 + 16 + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 + IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 + OTHER DEALINGS IN THE SOFTWARE. 23 + 24 + ----------------------------------------------------------------------- */ 25 + 26 + #ifndef LIBFFI_TARGET_H 27 + #define LIBFFI_TARGET_H 28 + 29 + /* ---- System specific configurations ----------------------------------- */ 30 + 31 + #if defined(X86_64) && defined(__i386__) 32 + # undef X86_64 33 + # define X86 34 + #endif 35 + 36 + #if defined(__x86_64__) 37 + # ifndef X86_64 38 + # define X86_64 39 + # endif 40 + #endif 41 + 42 + /* ---- Generic type definitions ----------------------------------------- */ 43 + 44 + #ifndef LIBFFI_ASM 45 + 46 + typedef unsigned long ffi_arg; 47 + typedef signed long ffi_sarg; 48 + 49 + typedef enum ffi_abi { 50 + FFI_FIRST_ABI = 0, 51 + 52 + /* ---- Intel x86 Win32 ---------- */ 53 + #ifdef X86_WIN32 54 + FFI_SYSV, 55 + FFI_STDCALL, 56 + /* TODO: Add fastcall support for the sake of completeness */ 57 + FFI_DEFAULT_ABI = FFI_SYSV, 58 + #endif 59 + 60 + /* ---- Intel x86 and AMD x86-64 - */ 61 + #if !defined(X86_WIN32) && (defined(__i386__) || defined(__x86_64__)) 62 + FFI_SYSV, 63 + FFI_UNIX64, /* Unix variants all use the same ABI for x86-64 */ 64 + # ifdef __i386__ 65 + FFI_DEFAULT_ABI = FFI_SYSV, 66 + # else 67 + FFI_DEFAULT_ABI = FFI_UNIX64, 68 + # endif 69 + #endif 70 + 71 + FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 72 + } ffi_abi; 73 + 74 + #endif // #ifndef LIBFFI_ASM 75 + 76 + /* ---- Definitions for closures ----------------------------------------- */ 77 + 78 + #define FFI_CLOSURES 1 79 + 80 + #if defined(X86_64) || (defined(__x86_64__) && defined(X86_DARWIN)) 81 + # define FFI_TRAMPOLINE_SIZE 24 82 + # define FFI_NATIVE_RAW_API 0 83 + #else 84 + # define FFI_TRAMPOLINE_SIZE 10 85 + # define FFI_NATIVE_RAW_API 1 /* x86 has native raw api support */ 86 + #endif 87 + 88 + #endif // #ifndef LIBFFI_TARGET_H
+17
src/libffi/libffi-exports.sym
··· 1 + _ffi_call 2 + _ffi_prep_cif 3 + _ffi_prep_closure 4 + 5 + _ffi_type_double 6 + _ffi_type_float 7 + _ffi_type_longdouble 8 + _ffi_type_pointer 9 + _ffi_type_sint16 10 + _ffi_type_sint32 11 + _ffi_type_sint64 12 + _ffi_type_sint8 13 + _ffi_type_uint16 14 + _ffi_type_uint32 15 + _ffi_type_uint64 16 + _ffi_type_uint8 17 + _ffi_type_void
+1406
src/libffi/libffi.xcodeproj/bbum.mode1v3
··· 1 + <?xml version="1.0" encoding="UTF-8"?> 2 + <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 3 + <plist version="1.0"> 4 + <dict> 5 + <key>ActivePerspectiveName</key> 6 + <string>Project</string> 7 + <key>AllowedModules</key> 8 + <array> 9 + <dict> 10 + <key>BundleLoadPath</key> 11 + <string></string> 12 + <key>MaxInstances</key> 13 + <string>n</string> 14 + <key>Module</key> 15 + <string>PBXSmartGroupTreeModule</string> 16 + <key>Name</key> 17 + <string>Groups and Files Outline View</string> 18 + </dict> 19 + <dict> 20 + <key>BundleLoadPath</key> 21 + <string></string> 22 + <key>MaxInstances</key> 23 + <string>n</string> 24 + <key>Module</key> 25 + <string>PBXNavigatorGroup</string> 26 + <key>Name</key> 27 + <string>Editor</string> 28 + </dict> 29 + <dict> 30 + <key>BundleLoadPath</key> 31 + <string></string> 32 + <key>MaxInstances</key> 33 + <string>n</string> 34 + <key>Module</key> 35 + <string>XCTaskListModule</string> 36 + <key>Name</key> 37 + <string>Task List</string> 38 + </dict> 39 + <dict> 40 + <key>BundleLoadPath</key> 41 + <string></string> 42 + <key>MaxInstances</key> 43 + <string>n</string> 44 + <key>Module</key> 45 + <string>XCDetailModule</string> 46 + <key>Name</key> 47 + <string>File and Smart Group Detail Viewer</string> 48 + </dict> 49 + <dict> 50 + <key>BundleLoadPath</key> 51 + <string></string> 52 + <key>MaxInstances</key> 53 + <string>1</string> 54 + <key>Module</key> 55 + <string>PBXBuildResultsModule</string> 56 + <key>Name</key> 57 + <string>Detailed Build Results Viewer</string> 58 + </dict> 59 + <dict> 60 + <key>BundleLoadPath</key> 61 + <string></string> 62 + <key>MaxInstances</key> 63 + <string>1</string> 64 + <key>Module</key> 65 + <string>PBXProjectFindModule</string> 66 + <key>Name</key> 67 + <string>Project Batch Find Tool</string> 68 + </dict> 69 + <dict> 70 + <key>BundleLoadPath</key> 71 + <string></string> 72 + <key>MaxInstances</key> 73 + <string>n</string> 74 + <key>Module</key> 75 + <string>XCProjectFormatConflictsModule</string> 76 + <key>Name</key> 77 + <string>Project Format Conflicts List</string> 78 + </dict> 79 + <dict> 80 + <key>BundleLoadPath</key> 81 + <string></string> 82 + <key>MaxInstances</key> 83 + <string>n</string> 84 + <key>Module</key> 85 + <string>PBXBookmarksModule</string> 86 + <key>Name</key> 87 + <string>Bookmarks Tool</string> 88 + </dict> 89 + <dict> 90 + <key>BundleLoadPath</key> 91 + <string></string> 92 + <key>MaxInstances</key> 93 + <string>n</string> 94 + <key>Module</key> 95 + <string>PBXClassBrowserModule</string> 96 + <key>Name</key> 97 + <string>Class Browser</string> 98 + </dict> 99 + <dict> 100 + <key>BundleLoadPath</key> 101 + <string></string> 102 + <key>MaxInstances</key> 103 + <string>n</string> 104 + <key>Module</key> 105 + <string>PBXCVSModule</string> 106 + <key>Name</key> 107 + <string>Source Code Control Tool</string> 108 + </dict> 109 + <dict> 110 + <key>BundleLoadPath</key> 111 + <string></string> 112 + <key>MaxInstances</key> 113 + <string>n</string> 114 + <key>Module</key> 115 + <string>PBXDebugBreakpointsModule</string> 116 + <key>Name</key> 117 + <string>Debug Breakpoints Tool</string> 118 + </dict> 119 + <dict> 120 + <key>BundleLoadPath</key> 121 + <string></string> 122 + <key>MaxInstances</key> 123 + <string>n</string> 124 + <key>Module</key> 125 + <string>XCDockableInspector</string> 126 + <key>Name</key> 127 + <string>Inspector</string> 128 + </dict> 129 + <dict> 130 + <key>BundleLoadPath</key> 131 + <string></string> 132 + <key>MaxInstances</key> 133 + <string>n</string> 134 + <key>Module</key> 135 + <string>PBXOpenQuicklyModule</string> 136 + <key>Name</key> 137 + <string>Open Quickly Tool</string> 138 + </dict> 139 + <dict> 140 + <key>BundleLoadPath</key> 141 + <string></string> 142 + <key>MaxInstances</key> 143 + <string>1</string> 144 + <key>Module</key> 145 + <string>PBXDebugSessionModule</string> 146 + <key>Name</key> 147 + <string>Debugger</string> 148 + </dict> 149 + <dict> 150 + <key>BundleLoadPath</key> 151 + <string></string> 152 + <key>MaxInstances</key> 153 + <string>1</string> 154 + <key>Module</key> 155 + <string>PBXDebugCLIModule</string> 156 + <key>Name</key> 157 + <string>Debug Console</string> 158 + </dict> 159 + <dict> 160 + <key>BundleLoadPath</key> 161 + <string></string> 162 + <key>MaxInstances</key> 163 + <string>n</string> 164 + <key>Module</key> 165 + <string>XCSnapshotModule</string> 166 + <key>Name</key> 167 + <string>Snapshots Tool</string> 168 + </dict> 169 + </array> 170 + <key>BundlePath</key> 171 + <string>/Developer/Library/PrivateFrameworks/DevToolsInterface.framework/Resources</string> 172 + <key>Description</key> 173 + <string>DefaultDescriptionKey</string> 174 + <key>DockingSystemVisible</key> 175 + <false/> 176 + <key>Extension</key> 177 + <string>mode1v3</string> 178 + <key>FavBarConfig</key> 179 + <dict> 180 + <key>PBXProjectModuleGUID</key> 181 + <string>770E5CEE0E4D12A200979D3A</string> 182 + <key>XCBarModuleItemNames</key> 183 + <dict/> 184 + <key>XCBarModuleItems</key> 185 + <array/> 186 + </dict> 187 + <key>FirstTimeWindowDisplayed</key> 188 + <false/> 189 + <key>Identifier</key> 190 + <string>com.apple.perspectives.project.mode1v3</string> 191 + <key>MajorVersion</key> 192 + <integer>33</integer> 193 + <key>MinorVersion</key> 194 + <integer>0</integer> 195 + <key>Name</key> 196 + <string>Default</string> 197 + <key>Notifications</key> 198 + <array/> 199 + <key>OpenEditors</key> 200 + <array/> 201 + <key>PerspectiveWidths</key> 202 + <array> 203 + <integer>-1</integer> 204 + <integer>-1</integer> 205 + </array> 206 + <key>Perspectives</key> 207 + <array> 208 + <dict> 209 + <key>ChosenToolbarItems</key> 210 + <array> 211 + <string>active-combo-popup</string> 212 + <string>action</string> 213 + <string>NSToolbarFlexibleSpaceItem</string> 214 + <string>build-and-go</string> 215 + <string>debugger-enable-breakpoints</string> 216 + <string>com.apple.ide.PBXToolbarStopButton</string> 217 + <string>get-info</string> 218 + <string>NSToolbarFlexibleSpaceItem</string> 219 + <string>com.apple.pbx.toolbar.searchfield</string> 220 + </array> 221 + <key>ControllerClassBaseName</key> 222 + <string></string> 223 + <key>IconName</key> 224 + <string>WindowOfProjectWithEditor</string> 225 + <key>Identifier</key> 226 + <string>perspective.project</string> 227 + <key>IsVertical</key> 228 + <false/> 229 + <key>Layout</key> 230 + <array> 231 + <dict> 232 + <key>BecomeActive</key> 233 + <true/> 234 + <key>ContentConfiguration</key> 235 + <dict> 236 + <key>PBXBottomSmartGroupGIDs</key> 237 + <array> 238 + <string>1C37FBAC04509CD000000102</string> 239 + <string>1C37FAAC04509CD000000102</string> 240 + <string>1C08E77C0454961000C914BD</string> 241 + <string>1C37FABC05509CD000000102</string> 242 + <string>1C37FABC05539CD112110102</string> 243 + <string>E2644B35053B69B200211256</string> 244 + <string>1C37FABC04509CD000100104</string> 245 + <string>1CC0EA4004350EF90044410B</string> 246 + <string>1CC0EA4004350EF90041110B</string> 247 + </array> 248 + <key>PBXProjectModuleGUID</key> 249 + <string>1CE0B1FE06471DED0097A5F4</string> 250 + <key>PBXProjectModuleLabel</key> 251 + <string>Files</string> 252 + <key>PBXProjectStructureProvided</key> 253 + <string>yes</string> 254 + <key>PBXSmartGroupTreeModuleColumnData</key> 255 + <dict> 256 + <key>PBXSmartGroupTreeModuleColumnWidthsKey</key> 257 + <array> 258 + <real>22</real> 259 + <real>164</real> 260 + </array> 261 + <key>PBXSmartGroupTreeModuleColumnsKey_v4</key> 262 + <array> 263 + <string>SCMStatusColumn</string> 264 + <string>MainColumn</string> 265 + </array> 266 + </dict> 267 + <key>PBXSmartGroupTreeModuleOutlineStateKey_v7</key> 268 + <dict> 269 + <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key> 270 + <array> 271 + <string>08FB7794FE84155DC02AAC07</string> 272 + <string>774A68990AB08BD200FBC511</string> 273 + <string>08FB7795FE84155DC02AAC07</string> 274 + <string>774A68630AB08AC500FBC511</string> 275 + <string>1C37FBAC04509CD000000102</string> 276 + <string>1C37FAAC04509CD000000102</string> 277 + <string>1C37FABC05509CD000000102</string> 278 + </array> 279 + <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> 280 + <array> 281 + <array> 282 + <integer>19</integer> 283 + <integer>18</integer> 284 + </array> 285 + </array> 286 + <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> 287 + <string>{{0, 0}, {186, 755}}</string> 288 + </dict> 289 + <key>PBXTopSmartGroupGIDs</key> 290 + <array/> 291 + <key>XCIncludePerspectivesSwitch</key> 292 + <true/> 293 + <key>XCSharingToken</key> 294 + <string>com.apple.Xcode.GFSharingToken</string> 295 + </dict> 296 + <key>GeometryConfiguration</key> 297 + <dict> 298 + <key>Frame</key> 299 + <string>{{0, 0}, {203, 773}}</string> 300 + <key>GroupTreeTableConfiguration</key> 301 + <array> 302 + <string>SCMStatusColumn</string> 303 + <real>22</real> 304 + <string>MainColumn</string> 305 + <real>164</real> 306 + </array> 307 + <key>RubberWindowFrame</key> 308 + <string>109 64 931 814 0 0 1440 878 </string> 309 + </dict> 310 + <key>Module</key> 311 + <string>PBXSmartGroupTreeModule</string> 312 + <key>Proportion</key> 313 + <string>203pt</string> 314 + </dict> 315 + <dict> 316 + <key>Dock</key> 317 + <array> 318 + <dict> 319 + <key>ContentConfiguration</key> 320 + <dict> 321 + <key>PBXProjectModuleGUID</key> 322 + <string>1CE0B20306471E060097A5F4</string> 323 + <key>PBXProjectModuleLabel</key> 324 + <string>x86-darwin.S</string> 325 + <key>PBXSplitModuleInNavigatorKey</key> 326 + <dict> 327 + <key>Split0</key> 328 + <dict> 329 + <key>PBXProjectModuleGUID</key> 330 + <string>1CE0B20406471E060097A5F4</string> 331 + <key>PBXProjectModuleLabel</key> 332 + <string>x86-darwin.S</string> 333 + <key>_historyCapacity</key> 334 + <integer>0</integer> 335 + <key>bookmark</key> 336 + <string>77B8934E0EE9FE9E00BDB2A0</string> 337 + <key>history</key> 338 + <array> 339 + <string>773256280E676B810068967B</string> 340 + <string>773256370E676B9E0068967B</string> 341 + <string>773256750E67711F0068967B</string> 342 + <string>77C6B7D40E68807300F73F79</string> 343 + <string>77C6B7F00E68816E00F73F79</string> 344 + <string>77C6B7F10E68816E00F73F79</string> 345 + <string>77C6B8010E6883AD00F73F79</string> 346 + <string>77C6B87D0E68BA4E00F73F79</string> 347 + <string>778346E20E8C39130090422B</string> 348 + <string>778347150E8C3E9D0090422B</string> 349 + <string>7759A70F0EC223A300D5A4CA</string> 350 + <string>77AFBF2A0EC22FDE00AB26E6</string> 351 + <string>77AFBF2B0EC22FDE00AB26E6</string> 352 + <string>77AFBF390EC2508200AB26E6</string> 353 + </array> 354 + <key>prevStack</key> 355 + <array> 356 + <string>7732562E0E676B810068967B</string> 357 + <string>7732562F0E676B810068967B</string> 358 + <string>7732563B0E676B9E0068967B</string> 359 + <string>7732563C0E676B9E0068967B</string> 360 + <string>7732567C0E67711F0068967B</string> 361 + <string>773256850E6771900068967B</string> 362 + <string>77C6B7D80E68807300F73F79</string> 363 + <string>77C6B7F40E68816E00F73F79</string> 364 + <string>77C6B7F50E68816E00F73F79</string> 365 + <string>77C6B8050E6883AD00F73F79</string> 366 + <string>77C6B87F0E68BA4E00F73F79</string> 367 + <string>778347170E8C3E9D0090422B</string> 368 + <string>7783471A0E8C3E9D0090422B</string> 369 + <string>77AFBF2E0EC22FDE00AB26E6</string> 370 + <string>77AFBF320EC22FDE00AB26E6</string> 371 + </array> 372 + </dict> 373 + <key>SplitCount</key> 374 + <string>1</string> 375 + </dict> 376 + <key>StatusBarVisibility</key> 377 + <true/> 378 + </dict> 379 + <key>GeometryConfiguration</key> 380 + <dict> 381 + <key>Frame</key> 382 + <string>{{0, 0}, {723, 648}}</string> 383 + <key>RubberWindowFrame</key> 384 + <string>109 64 931 814 0 0 1440 878 </string> 385 + </dict> 386 + <key>Module</key> 387 + <string>PBXNavigatorGroup</string> 388 + <key>Proportion</key> 389 + <string>648pt</string> 390 + </dict> 391 + <dict> 392 + <key>ContentConfiguration</key> 393 + <dict> 394 + <key>PBXProjectModuleGUID</key> 395 + <string>1CE0B20506471E060097A5F4</string> 396 + <key>PBXProjectModuleLabel</key> 397 + <string>Detail</string> 398 + </dict> 399 + <key>GeometryConfiguration</key> 400 + <dict> 401 + <key>Frame</key> 402 + <string>{{0, 653}, {723, 120}}</string> 403 + <key>RubberWindowFrame</key> 404 + <string>109 64 931 814 0 0 1440 878 </string> 405 + </dict> 406 + <key>Module</key> 407 + <string>XCDetailModule</string> 408 + <key>Proportion</key> 409 + <string>120pt</string> 410 + </dict> 411 + </array> 412 + <key>Proportion</key> 413 + <string>723pt</string> 414 + </dict> 415 + </array> 416 + <key>Name</key> 417 + <string>Project</string> 418 + <key>ServiceClasses</key> 419 + <array> 420 + <string>XCModuleDock</string> 421 + <string>PBXSmartGroupTreeModule</string> 422 + <string>XCModuleDock</string> 423 + <string>PBXNavigatorGroup</string> 424 + <string>XCDetailModule</string> 425 + </array> 426 + <key>TableOfContents</key> 427 + <array> 428 + <string>77B8934F0EE9FE9E00BDB2A0</string> 429 + <string>1CE0B1FE06471DED0097A5F4</string> 430 + <string>77B893500EE9FE9E00BDB2A0</string> 431 + <string>1CE0B20306471E060097A5F4</string> 432 + <string>1CE0B20506471E060097A5F4</string> 433 + </array> 434 + <key>ToolbarConfigUserDefaultsMinorVersion</key> 435 + <string>2</string> 436 + <key>ToolbarConfiguration</key> 437 + <string>xcode.toolbar.config.defaultV3</string> 438 + </dict> 439 + <dict> 440 + <key>ControllerClassBaseName</key> 441 + <string></string> 442 + <key>IconName</key> 443 + <string>WindowOfProject</string> 444 + <key>Identifier</key> 445 + <string>perspective.morph</string> 446 + <key>IsVertical</key> 447 + <integer>0</integer> 448 + <key>Layout</key> 449 + <array> 450 + <dict> 451 + <key>BecomeActive</key> 452 + <integer>1</integer> 453 + <key>ContentConfiguration</key> 454 + <dict> 455 + <key>PBXBottomSmartGroupGIDs</key> 456 + <array> 457 + <string>1C37FBAC04509CD000000102</string> 458 + <string>1C37FAAC04509CD000000102</string> 459 + <string>1C08E77C0454961000C914BD</string> 460 + <string>1C37FABC05509CD000000102</string> 461 + <string>1C37FABC05539CD112110102</string> 462 + <string>E2644B35053B69B200211256</string> 463 + <string>1C37FABC04509CD000100104</string> 464 + <string>1CC0EA4004350EF90044410B</string> 465 + <string>1CC0EA4004350EF90041110B</string> 466 + </array> 467 + <key>PBXProjectModuleGUID</key> 468 + <string>11E0B1FE06471DED0097A5F4</string> 469 + <key>PBXProjectModuleLabel</key> 470 + <string>Files</string> 471 + <key>PBXProjectStructureProvided</key> 472 + <string>yes</string> 473 + <key>PBXSmartGroupTreeModuleColumnData</key> 474 + <dict> 475 + <key>PBXSmartGroupTreeModuleColumnWidthsKey</key> 476 + <array> 477 + <real>186</real> 478 + </array> 479 + <key>PBXSmartGroupTreeModuleColumnsKey_v4</key> 480 + <array> 481 + <string>MainColumn</string> 482 + </array> 483 + </dict> 484 + <key>PBXSmartGroupTreeModuleOutlineStateKey_v7</key> 485 + <dict> 486 + <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key> 487 + <array> 488 + <string>29B97314FDCFA39411CA2CEA</string> 489 + <string>1C37FABC05509CD000000102</string> 490 + </array> 491 + <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> 492 + <array> 493 + <array> 494 + <integer>0</integer> 495 + </array> 496 + </array> 497 + <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> 498 + <string>{{0, 0}, {186, 337}}</string> 499 + </dict> 500 + <key>PBXTopSmartGroupGIDs</key> 501 + <array/> 502 + <key>XCIncludePerspectivesSwitch</key> 503 + <integer>1</integer> 504 + <key>XCSharingToken</key> 505 + <string>com.apple.Xcode.GFSharingToken</string> 506 + </dict> 507 + <key>GeometryConfiguration</key> 508 + <dict> 509 + <key>Frame</key> 510 + <string>{{0, 0}, {203, 355}}</string> 511 + <key>GroupTreeTableConfiguration</key> 512 + <array> 513 + <string>MainColumn</string> 514 + <real>186</real> 515 + </array> 516 + <key>RubberWindowFrame</key> 517 + <string>373 269 690 397 0 0 1440 878 </string> 518 + </dict> 519 + <key>Module</key> 520 + <string>PBXSmartGroupTreeModule</string> 521 + <key>Proportion</key> 522 + <string>100%</string> 523 + </dict> 524 + </array> 525 + <key>Name</key> 526 + <string>Morph</string> 527 + <key>PreferredWidth</key> 528 + <integer>300</integer> 529 + <key>ServiceClasses</key> 530 + <array> 531 + <string>XCModuleDock</string> 532 + <string>PBXSmartGroupTreeModule</string> 533 + </array> 534 + <key>TableOfContents</key> 535 + <array> 536 + <string>11E0B1FE06471DED0097A5F4</string> 537 + </array> 538 + <key>ToolbarConfiguration</key> 539 + <string>xcode.toolbar.config.default.shortV3</string> 540 + </dict> 541 + </array> 542 + <key>PerspectivesBarVisible</key> 543 + <false/> 544 + <key>ShelfIsVisible</key> 545 + <false/> 546 + <key>SourceDescription</key> 547 + <string>file at '/Developer/Library/PrivateFrameworks/DevToolsInterface.framework/Resources/XCPerspectivesSpecificationMode1.xcperspec'</string> 548 + <key>StatusbarIsVisible</key> 549 + <true/> 550 + <key>TimeStamp</key> 551 + <real>0.0</real> 552 + <key>ToolbarDisplayMode</key> 553 + <integer>1</integer> 554 + <key>ToolbarIsVisible</key> 555 + <true/> 556 + <key>ToolbarSizeMode</key> 557 + <integer>2</integer> 558 + <key>Type</key> 559 + <string>Perspectives</string> 560 + <key>UpdateMessage</key> 561 + <string>The Default Workspace in this version of Xcode now includes support to hide and show the detail view (what has been referred to as the "Metro-Morph" feature). You must discard your current Default Workspace settings and update to the latest Default Workspace in order to gain this feature. Do you wish to update to the latest Workspace defaults for project '%@'?</string> 562 + <key>WindowJustification</key> 563 + <integer>5</integer> 564 + <key>WindowOrderList</key> 565 + <array> 566 + <string>/Volumes/Data/Users/bbum/bbum-developer-apple/objc-trunk/ffi/libffi/libffi.xcodeproj</string> 567 + </array> 568 + <key>WindowString</key> 569 + <string>109 64 931 814 0 0 1440 878 </string> 570 + <key>WindowToolsV3</key> 571 + <array> 572 + <dict> 573 + <key>FirstTimeWindowDisplayed</key> 574 + <false/> 575 + <key>Identifier</key> 576 + <string>windowTool.build</string> 577 + <key>IsVertical</key> 578 + <true/> 579 + <key>Layout</key> 580 + <array> 581 + <dict> 582 + <key>Dock</key> 583 + <array> 584 + <dict> 585 + <key>ContentConfiguration</key> 586 + <dict> 587 + <key>PBXProjectModuleGUID</key> 588 + <string>1CD0528F0623707200166675</string> 589 + <key>PBXProjectModuleLabel</key> 590 + <string></string> 591 + <key>StatusBarVisibility</key> 592 + <true/> 593 + </dict> 594 + <key>GeometryConfiguration</key> 595 + <dict> 596 + <key>Frame</key> 597 + <string>{{0, 0}, {1096, 313}}</string> 598 + <key>RubberWindowFrame</key> 599 + <string>202 158 1096 680 0 0 1440 878 </string> 600 + </dict> 601 + <key>Module</key> 602 + <string>PBXNavigatorGroup</string> 603 + <key>Proportion</key> 604 + <string>313pt</string> 605 + </dict> 606 + <dict> 607 + <key>BecomeActive</key> 608 + <true/> 609 + <key>ContentConfiguration</key> 610 + <dict> 611 + <key>PBXBuildLogShowsTranscriptDefaultKey</key> 612 + <string>{{0, 167}, {1096, 154}}</string> 613 + <key>PBXProjectModuleGUID</key> 614 + <string>XCMainBuildResultsModuleGUID</string> 615 + <key>PBXProjectModuleLabel</key> 616 + <string>Build</string> 617 + <key>XCBuildResultsTrigger_Collapse</key> 618 + <integer>1021</integer> 619 + <key>XCBuildResultsTrigger_Open</key> 620 + <integer>1011</integer> 621 + </dict> 622 + <key>GeometryConfiguration</key> 623 + <dict> 624 + <key>Frame</key> 625 + <string>{{0, 318}, {1096, 321}}</string> 626 + <key>RubberWindowFrame</key> 627 + <string>202 158 1096 680 0 0 1440 878 </string> 628 + </dict> 629 + <key>Module</key> 630 + <string>PBXBuildResultsModule</string> 631 + <key>Proportion</key> 632 + <string>321pt</string> 633 + </dict> 634 + </array> 635 + <key>Proportion</key> 636 + <string>639pt</string> 637 + </dict> 638 + </array> 639 + <key>Name</key> 640 + <string>Build Results</string> 641 + <key>ServiceClasses</key> 642 + <array> 643 + <string>PBXBuildResultsModule</string> 644 + </array> 645 + <key>StatusbarIsVisible</key> 646 + <true/> 647 + <key>TableOfContents</key> 648 + <array> 649 + <string>773256250E676B710068967B</string> 650 + <string>778346D50E8C36EF0090422B</string> 651 + <string>1CD0528F0623707200166675</string> 652 + <string>XCMainBuildResultsModuleGUID</string> 653 + </array> 654 + <key>ToolbarConfiguration</key> 655 + <string>xcode.toolbar.config.buildV3</string> 656 + <key>WindowString</key> 657 + <string>202 158 1096 680 0 0 1440 878 </string> 658 + <key>WindowToolGUID</key> 659 + <string>773256250E676B710068967B</string> 660 + <key>WindowToolIsVisible</key> 661 + <false/> 662 + </dict> 663 + <dict> 664 + <key>Identifier</key> 665 + <string>windowTool.debugger</string> 666 + <key>Layout</key> 667 + <array> 668 + <dict> 669 + <key>Dock</key> 670 + <array> 671 + <dict> 672 + <key>ContentConfiguration</key> 673 + <dict> 674 + <key>Debugger</key> 675 + <dict> 676 + <key>HorizontalSplitView</key> 677 + <dict> 678 + <key>_collapsingFrameDimension</key> 679 + <real>0.0</real> 680 + <key>_indexOfCollapsedView</key> 681 + <integer>0</integer> 682 + <key>_percentageOfCollapsedView</key> 683 + <real>0.0</real> 684 + <key>isCollapsed</key> 685 + <string>yes</string> 686 + <key>sizes</key> 687 + <array> 688 + <string>{{0, 0}, {317, 164}}</string> 689 + <string>{{317, 0}, {377, 164}}</string> 690 + </array> 691 + </dict> 692 + <key>VerticalSplitView</key> 693 + <dict> 694 + <key>_collapsingFrameDimension</key> 695 + <real>0.0</real> 696 + <key>_indexOfCollapsedView</key> 697 + <integer>0</integer> 698 + <key>_percentageOfCollapsedView</key> 699 + <real>0.0</real> 700 + <key>isCollapsed</key> 701 + <string>yes</string> 702 + <key>sizes</key> 703 + <array> 704 + <string>{{0, 0}, {694, 164}}</string> 705 + <string>{{0, 164}, {694, 216}}</string> 706 + </array> 707 + </dict> 708 + </dict> 709 + <key>LauncherConfigVersion</key> 710 + <string>8</string> 711 + <key>PBXProjectModuleGUID</key> 712 + <string>1C162984064C10D400B95A72</string> 713 + <key>PBXProjectModuleLabel</key> 714 + <string>Debug - GLUTExamples (Underwater)</string> 715 + </dict> 716 + <key>GeometryConfiguration</key> 717 + <dict> 718 + <key>DebugConsoleDrawerSize</key> 719 + <string>{100, 120}</string> 720 + <key>DebugConsoleVisible</key> 721 + <string>None</string> 722 + <key>DebugConsoleWindowFrame</key> 723 + <string>{{200, 200}, {500, 300}}</string> 724 + <key>DebugSTDIOWindowFrame</key> 725 + <string>{{200, 200}, {500, 300}}</string> 726 + <key>Frame</key> 727 + <string>{{0, 0}, {694, 380}}</string> 728 + <key>RubberWindowFrame</key> 729 + <string>321 238 694 422 0 0 1440 878 </string> 730 + </dict> 731 + <key>Module</key> 732 + <string>PBXDebugSessionModule</string> 733 + <key>Proportion</key> 734 + <string>100%</string> 735 + </dict> 736 + </array> 737 + <key>Proportion</key> 738 + <string>100%</string> 739 + </dict> 740 + </array> 741 + <key>Name</key> 742 + <string>Debugger</string> 743 + <key>ServiceClasses</key> 744 + <array> 745 + <string>PBXDebugSessionModule</string> 746 + </array> 747 + <key>StatusbarIsVisible</key> 748 + <integer>1</integer> 749 + <key>TableOfContents</key> 750 + <array> 751 + <string>1CD10A99069EF8BA00B06720</string> 752 + <string>1C0AD2AB069F1E9B00FABCE6</string> 753 + <string>1C162984064C10D400B95A72</string> 754 + <string>1C0AD2AC069F1E9B00FABCE6</string> 755 + </array> 756 + <key>ToolbarConfiguration</key> 757 + <string>xcode.toolbar.config.debugV3</string> 758 + <key>WindowString</key> 759 + <string>321 238 694 422 0 0 1440 878 </string> 760 + <key>WindowToolGUID</key> 761 + <string>1CD10A99069EF8BA00B06720</string> 762 + <key>WindowToolIsVisible</key> 763 + <integer>0</integer> 764 + </dict> 765 + <dict> 766 + <key>FirstTimeWindowDisplayed</key> 767 + <false/> 768 + <key>Identifier</key> 769 + <string>windowTool.find</string> 770 + <key>IsVertical</key> 771 + <true/> 772 + <key>Layout</key> 773 + <array> 774 + <dict> 775 + <key>Dock</key> 776 + <array> 777 + <dict> 778 + <key>Dock</key> 779 + <array> 780 + <dict> 781 + <key>BecomeActive</key> 782 + <true/> 783 + <key>ContentConfiguration</key> 784 + <dict> 785 + <key>PBXProjectModuleGUID</key> 786 + <string>1CDD528C0622207200134675</string> 787 + <key>PBXProjectModuleLabel</key> 788 + <string>x86-ffi_darwin.c</string> 789 + <key>StatusBarVisibility</key> 790 + <true/> 791 + </dict> 792 + <key>GeometryConfiguration</key> 793 + <dict> 794 + <key>Frame</key> 795 + <string>{{0, 0}, {951, 586}}</string> 796 + <key>RubberWindowFrame</key> 797 + <string>376 34 951 844 0 0 1440 878 </string> 798 + </dict> 799 + <key>Module</key> 800 + <string>PBXNavigatorGroup</string> 801 + <key>Proportion</key> 802 + <string>951pt</string> 803 + </dict> 804 + </array> 805 + <key>Proportion</key> 806 + <string>586pt</string> 807 + </dict> 808 + <dict> 809 + <key>ContentConfiguration</key> 810 + <dict> 811 + <key>PBXProjectModuleGUID</key> 812 + <string>1CD0528E0623707200166675</string> 813 + <key>PBXProjectModuleLabel</key> 814 + <string>Project Find</string> 815 + </dict> 816 + <key>GeometryConfiguration</key> 817 + <dict> 818 + <key>Frame</key> 819 + <string>{{0, 591}, {951, 212}}</string> 820 + <key>RubberWindowFrame</key> 821 + <string>376 34 951 844 0 0 1440 878 </string> 822 + </dict> 823 + <key>Module</key> 824 + <string>PBXProjectFindModule</string> 825 + <key>Proportion</key> 826 + <string>212pt</string> 827 + </dict> 828 + </array> 829 + <key>Proportion</key> 830 + <string>803pt</string> 831 + </dict> 832 + </array> 833 + <key>Name</key> 834 + <string>Project Find</string> 835 + <key>ServiceClasses</key> 836 + <array> 837 + <string>PBXProjectFindModule</string> 838 + </array> 839 + <key>StatusbarIsVisible</key> 840 + <true/> 841 + <key>TableOfContents</key> 842 + <array> 843 + <string>1C530D57069F1CE1000CFCEE</string> 844 + <string>77AFBF280EC22F2E00AB26E6</string> 845 + <string>77AFBF290EC22F2E00AB26E6</string> 846 + <string>1CDD528C0622207200134675</string> 847 + <string>1CD0528E0623707200166675</string> 848 + </array> 849 + <key>WindowString</key> 850 + <string>376 34 951 844 0 0 1440 878 </string> 851 + <key>WindowToolGUID</key> 852 + <string>1C530D57069F1CE1000CFCEE</string> 853 + <key>WindowToolIsVisible</key> 854 + <false/> 855 + </dict> 856 + <dict> 857 + <key>Identifier</key> 858 + <string>MENUSEPARATOR</string> 859 + </dict> 860 + <dict> 861 + <key>Identifier</key> 862 + <string>windowTool.debuggerConsole</string> 863 + <key>Layout</key> 864 + <array> 865 + <dict> 866 + <key>Dock</key> 867 + <array> 868 + <dict> 869 + <key>BecomeActive</key> 870 + <integer>1</integer> 871 + <key>ContentConfiguration</key> 872 + <dict> 873 + <key>PBXProjectModuleGUID</key> 874 + <string>1C78EAAC065D492600B07095</string> 875 + <key>PBXProjectModuleLabel</key> 876 + <string>Debugger Console</string> 877 + </dict> 878 + <key>GeometryConfiguration</key> 879 + <dict> 880 + <key>Frame</key> 881 + <string>{{0, 0}, {650, 250}}</string> 882 + <key>RubberWindowFrame</key> 883 + <string>516 632 650 250 0 0 1680 1027 </string> 884 + </dict> 885 + <key>Module</key> 886 + <string>PBXDebugCLIModule</string> 887 + <key>Proportion</key> 888 + <string>209pt</string> 889 + </dict> 890 + </array> 891 + <key>Proportion</key> 892 + <string>209pt</string> 893 + </dict> 894 + </array> 895 + <key>Name</key> 896 + <string>Debugger Console</string> 897 + <key>ServiceClasses</key> 898 + <array> 899 + <string>PBXDebugCLIModule</string> 900 + </array> 901 + <key>StatusbarIsVisible</key> 902 + <integer>1</integer> 903 + <key>TableOfContents</key> 904 + <array> 905 + <string>1C78EAAD065D492600B07095</string> 906 + <string>1C78EAAE065D492600B07095</string> 907 + <string>1C78EAAC065D492600B07095</string> 908 + </array> 909 + <key>ToolbarConfiguration</key> 910 + <string>xcode.toolbar.config.consoleV3</string> 911 + <key>WindowString</key> 912 + <string>650 41 650 250 0 0 1280 1002 </string> 913 + <key>WindowToolGUID</key> 914 + <string>1C78EAAD065D492600B07095</string> 915 + <key>WindowToolIsVisible</key> 916 + <integer>0</integer> 917 + </dict> 918 + <dict> 919 + <key>Identifier</key> 920 + <string>windowTool.snapshots</string> 921 + <key>Layout</key> 922 + <array> 923 + <dict> 924 + <key>Dock</key> 925 + <array> 926 + <dict> 927 + <key>Module</key> 928 + <string>XCSnapshotModule</string> 929 + <key>Proportion</key> 930 + <string>100%</string> 931 + </dict> 932 + </array> 933 + <key>Proportion</key> 934 + <string>100%</string> 935 + </dict> 936 + </array> 937 + <key>Name</key> 938 + <string>Snapshots</string> 939 + <key>ServiceClasses</key> 940 + <array> 941 + <string>XCSnapshotModule</string> 942 + </array> 943 + <key>StatusbarIsVisible</key> 944 + <string>Yes</string> 945 + <key>ToolbarConfiguration</key> 946 + <string>xcode.toolbar.config.snapshots</string> 947 + <key>WindowString</key> 948 + <string>315 824 300 550 0 0 1440 878 </string> 949 + <key>WindowToolIsVisible</key> 950 + <string>Yes</string> 951 + </dict> 952 + <dict> 953 + <key>FirstTimeWindowDisplayed</key> 954 + <false/> 955 + <key>Identifier</key> 956 + <string>windowTool.scm</string> 957 + <key>IsVertical</key> 958 + <true/> 959 + <key>Layout</key> 960 + <array> 961 + <dict> 962 + <key>Dock</key> 963 + <array> 964 + <dict> 965 + <key>ContentConfiguration</key> 966 + <dict> 967 + <key>PBXProjectModuleGUID</key> 968 + <string>1C78EAB2065D492600B07095</string> 969 + <key>PBXProjectModuleLabel</key> 970 + <string></string> 971 + <key>StatusBarVisibility</key> 972 + <true/> 973 + </dict> 974 + <key>GeometryConfiguration</key> 975 + <dict> 976 + <key>Frame</key> 977 + <string>{{0, 0}, {452, 0}}</string> 978 + <key>RubberWindowFrame</key> 979 + <string>322 532 452 308 0 0 1440 878 </string> 980 + </dict> 981 + <key>Module</key> 982 + <string>PBXNavigatorGroup</string> 983 + <key>Proportion</key> 984 + <string>0pt</string> 985 + </dict> 986 + <dict> 987 + <key>BecomeActive</key> 988 + <true/> 989 + <key>ContentConfiguration</key> 990 + <dict> 991 + <key>PBXCVSModuleFilterTypeKey</key> 992 + <integer>1032</integer> 993 + <key>PBXCVSModuleTreeModuleColumnData</key> 994 + <dict> 995 + <key>PBXCVSModuleTreeModuleColumnWidthsKey</key> 996 + <array> 997 + <real>200</real> 998 + <real>56.66162109375</real> 999 + <real>63</real> 1000 + <real>60</real> 1001 + <real>63</real> 1002 + <real>139.556640625</real> 1003 + </array> 1004 + <key>PBXCVSModuleTreeModuleColumnsKey</key> 1005 + <array> 1006 + <string>Name</string> 1007 + <string>Status</string> 1008 + <string>Update</string> 1009 + <string>Revision</string> 1010 + <string>Author</string> 1011 + <string>Date</string> 1012 + </array> 1013 + </dict> 1014 + <key>PBXProjectModuleGUID</key> 1015 + <string>1CD052920623707200166675</string> 1016 + <key>PBXProjectModuleLabel</key> 1017 + <string>SCM Results</string> 1018 + </dict> 1019 + <key>GeometryConfiguration</key> 1020 + <dict> 1021 + <key>Frame</key> 1022 + <string>{{0, 5}, {452, 262}}</string> 1023 + <key>RubberWindowFrame</key> 1024 + <string>322 532 452 308 0 0 1440 878 </string> 1025 + </dict> 1026 + <key>Module</key> 1027 + <string>PBXCVSModule</string> 1028 + <key>Proportion</key> 1029 + <string>262pt</string> 1030 + </dict> 1031 + </array> 1032 + <key>Proportion</key> 1033 + <string>267pt</string> 1034 + </dict> 1035 + </array> 1036 + <key>Name</key> 1037 + <string>SCM</string> 1038 + <key>ServiceClasses</key> 1039 + <array> 1040 + <string>PBXCVSModule</string> 1041 + </array> 1042 + <key>StatusbarIsVisible</key> 1043 + <true/> 1044 + <key>TableOfContents</key> 1045 + <array> 1046 + <string>77C6B7CD0E68727900F73F79</string> 1047 + <string>77C6B7CE0E68727900F73F79</string> 1048 + <string>1C78EAB2065D492600B07095</string> 1049 + <string>1CD052920623707200166675</string> 1050 + </array> 1051 + <key>ToolbarConfiguration</key> 1052 + <string>xcode.toolbar.config.scm</string> 1053 + <key>WindowString</key> 1054 + <string>322 532 452 308 0 0 1440 878 </string> 1055 + <key>WindowToolGUID</key> 1056 + <string>77C6B7CD0E68727900F73F79</string> 1057 + <key>WindowToolIsVisible</key> 1058 + <false/> 1059 + </dict> 1060 + <dict> 1061 + <key>Identifier</key> 1062 + <string>windowTool.breakpoints</string> 1063 + <key>IsVertical</key> 1064 + <integer>0</integer> 1065 + <key>Layout</key> 1066 + <array> 1067 + <dict> 1068 + <key>Dock</key> 1069 + <array> 1070 + <dict> 1071 + <key>BecomeActive</key> 1072 + <integer>1</integer> 1073 + <key>ContentConfiguration</key> 1074 + <dict> 1075 + <key>PBXBottomSmartGroupGIDs</key> 1076 + <array> 1077 + <string>1C77FABC04509CD000000102</string> 1078 + </array> 1079 + <key>PBXProjectModuleGUID</key> 1080 + <string>1CE0B1FE06471DED0097A5F4</string> 1081 + <key>PBXProjectModuleLabel</key> 1082 + <string>Files</string> 1083 + <key>PBXProjectStructureProvided</key> 1084 + <string>no</string> 1085 + <key>PBXSmartGroupTreeModuleColumnData</key> 1086 + <dict> 1087 + <key>PBXSmartGroupTreeModuleColumnWidthsKey</key> 1088 + <array> 1089 + <real>168</real> 1090 + </array> 1091 + <key>PBXSmartGroupTreeModuleColumnsKey_v4</key> 1092 + <array> 1093 + <string>MainColumn</string> 1094 + </array> 1095 + </dict> 1096 + <key>PBXSmartGroupTreeModuleOutlineStateKey_v7</key> 1097 + <dict> 1098 + <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key> 1099 + <array> 1100 + <string>1C77FABC04509CD000000102</string> 1101 + </array> 1102 + <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> 1103 + <array> 1104 + <array> 1105 + <integer>0</integer> 1106 + </array> 1107 + </array> 1108 + <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> 1109 + <string>{{0, 0}, {168, 350}}</string> 1110 + </dict> 1111 + <key>PBXTopSmartGroupGIDs</key> 1112 + <array/> 1113 + <key>XCIncludePerspectivesSwitch</key> 1114 + <integer>0</integer> 1115 + </dict> 1116 + <key>GeometryConfiguration</key> 1117 + <dict> 1118 + <key>Frame</key> 1119 + <string>{{0, 0}, {185, 368}}</string> 1120 + <key>GroupTreeTableConfiguration</key> 1121 + <array> 1122 + <string>MainColumn</string> 1123 + <real>168</real> 1124 + </array> 1125 + <key>RubberWindowFrame</key> 1126 + <string>315 424 744 409 0 0 1440 878 </string> 1127 + </dict> 1128 + <key>Module</key> 1129 + <string>PBXSmartGroupTreeModule</string> 1130 + <key>Proportion</key> 1131 + <string>185pt</string> 1132 + </dict> 1133 + <dict> 1134 + <key>ContentConfiguration</key> 1135 + <dict> 1136 + <key>PBXProjectModuleGUID</key> 1137 + <string>1CA1AED706398EBD00589147</string> 1138 + <key>PBXProjectModuleLabel</key> 1139 + <string>Detail</string> 1140 + </dict> 1141 + <key>GeometryConfiguration</key> 1142 + <dict> 1143 + <key>Frame</key> 1144 + <string>{{190, 0}, {554, 368}}</string> 1145 + <key>RubberWindowFrame</key> 1146 + <string>315 424 744 409 0 0 1440 878 </string> 1147 + </dict> 1148 + <key>Module</key> 1149 + <string>XCDetailModule</string> 1150 + <key>Proportion</key> 1151 + <string>554pt</string> 1152 + </dict> 1153 + </array> 1154 + <key>Proportion</key> 1155 + <string>368pt</string> 1156 + </dict> 1157 + </array> 1158 + <key>MajorVersion</key> 1159 + <integer>3</integer> 1160 + <key>MinorVersion</key> 1161 + <integer>0</integer> 1162 + <key>Name</key> 1163 + <string>Breakpoints</string> 1164 + <key>ServiceClasses</key> 1165 + <array> 1166 + <string>PBXSmartGroupTreeModule</string> 1167 + <string>XCDetailModule</string> 1168 + </array> 1169 + <key>StatusbarIsVisible</key> 1170 + <integer>1</integer> 1171 + <key>TableOfContents</key> 1172 + <array> 1173 + <string>1CDDB66807F98D9800BB5817</string> 1174 + <string>1CDDB66907F98D9800BB5817</string> 1175 + <string>1CE0B1FE06471DED0097A5F4</string> 1176 + <string>1CA1AED706398EBD00589147</string> 1177 + </array> 1178 + <key>ToolbarConfiguration</key> 1179 + <string>xcode.toolbar.config.breakpointsV3</string> 1180 + <key>WindowString</key> 1181 + <string>315 424 744 409 0 0 1440 878 </string> 1182 + <key>WindowToolGUID</key> 1183 + <string>1CDDB66807F98D9800BB5817</string> 1184 + <key>WindowToolIsVisible</key> 1185 + <integer>1</integer> 1186 + </dict> 1187 + <dict> 1188 + <key>Identifier</key> 1189 + <string>windowTool.debugAnimator</string> 1190 + <key>Layout</key> 1191 + <array> 1192 + <dict> 1193 + <key>Dock</key> 1194 + <array> 1195 + <dict> 1196 + <key>Module</key> 1197 + <string>PBXNavigatorGroup</string> 1198 + <key>Proportion</key> 1199 + <string>100%</string> 1200 + </dict> 1201 + </array> 1202 + <key>Proportion</key> 1203 + <string>100%</string> 1204 + </dict> 1205 + </array> 1206 + <key>Name</key> 1207 + <string>Debug Visualizer</string> 1208 + <key>ServiceClasses</key> 1209 + <array> 1210 + <string>PBXNavigatorGroup</string> 1211 + </array> 1212 + <key>StatusbarIsVisible</key> 1213 + <integer>1</integer> 1214 + <key>ToolbarConfiguration</key> 1215 + <string>xcode.toolbar.config.debugAnimatorV3</string> 1216 + <key>WindowString</key> 1217 + <string>100 100 700 500 0 0 1280 1002 </string> 1218 + </dict> 1219 + <dict> 1220 + <key>Identifier</key> 1221 + <string>windowTool.bookmarks</string> 1222 + <key>Layout</key> 1223 + <array> 1224 + <dict> 1225 + <key>Dock</key> 1226 + <array> 1227 + <dict> 1228 + <key>Module</key> 1229 + <string>PBXBookmarksModule</string> 1230 + <key>Proportion</key> 1231 + <string>100%</string> 1232 + </dict> 1233 + </array> 1234 + <key>Proportion</key> 1235 + <string>100%</string> 1236 + </dict> 1237 + </array> 1238 + <key>Name</key> 1239 + <string>Bookmarks</string> 1240 + <key>ServiceClasses</key> 1241 + <array> 1242 + <string>PBXBookmarksModule</string> 1243 + </array> 1244 + <key>StatusbarIsVisible</key> 1245 + <integer>0</integer> 1246 + <key>WindowString</key> 1247 + <string>538 42 401 187 0 0 1280 1002 </string> 1248 + </dict> 1249 + <dict> 1250 + <key>Identifier</key> 1251 + <string>windowTool.projectFormatConflicts</string> 1252 + <key>Layout</key> 1253 + <array> 1254 + <dict> 1255 + <key>Dock</key> 1256 + <array> 1257 + <dict> 1258 + <key>Module</key> 1259 + <string>XCProjectFormatConflictsModule</string> 1260 + <key>Proportion</key> 1261 + <string>100%</string> 1262 + </dict> 1263 + </array> 1264 + <key>Proportion</key> 1265 + <string>100%</string> 1266 + </dict> 1267 + </array> 1268 + <key>Name</key> 1269 + <string>Project Format Conflicts</string> 1270 + <key>ServiceClasses</key> 1271 + <array> 1272 + <string>XCProjectFormatConflictsModule</string> 1273 + </array> 1274 + <key>StatusbarIsVisible</key> 1275 + <integer>0</integer> 1276 + <key>WindowContentMinSize</key> 1277 + <string>450 300</string> 1278 + <key>WindowString</key> 1279 + <string>50 850 472 307 0 0 1440 877</string> 1280 + </dict> 1281 + <dict> 1282 + <key>Identifier</key> 1283 + <string>windowTool.classBrowser</string> 1284 + <key>Layout</key> 1285 + <array> 1286 + <dict> 1287 + <key>Dock</key> 1288 + <array> 1289 + <dict> 1290 + <key>BecomeActive</key> 1291 + <integer>1</integer> 1292 + <key>ContentConfiguration</key> 1293 + <dict> 1294 + <key>OptionsSetName</key> 1295 + <string>Hierarchy, all classes</string> 1296 + <key>PBXProjectModuleGUID</key> 1297 + <string>1CA6456E063B45B4001379D8</string> 1298 + <key>PBXProjectModuleLabel</key> 1299 + <string>Class Browser - NSObject</string> 1300 + </dict> 1301 + <key>GeometryConfiguration</key> 1302 + <dict> 1303 + <key>ClassesFrame</key> 1304 + <string>{{0, 0}, {374, 96}}</string> 1305 + <key>ClassesTreeTableConfiguration</key> 1306 + <array> 1307 + <string>PBXClassNameColumnIdentifier</string> 1308 + <real>208</real> 1309 + <string>PBXClassBookColumnIdentifier</string> 1310 + <real>22</real> 1311 + </array> 1312 + <key>Frame</key> 1313 + <string>{{0, 0}, {630, 331}}</string> 1314 + <key>MembersFrame</key> 1315 + <string>{{0, 105}, {374, 395}}</string> 1316 + <key>MembersTreeTableConfiguration</key> 1317 + <array> 1318 + <string>PBXMemberTypeIconColumnIdentifier</string> 1319 + <real>22</real> 1320 + <string>PBXMemberNameColumnIdentifier</string> 1321 + <real>216</real> 1322 + <string>PBXMemberTypeColumnIdentifier</string> 1323 + <real>97</real> 1324 + <string>PBXMemberBookColumnIdentifier</string> 1325 + <real>22</real> 1326 + </array> 1327 + <key>PBXModuleWindowStatusBarHidden2</key> 1328 + <integer>1</integer> 1329 + <key>RubberWindowFrame</key> 1330 + <string>385 179 630 352 0 0 1440 878 </string> 1331 + </dict> 1332 + <key>Module</key> 1333 + <string>PBXClassBrowserModule</string> 1334 + <key>Proportion</key> 1335 + <string>332pt</string> 1336 + </dict> 1337 + </array> 1338 + <key>Proportion</key> 1339 + <string>332pt</string> 1340 + </dict> 1341 + </array> 1342 + <key>Name</key> 1343 + <string>Class Browser</string> 1344 + <key>ServiceClasses</key> 1345 + <array> 1346 + <string>PBXClassBrowserModule</string> 1347 + </array> 1348 + <key>StatusbarIsVisible</key> 1349 + <integer>0</integer> 1350 + <key>TableOfContents</key> 1351 + <array> 1352 + <string>1C0AD2AF069F1E9B00FABCE6</string> 1353 + <string>1C0AD2B0069F1E9B00FABCE6</string> 1354 + <string>1CA6456E063B45B4001379D8</string> 1355 + </array> 1356 + <key>ToolbarConfiguration</key> 1357 + <string>xcode.toolbar.config.classbrowser</string> 1358 + <key>WindowString</key> 1359 + <string>385 179 630 352 0 0 1440 878 </string> 1360 + <key>WindowToolGUID</key> 1361 + <string>1C0AD2AF069F1E9B00FABCE6</string> 1362 + <key>WindowToolIsVisible</key> 1363 + <integer>0</integer> 1364 + </dict> 1365 + <dict> 1366 + <key>Identifier</key> 1367 + <string>windowTool.refactoring</string> 1368 + <key>IncludeInToolsMenu</key> 1369 + <integer>0</integer> 1370 + <key>Layout</key> 1371 + <array> 1372 + <dict> 1373 + <key>Dock</key> 1374 + <array> 1375 + <dict> 1376 + <key>BecomeActive</key> 1377 + <integer>1</integer> 1378 + <key>GeometryConfiguration</key> 1379 + <dict> 1380 + <key>Frame</key> 1381 + <string>{0, 0}, {500, 335}</string> 1382 + <key>RubberWindowFrame</key> 1383 + <string>{0, 0}, {500, 335}</string> 1384 + </dict> 1385 + <key>Module</key> 1386 + <string>XCRefactoringModule</string> 1387 + <key>Proportion</key> 1388 + <string>100%</string> 1389 + </dict> 1390 + </array> 1391 + <key>Proportion</key> 1392 + <string>100%</string> 1393 + </dict> 1394 + </array> 1395 + <key>Name</key> 1396 + <string>Refactoring</string> 1397 + <key>ServiceClasses</key> 1398 + <array> 1399 + <string>XCRefactoringModule</string> 1400 + </array> 1401 + <key>WindowString</key> 1402 + <string>200 200 500 356 0 0 1920 1200 </string> 1403 + </dict> 1404 + </array> 1405 + </dict> 1406 + </plist>
+549
src/libffi/libffi.xcodeproj/bbum.pbxuser
··· 1 + // !$*UTF8*$! 2 + { 3 + 08FB7793FE84155DC02AAC07 /* Project object */ = { 4 + activeArchitecturePreference = ppc; 5 + activeBuildConfigurationName = Release; 6 + activeTarget = 259F43220C28CBD700537400 /* libffi */; 7 + codeSenseManager = 770E5CF00E4D12A200979D3A /* Code sense */; 8 + perUserDictionary = { 9 + PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { 10 + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; 11 + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; 12 + PBXFileTableDataSourceColumnWidthsKey = ( 13 + 20, 14 + 484, 15 + 20, 16 + 48, 17 + 43, 18 + 43, 19 + 20, 20 + ); 21 + PBXFileTableDataSourceColumnsKey = ( 22 + PBXFileDataSource_FiletypeID, 23 + PBXFileDataSource_Filename_ColumnID, 24 + PBXFileDataSource_Built_ColumnID, 25 + PBXFileDataSource_ObjectSize_ColumnID, 26 + PBXFileDataSource_Errors_ColumnID, 27 + PBXFileDataSource_Warnings_ColumnID, 28 + PBXFileDataSource_Target_ColumnID, 29 + ); 30 + }; 31 + PBXConfiguration.PBXFileTableDataSource3.XCSCMDataSource = { 32 + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; 33 + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; 34 + PBXFileTableDataSourceColumnWidthsKey = ( 35 + 20, 36 + 20, 37 + 436, 38 + 20, 39 + 48.16259765625, 40 + 43, 41 + 43, 42 + 20, 43 + ); 44 + PBXFileTableDataSourceColumnsKey = ( 45 + PBXFileDataSource_SCM_ColumnID, 46 + PBXFileDataSource_FiletypeID, 47 + PBXFileDataSource_Filename_ColumnID, 48 + PBXFileDataSource_Built_ColumnID, 49 + PBXFileDataSource_ObjectSize_ColumnID, 50 + PBXFileDataSource_Errors_ColumnID, 51 + PBXFileDataSource_Warnings_ColumnID, 52 + PBXFileDataSource_Target_ColumnID, 53 + ); 54 + }; 55 + PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = { 56 + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; 57 + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; 58 + PBXFileTableDataSourceColumnWidthsKey = ( 59 + 20, 60 + 444, 61 + 60, 62 + 20, 63 + 48, 64 + 43, 65 + 43, 66 + ); 67 + PBXFileTableDataSourceColumnsKey = ( 68 + PBXFileDataSource_FiletypeID, 69 + PBXFileDataSource_Filename_ColumnID, 70 + PBXTargetDataSource_PrimaryAttribute, 71 + PBXFileDataSource_Built_ColumnID, 72 + PBXFileDataSource_ObjectSize_ColumnID, 73 + PBXFileDataSource_Errors_ColumnID, 74 + PBXFileDataSource_Warnings_ColumnID, 75 + ); 76 + }; 77 + PBXPerProjectTemplateStateSaveDate = 250216065; 78 + PBXWorkspaceStateSaveDate = 250216065; 79 + }; 80 + perUserProjectItems = { 81 + 773256280E676B810068967B /* PBXTextBookmark */ = 773256280E676B810068967B /* PBXTextBookmark */; 82 + 7732562E0E676B810068967B /* PBXTextBookmark */ = 7732562E0E676B810068967B /* PBXTextBookmark */; 83 + 7732562F0E676B810068967B /* PBXTextBookmark */ = 7732562F0E676B810068967B /* PBXTextBookmark */; 84 + 773256370E676B9E0068967B /* PBXTextBookmark */ = 773256370E676B9E0068967B /* PBXTextBookmark */; 85 + 7732563B0E676B9E0068967B /* PBXTextBookmark */ = 7732563B0E676B9E0068967B /* PBXTextBookmark */; 86 + 7732563C0E676B9E0068967B /* PBXTextBookmark */ = 7732563C0E676B9E0068967B /* PBXTextBookmark */; 87 + 773256750E67711F0068967B /* PBXTextBookmark */ = 773256750E67711F0068967B /* PBXTextBookmark */; 88 + 7732567C0E67711F0068967B /* PBXTextBookmark */ = 7732567C0E67711F0068967B /* PBXTextBookmark */; 89 + 773256850E6771900068967B /* PBXTextBookmark */ = 773256850E6771900068967B /* PBXTextBookmark */; 90 + 7759A70F0EC223A300D5A4CA /* PBXTextBookmark */ = 7759A70F0EC223A300D5A4CA /* PBXTextBookmark */; 91 + 778346E20E8C39130090422B /* PBXTextBookmark */ = 778346E20E8C39130090422B /* PBXTextBookmark */; 92 + 778347150E8C3E9D0090422B /* PBXTextBookmark */ = 778347150E8C3E9D0090422B /* PBXTextBookmark */; 93 + 778347170E8C3E9D0090422B /* PBXTextBookmark */ = 778347170E8C3E9D0090422B /* PBXTextBookmark */; 94 + 7783471A0E8C3E9D0090422B /* PBXTextBookmark */ = 7783471A0E8C3E9D0090422B /* PBXTextBookmark */; 95 + 77AFBF2A0EC22FDE00AB26E6 /* PBXTextBookmark */ = 77AFBF2A0EC22FDE00AB26E6 /* PBXTextBookmark */; 96 + 77AFBF2B0EC22FDE00AB26E6 /* PBXTextBookmark */ = 77AFBF2B0EC22FDE00AB26E6 /* PBXTextBookmark */; 97 + 77AFBF2E0EC22FDE00AB26E6 /* PBXTextBookmark */ = 77AFBF2E0EC22FDE00AB26E6 /* PBXTextBookmark */; 98 + 77AFBF320EC22FDE00AB26E6 /* PBXTextBookmark */ = 77AFBF320EC22FDE00AB26E6 /* PBXTextBookmark */; 99 + 77AFBF390EC2508200AB26E6 /* PBXTextBookmark */ = 77AFBF390EC2508200AB26E6 /* PBXTextBookmark */; 100 + 77B8934E0EE9FE9E00BDB2A0 /* PBXTextBookmark */ = 77B8934E0EE9FE9E00BDB2A0 /* PBXTextBookmark */; 101 + 77C6B7D40E68807300F73F79 /* PBXTextBookmark */ = 77C6B7D40E68807300F73F79 /* PBXTextBookmark */; 102 + 77C6B7D80E68807300F73F79 /* PBXTextBookmark */ = 77C6B7D80E68807300F73F79 /* PBXTextBookmark */; 103 + 77C6B7F00E68816E00F73F79 /* PBXTextBookmark */ = 77C6B7F00E68816E00F73F79 /* PBXTextBookmark */; 104 + 77C6B7F10E68816E00F73F79 /* PBXTextBookmark */ = 77C6B7F10E68816E00F73F79 /* PBXTextBookmark */; 105 + 77C6B7F40E68816E00F73F79 /* PBXTextBookmark */ = 77C6B7F40E68816E00F73F79 /* PBXTextBookmark */; 106 + 77C6B7F50E68816E00F73F79 /* PBXTextBookmark */ = 77C6B7F50E68816E00F73F79 /* PBXTextBookmark */; 107 + 77C6B8010E6883AD00F73F79 /* PBXTextBookmark */ = 77C6B8010E6883AD00F73F79 /* PBXTextBookmark */; 108 + 77C6B8050E6883AD00F73F79 /* PBXTextBookmark */ = 77C6B8050E6883AD00F73F79 /* PBXTextBookmark */; 109 + 77C6B87D0E68BA4E00F73F79 /* PBXTextBookmark */ = 77C6B87D0E68BA4E00F73F79 /* PBXTextBookmark */; 110 + 77C6B87F0E68BA4E00F73F79 /* PBXTextBookmark */ = 77C6B87F0E68BA4E00F73F79 /* PBXTextBookmark */; 111 + }; 112 + sourceControlManager = 770E5CEF0E4D12A200979D3A /* Source Control */; 113 + userBuildSettings = { 114 + }; 115 + }; 116 + 25358B780C18D7AF00537400 /* ppc64-darwin_closure.S */ = { 117 + uiCtxt = { 118 + sepNavIntBoundsRect = "{{0, 0}, {890, 5446}}"; 119 + sepNavSelRange = "{7045, 6}"; 120 + sepNavVisRange = "{6658, 1233}"; 121 + }; 122 + }; 123 + 2575F8BB0C6BDD0500B6D9A2 /* ffi.3 */ = { 124 + uiCtxt = { 125 + sepNavIntBoundsRect = "{{0, 0}, {638, 574}}"; 126 + sepNavSelRange = "{0, 0}"; 127 + sepNavVisRange = "{0, 638}"; 128 + }; 129 + }; 130 + 259F43220C28CBD700537400 /* libffi */ = { 131 + activeExec = 0; 132 + }; 133 + 25A25CCE0C0F6B6100532060 /* ppc-darwin.h */ = { 134 + uiCtxt = { 135 + sepNavIntBoundsRect = "{{0, 0}, {638, 1106}}"; 136 + sepNavSelRange = "{0, 0}"; 137 + sepNavVisRange = "{0, 1604}"; 138 + }; 139 + }; 140 + 4D615B6C0B84B5160064908B /* darwin64.S */ = { 141 + uiCtxt = { 142 + sepNavIntBoundsRect = "{{0, 0}, {662, 5516}}"; 143 + sepNavSelRange = "{0, 0}"; 144 + sepNavVisRange = "{0, 1825}"; 145 + }; 146 + }; 147 + 4D615B6D0B84B5160064908B /* x86-ffi64.c */ = { 148 + uiCtxt = { 149 + sepNavIntBoundsRect = "{{0, 0}, {662, 8540}}"; 150 + sepNavSelRange = "{0, 0}"; 151 + sepNavVisRange = "{0, 1678}"; 152 + }; 153 + }; 154 + 770E5CEF0E4D12A200979D3A /* Source Control */ = { 155 + isa = PBXSourceControlManager; 156 + fallbackIsa = XCSourceControlManager; 157 + isSCMEnabled = 0; 158 + repositoryNamesForRoots = { 159 + "" = src.apple.com; 160 + }; 161 + scmConfiguration = { 162 + repositoryNamesForRoots = { 163 + "" = src.apple.com; 164 + }; 165 + }; 166 + }; 167 + 770E5CF00E4D12A200979D3A /* Code sense */ = { 168 + isa = PBXCodeSenseManager; 169 + indexTemplatePath = ""; 170 + }; 171 + 773256280E676B810068967B /* PBXTextBookmark */ = { 172 + isa = PBXTextBookmark; 173 + fRef = 25A25CCE0C0F6B6100532060 /* ppc-darwin.h */; 174 + name = "ppc-darwin.h: 1"; 175 + rLen = 0; 176 + rLoc = 0; 177 + rType = 0; 178 + vrLen = 1604; 179 + vrLoc = 0; 180 + }; 181 + 7732562E0E676B810068967B /* PBXTextBookmark */ = { 182 + isa = PBXTextBookmark; 183 + fRef = 25A25CCE0C0F6B6100532060 /* ppc-darwin.h */; 184 + name = "ppc-darwin.h: 1"; 185 + rLen = 0; 186 + rLoc = 0; 187 + rType = 0; 188 + vrLen = 1604; 189 + vrLoc = 0; 190 + }; 191 + 7732562F0E676B810068967B /* PBXTextBookmark */ = { 192 + isa = PBXTextBookmark; 193 + fRef = 774A687E0AB08B6D00FBC511 /* ppc-ffi_darwin.c */; 194 + name = "ppc-ffi_darwin.c: 1"; 195 + rLen = 0; 196 + rLoc = 0; 197 + rType = 0; 198 + vrLen = 1507; 199 + vrLoc = 0; 200 + }; 201 + 773256370E676B9E0068967B /* PBXTextBookmark */ = { 202 + isa = PBXTextBookmark; 203 + fRef = 2575F8BB0C6BDD0500B6D9A2 /* ffi.3 */; 204 + name = "ffi.3: 1"; 205 + rLen = 0; 206 + rLoc = 0; 207 + rType = 0; 208 + vrLen = 638; 209 + vrLoc = 0; 210 + }; 211 + 7732563B0E676B9E0068967B /* PBXTextBookmark */ = { 212 + isa = PBXTextBookmark; 213 + fRef = 2575F8BB0C6BDD0500B6D9A2 /* ffi.3 */; 214 + name = "ffi.3: 1"; 215 + rLen = 0; 216 + rLoc = 0; 217 + rType = 0; 218 + vrLen = 638; 219 + vrLoc = 0; 220 + }; 221 + 7732563C0E676B9E0068967B /* PBXTextBookmark */ = { 222 + isa = PBXTextBookmark; 223 + fRef = 4D615B6D0B84B5160064908B /* x86-ffi64.c */; 224 + name = "x86-ffi64.c: 1"; 225 + rLen = 0; 226 + rLoc = 0; 227 + rType = 0; 228 + vrLen = 1442; 229 + vrLoc = 0; 230 + }; 231 + 773256750E67711F0068967B /* PBXTextBookmark */ = { 232 + isa = PBXTextBookmark; 233 + fRef = 774A688E0AB08B7A00FBC511 /* x86-ffitarget.h */; 234 + name = "x86-ffitarget.h: 78"; 235 + rLen = 11; 236 + rLoc = 2445; 237 + rType = 0; 238 + vrLen = 1530; 239 + vrLoc = 0; 240 + }; 241 + 7732567C0E67711F0068967B /* PBXTextBookmark */ = { 242 + isa = PBXTextBookmark; 243 + fRef = 774A688E0AB08B7A00FBC511 /* x86-ffitarget.h */; 244 + name = "x86-ffitarget.h: 78"; 245 + rLen = 11; 246 + rLoc = 2445; 247 + rType = 0; 248 + vrLen = 1530; 249 + vrLoc = 0; 250 + }; 251 + 773256850E6771900068967B /* PBXTextBookmark */ = { 252 + isa = PBXTextBookmark; 253 + fRef = 774A689C0AB08BEB00FBC511 /* fficonfig.h */; 254 + name = "fficonfig.h: 1"; 255 + rLen = 0; 256 + rLoc = 0; 257 + rType = 0; 258 + vrLen = 831; 259 + vrLoc = 0; 260 + }; 261 + 774A68770AB08B5000FBC511 /* types.c */ = { 262 + uiCtxt = { 263 + sepNavIntBoundsRect = "{{0, 0}, {662, 1470}}"; 264 + sepNavSelRange = "{0, 0}"; 265 + sepNavVisRange = "{0, 2097}"; 266 + }; 267 + }; 268 + 774A687B0AB08B6D00FBC511 /* ppc-darwin.S */ = { 269 + uiCtxt = { 270 + sepNavIntBoundsRect = "{{0, 0}, {890, 5432}}"; 271 + sepNavSelRange = "{8048, 9}"; 272 + sepNavVisRange = "{7157, 1091}"; 273 + }; 274 + }; 275 + 774A687C0AB08B6D00FBC511 /* ppc-darwin_closure.S */ = { 276 + uiCtxt = { 277 + sepNavIntBoundsRect = "{{0, 0}, {662, 4606}}"; 278 + sepNavSelRange = "{6028, 9}"; 279 + sepNavVisRange = "{5390, 1330}"; 280 + }; 281 + }; 282 + 774A687E0AB08B6D00FBC511 /* ppc-ffi_darwin.c */ = { 283 + uiCtxt = { 284 + sepNavIntBoundsRect = "{{0, 0}, {662, 24766}}"; 285 + sepNavSelRange = "{21672, 6}"; 286 + sepNavVisRange = "{21136, 959}"; 287 + }; 288 + }; 289 + 774A687F0AB08B6D00FBC511 /* ppc-ffitarget.h */ = { 290 + uiCtxt = { 291 + sepNavIntBoundsRect = "{{0, 0}, {638, 1442}}"; 292 + sepNavSelRange = "{2291, 11}"; 293 + sepNavVisRange = "{1776, 559}"; 294 + }; 295 + }; 296 + 774A688A0AB08B7A00FBC511 /* x86-darwin.S */ = { 297 + uiCtxt = { 298 + sepNavIntBoundsRect = "{{0, 0}, {662, 5936}}"; 299 + sepNavSelRange = "{4390, 0}"; 300 + sepNavVisRange = "{4200, 921}"; 301 + }; 302 + }; 303 + 774A688D0AB08B7A00FBC511 /* x86-ffi_darwin.c */ = { 304 + uiCtxt = { 305 + sepNavIntBoundsRect = "{{0, 0}, {890, 6076}}"; 306 + sepNavSelRange = "{12585, 0}"; 307 + sepNavVisRange = "{0, 1189}"; 308 + sepNavWindowFrame = "{{59, 118}, {991, 755}}"; 309 + }; 310 + }; 311 + 774A688E0AB08B7A00FBC511 /* x86-ffitarget.h */ = { 312 + uiCtxt = { 313 + sepNavIntBoundsRect = "{{0, 0}, {890, 1232}}"; 314 + sepNavSelRange = "{1726, 7}"; 315 + sepNavVisRange = "{1326, 907}"; 316 + }; 317 + }; 318 + 774A689A0AB08BEB00FBC511 /* ffi.h */ = { 319 + uiCtxt = { 320 + sepNavIntBoundsRect = "{{0, 0}, {662, 5376}}"; 321 + sepNavSelRange = "{5724, 7}"; 322 + sepNavVisRange = "{5268, 820}"; 323 + }; 324 + }; 325 + 774A689B0AB08BEB00FBC511 /* ffi_common.h */ = { 326 + uiCtxt = { 327 + sepNavIntBoundsRect = "{{0, 0}, {662, 1344}}"; 328 + sepNavSelRange = "{924, 0}"; 329 + sepNavVisRange = "{906, 1298}"; 330 + }; 331 + }; 332 + 774A689C0AB08BEB00FBC511 /* fficonfig.h */ = { 333 + uiCtxt = { 334 + sepNavIntBoundsRect = "{{0, 0}, {890, 2212}}"; 335 + sepNavSelRange = "{1626, 5}"; 336 + sepNavVisRange = "{1071, 1188}"; 337 + }; 338 + }; 339 + 7759A70F0EC223A300D5A4CA /* PBXTextBookmark */ = { 340 + isa = PBXTextBookmark; 341 + fRef = 774A687C0AB08B6D00FBC511 /* ppc-darwin_closure.S */; 342 + name = "ppc-darwin_closure.S: 264"; 343 + rLen = 9; 344 + rLoc = 6028; 345 + rType = 0; 346 + vrLen = 1330; 347 + vrLoc = 5390; 348 + }; 349 + 778346E20E8C39130090422B /* PBXTextBookmark */ = { 350 + isa = PBXTextBookmark; 351 + fRef = 774A687E0AB08B6D00FBC511 /* ppc-ffi_darwin.c */; 352 + name = "ppc-ffi_darwin.c: 788"; 353 + rLen = 6; 354 + rLoc = 21672; 355 + rType = 0; 356 + vrLen = 959; 357 + vrLoc = 21136; 358 + }; 359 + 778347150E8C3E9D0090422B /* PBXTextBookmark */ = { 360 + isa = PBXTextBookmark; 361 + fRef = 774A687B0AB08B6D00FBC511 /* ppc-darwin.S */; 362 + name = "ppc-darwin.S: 310"; 363 + rLen = 9; 364 + rLoc = 8048; 365 + rType = 0; 366 + vrLen = 1168; 367 + vrLoc = 7080; 368 + }; 369 + 778347170E8C3E9D0090422B /* PBXTextBookmark */ = { 370 + isa = PBXTextBookmark; 371 + fRef = 774A687C0AB08B6D00FBC511 /* ppc-darwin_closure.S */; 372 + name = "ppc-darwin_closure.S: 239"; 373 + rLen = 10; 374 + rLoc = 5292; 375 + rType = 0; 376 + vrLen = 1231; 377 + vrLoc = 4772; 378 + }; 379 + 7783471A0E8C3E9D0090422B /* PBXTextBookmark */ = { 380 + isa = PBXTextBookmark; 381 + fRef = 774A687B0AB08B6D00FBC511 /* ppc-darwin.S */; 382 + name = "ppc-darwin.S: 310"; 383 + rLen = 9; 384 + rLoc = 8048; 385 + rType = 0; 386 + vrLen = 1168; 387 + vrLoc = 7080; 388 + }; 389 + 77AFBF2A0EC22FDE00AB26E6 /* PBXTextBookmark */ = { 390 + isa = PBXTextBookmark; 391 + fRef = 774A688D0AB08B7A00FBC511 /* x86-ffi_darwin.c */; 392 + name = "x86-ffi_darwin.c: 205"; 393 + rLen = 0; 394 + rLoc = 6206; 395 + rType = 0; 396 + vrLen = 1253; 397 + vrLoc = 6028; 398 + }; 399 + 77AFBF2B0EC22FDE00AB26E6 /* PBXTextBookmark */ = { 400 + isa = PBXTextBookmark; 401 + fRef = 774A68770AB08B5000FBC511 /* types.c */; 402 + name = "types.c: 1"; 403 + rLen = 0; 404 + rLoc = 0; 405 + rType = 0; 406 + vrLen = 2097; 407 + vrLoc = 0; 408 + }; 409 + 77AFBF2E0EC22FDE00AB26E6 /* PBXTextBookmark */ = { 410 + isa = PBXTextBookmark; 411 + fRef = 774A688A0AB08B7A00FBC511 /* x86-darwin.S */; 412 + name = "x86-darwin.S: 44"; 413 + rLen = 0; 414 + rLoc = 1729; 415 + rType = 0; 416 + vrLen = 829; 417 + vrLoc = 1692; 418 + }; 419 + 77AFBF320EC22FDE00AB26E6 /* PBXTextBookmark */ = { 420 + isa = PBXTextBookmark; 421 + fRef = 774A68770AB08B5000FBC511 /* types.c */; 422 + name = "types.c: 1"; 423 + rLen = 0; 424 + rLoc = 0; 425 + rType = 0; 426 + vrLen = 2097; 427 + vrLoc = 0; 428 + }; 429 + 77AFBF390EC2508200AB26E6 /* PBXTextBookmark */ = { 430 + isa = PBXTextBookmark; 431 + fRef = 774A688A0AB08B7A00FBC511 /* x86-darwin.S */; 432 + name = "x86-darwin.S: 180"; 433 + rLen = 0; 434 + rLoc = 4390; 435 + rType = 0; 436 + vrLen = 935; 437 + vrLoc = 4207; 438 + }; 439 + 77B8934E0EE9FE9E00BDB2A0 /* PBXTextBookmark */ = { 440 + isa = PBXTextBookmark; 441 + fRef = 774A688A0AB08B7A00FBC511 /* x86-darwin.S */; 442 + name = "x86-darwin.S: 180"; 443 + rLen = 0; 444 + rLoc = 4390; 445 + rType = 0; 446 + vrLen = 921; 447 + vrLoc = 4200; 448 + }; 449 + 77C6B7D40E68807300F73F79 /* PBXTextBookmark */ = { 450 + isa = PBXTextBookmark; 451 + fRef = 774A687F0AB08B6D00FBC511 /* ppc-ffitarget.h */; 452 + name = "ppc-ffitarget.h: 80"; 453 + rLen = 11; 454 + rLoc = 2291; 455 + rType = 0; 456 + vrLen = 559; 457 + vrLoc = 1776; 458 + }; 459 + 77C6B7D80E68807300F73F79 /* PBXTextBookmark */ = { 460 + isa = PBXTextBookmark; 461 + fRef = 774A687F0AB08B6D00FBC511 /* ppc-ffitarget.h */; 462 + name = "ppc-ffitarget.h: 80"; 463 + rLen = 11; 464 + rLoc = 2291; 465 + rType = 0; 466 + vrLen = 559; 467 + vrLoc = 1776; 468 + }; 469 + 77C6B7F00E68816E00F73F79 /* PBXTextBookmark */ = { 470 + isa = PBXTextBookmark; 471 + fRef = 4D615B6C0B84B5160064908B /* darwin64.S */; 472 + name = "darwin64.S: 1"; 473 + rLen = 0; 474 + rLoc = 0; 475 + rType = 0; 476 + vrLen = 1825; 477 + vrLoc = 0; 478 + }; 479 + 77C6B7F10E68816E00F73F79 /* PBXTextBookmark */ = { 480 + isa = PBXTextBookmark; 481 + fRef = 4D615B6D0B84B5160064908B /* x86-ffi64.c */; 482 + name = "x86-ffi64.c: 1"; 483 + rLen = 0; 484 + rLoc = 0; 485 + rType = 0; 486 + vrLen = 1678; 487 + vrLoc = 0; 488 + }; 489 + 77C6B7F40E68816E00F73F79 /* PBXTextBookmark */ = { 490 + isa = PBXTextBookmark; 491 + fRef = 774A688D0AB08B7A00FBC511 /* x86-ffi_darwin.c */; 492 + name = "x86-ffi_darwin.c: 318"; 493 + rLen = 0; 494 + rLoc = 9362; 495 + rType = 0; 496 + vrLen = 1213; 497 + vrLoc = 8746; 498 + }; 499 + 77C6B7F50E68816E00F73F79 /* PBXTextBookmark */ = { 500 + isa = PBXTextBookmark; 501 + fRef = 4D615B6C0B84B5160064908B /* darwin64.S */; 502 + name = "darwin64.S: 1"; 503 + rLen = 0; 504 + rLoc = 0; 505 + rType = 0; 506 + vrLen = 1825; 507 + vrLoc = 0; 508 + }; 509 + 77C6B8010E6883AD00F73F79 /* PBXTextBookmark */ = { 510 + isa = PBXTextBookmark; 511 + fRef = 774A689C0AB08BEB00FBC511 /* fficonfig.h */; 512 + name = "fficonfig.h: 69"; 513 + rLen = 9; 514 + rLoc = 1701; 515 + rType = 0; 516 + vrLen = 1294; 517 + vrLoc = 1153; 518 + }; 519 + 77C6B8050E6883AD00F73F79 /* PBXTextBookmark */ = { 520 + isa = PBXTextBookmark; 521 + fRef = 774A689B0AB08BEB00FBC511 /* ffi_common.h */; 522 + name = "ffi_common.h: 44"; 523 + rLen = 9; 524 + rLoc = 914; 525 + rType = 0; 526 + vrLen = 1046; 527 + vrLoc = 730; 528 + }; 529 + 77C6B87D0E68BA4E00F73F79 /* PBXTextBookmark */ = { 530 + isa = PBXTextBookmark; 531 + fRef = 774A689A0AB08BEB00FBC511 /* ffi.h */; 532 + name = "ffi.h: 195"; 533 + rLen = 7; 534 + rLoc = 5724; 535 + rType = 0; 536 + vrLen = 820; 537 + vrLoc = 5268; 538 + }; 539 + 77C6B87F0E68BA4E00F73F79 /* PBXTextBookmark */ = { 540 + isa = PBXTextBookmark; 541 + fRef = 774A689A0AB08BEB00FBC511 /* ffi.h */; 542 + name = "ffi.h: 195"; 543 + rLen = 7; 544 + rLoc = 5724; 545 + rType = 0; 546 + vrLen = 820; 547 + vrLoc = 5268; 548 + }; 549 + }
+332
src/libffi/libffi.xcodeproj/project.pbxproj
··· 1 + // !$*UTF8*$! 2 + { 3 + archiveVersion = 1; 4 + classes = { 5 + }; 6 + objectVersion = 42; 7 + objects = { 8 + 9 + /* Begin PBXBuildFile section */ 10 + 2511C4030C371B4A005376A8 /* ffi.c in Sources */ = {isa = PBXBuildFile; fileRef = 2511C4020C371B4A005376A8 /* ffi.c */; }; 11 + 25840CF80C7A295600864AAA /* ffi_call.3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2575F8B90C6BDD0500B6D9A2 /* ffi_call.3 */; }; 12 + 25840CF90C7A295600864AAA /* ffi_prep_cif.3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2575F8BA0C6BDD0500B6D9A2 /* ffi_prep_cif.3 */; }; 13 + 25840CFA0C7A295600864AAA /* ffi.3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2575F8BB0C6BDD0500B6D9A2 /* ffi.3 */; }; 14 + 25840CFB0C7A295600864AAA /* ffi_prep_closure.3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2575F8BC0C6BDD0500B6D9A2 /* ffi_prep_closure.3 */; }; 15 + 259F43340C28CD8900537400 /* ppc-ffitarget.h in Headers */ = {isa = PBXBuildFile; fileRef = 774A687F0AB08B6D00FBC511 /* ppc-ffitarget.h */; settings = {ATTRIBUTES = (Public, ); }; }; 16 + 259F43350C28CD8900537400 /* x86-ffitarget.h in Headers */ = {isa = PBXBuildFile; fileRef = 774A688E0AB08B7A00FBC511 /* x86-ffitarget.h */; settings = {ATTRIBUTES = (Public, ); }; }; 17 + 259F43360C28CD8900537400 /* ffi.h in Headers */ = {isa = PBXBuildFile; fileRef = 774A689A0AB08BEB00FBC511 /* ffi.h */; settings = {ATTRIBUTES = (Public, ); }; }; 18 + 259F43370C28CD8900537400 /* ffi_common.h in Headers */ = {isa = PBXBuildFile; fileRef = 774A689B0AB08BEB00FBC511 /* ffi_common.h */; settings = {ATTRIBUTES = (Public, ); }; }; 19 + 259F43380C28CD8900537400 /* fficonfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 774A689C0AB08BEB00FBC511 /* fficonfig.h */; settings = {ATTRIBUTES = (Public, ); }; }; 20 + 259F43390C28CD8900537400 /* ffitarget.h in Headers */ = {isa = PBXBuildFile; fileRef = 774A689D0AB08BEB00FBC511 /* ffitarget.h */; settings = {ATTRIBUTES = (Public, ); }; }; 21 + 259F433A0C28CD8900537400 /* ppc-darwin.h in Headers */ = {isa = PBXBuildFile; fileRef = 25A25CCE0C0F6B6100532060 /* ppc-darwin.h */; settings = {ATTRIBUTES = (Public, ); }; }; 22 + 259F433C0C28CD9400537400 /* types.c in Sources */ = {isa = PBXBuildFile; fileRef = 774A68770AB08B5000FBC511 /* types.c */; }; 23 + 259F433D0C28CD9400537400 /* ppc-darwin.S in Sources */ = {isa = PBXBuildFile; fileRef = 774A687B0AB08B6D00FBC511 /* ppc-darwin.S */; }; 24 + 259F433E0C28CD9400537400 /* ppc-darwin_closure.S in Sources */ = {isa = PBXBuildFile; fileRef = 774A687C0AB08B6D00FBC511 /* ppc-darwin_closure.S */; }; 25 + 259F433F0C28CD9400537400 /* ppc-ffi_darwin.c in Sources */ = {isa = PBXBuildFile; fileRef = 774A687E0AB08B6D00FBC511 /* ppc-ffi_darwin.c */; }; 26 + 259F43400C28CD9400537400 /* x86-darwin.S in Sources */ = {isa = PBXBuildFile; fileRef = 774A688A0AB08B7A00FBC511 /* x86-darwin.S */; }; 27 + 259F43410C28CD9400537400 /* x86-ffi_darwin.c in Sources */ = {isa = PBXBuildFile; fileRef = 774A688D0AB08B7A00FBC511 /* x86-ffi_darwin.c */; }; 28 + 259F43420C28CD9400537400 /* darwin64.S in Sources */ = {isa = PBXBuildFile; fileRef = 4D615B6C0B84B5160064908B /* darwin64.S */; }; 29 + 259F43430C28CD9400537400 /* x86-ffi64.c in Sources */ = {isa = PBXBuildFile; fileRef = 4D615B6D0B84B5160064908B /* x86-ffi64.c */; }; 30 + 259F43440C28CD9400537400 /* ppc64-darwin_closure.S in Sources */ = {isa = PBXBuildFile; fileRef = 25358B780C18D7AF00537400 /* ppc64-darwin_closure.S */; }; 31 + /* End PBXBuildFile section */ 32 + 33 + /* Begin PBXCopyFilesBuildPhase section */ 34 + 25840CFC0C7A29E800864AAA /* CopyFiles */ = { 35 + isa = PBXCopyFilesBuildPhase; 36 + buildActionMask = 8; 37 + dstPath = /usr/share/man/man3/; 38 + dstSubfolderSpec = 0; 39 + files = ( 40 + 25840CFA0C7A295600864AAA /* ffi.3 in CopyFiles */, 41 + 25840CF80C7A295600864AAA /* ffi_call.3 in CopyFiles */, 42 + 25840CF90C7A295600864AAA /* ffi_prep_cif.3 in CopyFiles */, 43 + 25840CFB0C7A295600864AAA /* ffi_prep_closure.3 in CopyFiles */, 44 + ); 45 + runOnlyForDeploymentPostprocessing = 1; 46 + }; 47 + /* End PBXCopyFilesBuildPhase section */ 48 + 49 + /* Begin PBXFileReference section */ 50 + 2511C4020C371B4A005376A8 /* ffi.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ffi.c; sourceTree = "<group>"; }; 51 + 25358B780C18D7AF00537400 /* ppc64-darwin_closure.S */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.asm; path = "ppc64-darwin_closure.S"; sourceTree = "<group>"; }; 52 + 2575F8B90C6BDD0500B6D9A2 /* ffi_call.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; name = ffi_call.3; path = man/ffi_call.3; sourceTree = "<group>"; }; 53 + 2575F8BA0C6BDD0500B6D9A2 /* ffi_prep_cif.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; name = ffi_prep_cif.3; path = man/ffi_prep_cif.3; sourceTree = "<group>"; }; 54 + 2575F8BB0C6BDD0500B6D9A2 /* ffi.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; name = ffi.3; path = man/ffi.3; sourceTree = "<group>"; }; 55 + 2575F8BC0C6BDD0500B6D9A2 /* ffi_prep_closure.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; name = ffi_prep_closure.3; path = man/ffi_prep_closure.3; sourceTree = "<group>"; }; 56 + 259F43230C28CBD700537400 /* libffi.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libffi.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; 57 + 25A25CCE0C0F6B6100532060 /* ppc-darwin.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = "ppc-darwin.h"; sourceTree = "<group>"; }; 58 + 4D615B6C0B84B5160064908B /* darwin64.S */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.asm; path = darwin64.S; sourceTree = "<group>"; }; 59 + 4D615B6D0B84B5160064908B /* x86-ffi64.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = "x86-ffi64.c"; sourceTree = "<group>"; }; 60 + 774A68580AB08A7400FBC511 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; }; 61 + 774A68590AB08A8300FBC511 /* README */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = README; sourceTree = "<group>"; }; 62 + 774A68770AB08B5000FBC511 /* types.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = types.c; sourceTree = "<group>"; }; 63 + 774A687B0AB08B6D00FBC511 /* ppc-darwin.S */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.asm; path = "ppc-darwin.S"; sourceTree = "<group>"; }; 64 + 774A687C0AB08B6D00FBC511 /* ppc-darwin_closure.S */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.asm; path = "ppc-darwin_closure.S"; sourceTree = "<group>"; }; 65 + 774A687E0AB08B6D00FBC511 /* ppc-ffi_darwin.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = "ppc-ffi_darwin.c"; sourceTree = "<group>"; }; 66 + 774A687F0AB08B6D00FBC511 /* ppc-ffitarget.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = "ppc-ffitarget.h"; path = "../include/ppc-ffitarget.h"; sourceTree = "<group>"; }; 67 + 774A688A0AB08B7A00FBC511 /* x86-darwin.S */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.asm; path = "x86-darwin.S"; sourceTree = "<group>"; }; 68 + 774A688D0AB08B7A00FBC511 /* x86-ffi_darwin.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = "x86-ffi_darwin.c"; sourceTree = "<group>"; }; 69 + 774A688E0AB08B7A00FBC511 /* x86-ffitarget.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = "x86-ffitarget.h"; path = "../include/x86-ffitarget.h"; sourceTree = "<group>"; }; 70 + 774A689A0AB08BEB00FBC511 /* ffi.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ffi.h; path = include/ffi.h; sourceTree = "<group>"; }; 71 + 774A689B0AB08BEB00FBC511 /* ffi_common.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ffi_common.h; path = include/ffi_common.h; sourceTree = "<group>"; }; 72 + 774A689C0AB08BEB00FBC511 /* fficonfig.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = fficonfig.h; path = include/fficonfig.h; sourceTree = "<group>"; }; 73 + 774A689D0AB08BEB00FBC511 /* ffitarget.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ffitarget.h; path = include/ffitarget.h; sourceTree = "<group>"; }; 74 + 774A68EB0AB0BC2400FBC511 /* README.MacOSX */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = README.MacOSX; sourceTree = "<group>"; }; 75 + /* End PBXFileReference section */ 76 + 77 + /* Begin PBXFrameworksBuildPhase section */ 78 + 259F43210C28CBD700537400 /* Frameworks */ = { 79 + isa = PBXFrameworksBuildPhase; 80 + buildActionMask = 2147483647; 81 + files = ( 82 + ); 83 + runOnlyForDeploymentPostprocessing = 0; 84 + }; 85 + /* End PBXFrameworksBuildPhase section */ 86 + 87 + /* Begin PBXGroup section */ 88 + 08FB7794FE84155DC02AAC07 /* libffi */ = { 89 + isa = PBXGroup; 90 + children = ( 91 + 774A68990AB08BD200FBC511 /* include */, 92 + 08FB7795FE84155DC02AAC07 /* Source */, 93 + C6A0FF2B0290797F04C91782 /* Documentation */, 94 + 1AB674ADFE9D54B511CA2CBB /* Products */, 95 + ); 96 + name = libffi; 97 + sourceTree = "<group>"; 98 + }; 99 + 08FB7795FE84155DC02AAC07 /* Source */ = { 100 + isa = PBXGroup; 101 + children = ( 102 + 2511C4020C371B4A005376A8 /* ffi.c */, 103 + 774A68770AB08B5000FBC511 /* types.c */, 104 + 774A685A0AB08AC500FBC511 /* powerpc */, 105 + 774A68630AB08AC500FBC511 /* x86 */, 106 + ); 107 + name = Source; 108 + sourceTree = "<group>"; 109 + }; 110 + 1AB674ADFE9D54B511CA2CBB /* Products */ = { 111 + isa = PBXGroup; 112 + children = ( 113 + 259F43230C28CBD700537400 /* libffi.dylib */, 114 + ); 115 + name = Products; 116 + sourceTree = "<group>"; 117 + }; 118 + 774A685A0AB08AC500FBC511 /* powerpc */ = { 119 + isa = PBXGroup; 120 + children = ( 121 + 25A25CCE0C0F6B6100532060 /* ppc-darwin.h */, 122 + 774A687B0AB08B6D00FBC511 /* ppc-darwin.S */, 123 + 774A687C0AB08B6D00FBC511 /* ppc-darwin_closure.S */, 124 + 25358B780C18D7AF00537400 /* ppc64-darwin_closure.S */, 125 + 774A687E0AB08B6D00FBC511 /* ppc-ffi_darwin.c */, 126 + 774A687F0AB08B6D00FBC511 /* ppc-ffitarget.h */, 127 + ); 128 + path = powerpc; 129 + sourceTree = "<group>"; 130 + }; 131 + 774A68630AB08AC500FBC511 /* x86 */ = { 132 + isa = PBXGroup; 133 + children = ( 134 + 4D615B6C0B84B5160064908B /* darwin64.S */, 135 + 4D615B6D0B84B5160064908B /* x86-ffi64.c */, 136 + 774A688A0AB08B7A00FBC511 /* x86-darwin.S */, 137 + 774A688D0AB08B7A00FBC511 /* x86-ffi_darwin.c */, 138 + 774A688E0AB08B7A00FBC511 /* x86-ffitarget.h */, 139 + ); 140 + path = x86; 141 + sourceTree = "<group>"; 142 + }; 143 + 774A68990AB08BD200FBC511 /* include */ = { 144 + isa = PBXGroup; 145 + children = ( 146 + 774A689A0AB08BEB00FBC511 /* ffi.h */, 147 + 774A689B0AB08BEB00FBC511 /* ffi_common.h */, 148 + 774A689C0AB08BEB00FBC511 /* fficonfig.h */, 149 + 774A689D0AB08BEB00FBC511 /* ffitarget.h */, 150 + ); 151 + name = include; 152 + sourceTree = "<group>"; 153 + }; 154 + C6A0FF2B0290797F04C91782 /* Documentation */ = { 155 + isa = PBXGroup; 156 + children = ( 157 + 2575F8B90C6BDD0500B6D9A2 /* ffi_call.3 */, 158 + 2575F8BA0C6BDD0500B6D9A2 /* ffi_prep_cif.3 */, 159 + 2575F8BB0C6BDD0500B6D9A2 /* ffi.3 */, 160 + 2575F8BC0C6BDD0500B6D9A2 /* ffi_prep_closure.3 */, 161 + 774A68EB0AB0BC2400FBC511 /* README.MacOSX */, 162 + 774A68590AB08A8300FBC511 /* README */, 163 + 774A68580AB08A7400FBC511 /* LICENSE */, 164 + ); 165 + name = Documentation; 166 + sourceTree = "<group>"; 167 + }; 168 + /* End PBXGroup section */ 169 + 170 + /* Begin PBXHeadersBuildPhase section */ 171 + 259F431F0C28CBD700537400 /* Headers */ = { 172 + isa = PBXHeadersBuildPhase; 173 + buildActionMask = 2147483647; 174 + files = ( 175 + 259F43340C28CD8900537400 /* ppc-ffitarget.h in Headers */, 176 + 259F43350C28CD8900537400 /* x86-ffitarget.h in Headers */, 177 + 259F43360C28CD8900537400 /* ffi.h in Headers */, 178 + 259F43370C28CD8900537400 /* ffi_common.h in Headers */, 179 + 259F43380C28CD8900537400 /* fficonfig.h in Headers */, 180 + 259F43390C28CD8900537400 /* ffitarget.h in Headers */, 181 + 259F433A0C28CD8900537400 /* ppc-darwin.h in Headers */, 182 + ); 183 + runOnlyForDeploymentPostprocessing = 0; 184 + }; 185 + /* End PBXHeadersBuildPhase section */ 186 + 187 + /* Begin PBXNativeTarget section */ 188 + 259F43220C28CBD700537400 /* libffi */ = { 189 + isa = PBXNativeTarget; 190 + buildConfigurationList = 259F43260C28CBF700537400 /* Build configuration list for PBXNativeTarget "libffi" */; 191 + buildPhases = ( 192 + 259F431F0C28CBD700537400 /* Headers */, 193 + 25840CFC0C7A29E800864AAA /* CopyFiles */, 194 + 259F43200C28CBD700537400 /* Sources */, 195 + 259F43210C28CBD700537400 /* Frameworks */, 196 + ); 197 + buildRules = ( 198 + ); 199 + dependencies = ( 200 + ); 201 + name = libffi; 202 + productName = libffi_dyn; 203 + productReference = 259F43230C28CBD700537400 /* libffi.dylib */; 204 + productType = "com.apple.product-type.library.dynamic"; 205 + }; 206 + /* End PBXNativeTarget section */ 207 + 208 + /* Begin PBXProject section */ 209 + 08FB7793FE84155DC02AAC07 /* Project object */ = { 210 + isa = PBXProject; 211 + buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "libffi" */; 212 + compatibilityVersion = "Xcode 2.4"; 213 + hasScannedForEncodings = 1; 214 + mainGroup = 08FB7794FE84155DC02AAC07 /* libffi */; 215 + projectDirPath = ""; 216 + projectRoot = ""; 217 + targets = ( 218 + 259F43220C28CBD700537400 /* libffi */, 219 + ); 220 + }; 221 + /* End PBXProject section */ 222 + 223 + /* Begin PBXSourcesBuildPhase section */ 224 + 259F43200C28CBD700537400 /* Sources */ = { 225 + isa = PBXSourcesBuildPhase; 226 + buildActionMask = 2147483647; 227 + files = ( 228 + 259F433C0C28CD9400537400 /* types.c in Sources */, 229 + 259F433D0C28CD9400537400 /* ppc-darwin.S in Sources */, 230 + 259F433E0C28CD9400537400 /* ppc-darwin_closure.S in Sources */, 231 + 259F433F0C28CD9400537400 /* ppc-ffi_darwin.c in Sources */, 232 + 259F43400C28CD9400537400 /* x86-darwin.S in Sources */, 233 + 259F43410C28CD9400537400 /* x86-ffi_darwin.c in Sources */, 234 + 259F43420C28CD9400537400 /* darwin64.S in Sources */, 235 + 259F43430C28CD9400537400 /* x86-ffi64.c in Sources */, 236 + 259F43440C28CD9400537400 /* ppc64-darwin_closure.S in Sources */, 237 + 2511C4030C371B4A005376A8 /* ffi.c in Sources */, 238 + ); 239 + runOnlyForDeploymentPostprocessing = 0; 240 + }; 241 + /* End PBXSourcesBuildPhase section */ 242 + 243 + /* Begin XCBuildConfiguration section */ 244 + 1DEB91F008733DB70010E9CD /* Debug */ = { 245 + isa = XCBuildConfiguration; 246 + buildSettings = { 247 + ARCHS = ( 248 + i386, 249 + x86_64, 250 + ); 251 + DEPLOYMENT_LOCATION = NO; 252 + EXPORTED_SYMBOLS_FILE = "libffi-exports.sym"; 253 + GCC_WARN_ABOUT_RETURN_TYPE = YES; 254 + GCC_WARN_UNUSED_VARIABLE = YES; 255 + INSTALL_PATH = ""; 256 + PREBINDING = NO; 257 + }; 258 + name = Debug; 259 + }; 260 + 1DEB91F108733DB70010E9CD /* Release */ = { 261 + isa = XCBuildConfiguration; 262 + buildSettings = { 263 + ALWAYS_SEARCH_USER_PATHS = YES; 264 + ARCHS = ( 265 + i386, 266 + x86_64, 267 + ); 268 + DEPLOYMENT_LOCATION = NO; 269 + EXPORTED_SYMBOLS_FILE = "libffi-exports.sym"; 270 + GCC_WARN_ABOUT_RETURN_TYPE = YES; 271 + GCC_WARN_UNUSED_VARIABLE = YES; 272 + INSTALL_PATH = ""; 273 + PREBINDING = NO; 274 + PUBLIC_HEADERS_FOLDER_PATH = ../include/ffi; 275 + }; 276 + name = Release; 277 + }; 278 + 259F43240C28CBD900537400 /* Debug */ = { 279 + isa = XCBuildConfiguration; 280 + buildSettings = { 281 + COPY_PHASE_STRIP = NO; 282 + EXECUTABLE_PREFIX = lib; 283 + GCC_DYNAMIC_NO_PIC = NO; 284 + GCC_ENABLE_FIX_AND_CONTINUE = YES; 285 + GCC_OPTIMIZATION_LEVEL = 0; 286 + INSTALL_PATH = /usr/local/lib; 287 + PREBINDING = NO; 288 + PRODUCT_NAME = ffi; 289 + ZERO_LINK = YES; 290 + }; 291 + name = Debug; 292 + }; 293 + 259F43250C28CBD900537400 /* Release */ = { 294 + isa = XCBuildConfiguration; 295 + buildSettings = { 296 + COPY_PHASE_STRIP = YES; 297 + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 298 + EXECUTABLE_PREFIX = lib; 299 + GCC_ENABLE_FIX_AND_CONTINUE = NO; 300 + GCC_OPTIMIZATION_LEVEL = s; 301 + INSTALL_PATH = /usr/lib; 302 + PREBINDING = NO; 303 + PRODUCT_NAME = ffi; 304 + ZERO_LINK = NO; 305 + }; 306 + name = Release; 307 + }; 308 + /* End XCBuildConfiguration section */ 309 + 310 + /* Begin XCConfigurationList section */ 311 + 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "libffi" */ = { 312 + isa = XCConfigurationList; 313 + buildConfigurations = ( 314 + 1DEB91F008733DB70010E9CD /* Debug */, 315 + 1DEB91F108733DB70010E9CD /* Release */, 316 + ); 317 + defaultConfigurationIsVisible = 0; 318 + defaultConfigurationName = Release; 319 + }; 320 + 259F43260C28CBF700537400 /* Build configuration list for PBXNativeTarget "libffi" */ = { 321 + isa = XCConfigurationList; 322 + buildConfigurations = ( 323 + 259F43240C28CBD900537400 /* Debug */, 324 + 259F43250C28CBD900537400 /* Release */, 325 + ); 326 + defaultConfigurationIsVisible = 0; 327 + defaultConfigurationName = Release; 328 + }; 329 + /* End XCConfigurationList section */ 330 + }; 331 + rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; 332 + }
+40
src/libffi/man/ffi.3
··· 1 + .Dd July 20, 2007 2 + .Dt FFI 3 3 + .Os Darwin 4 + .Sh NAME 5 + .Nm FFI 6 + .Nd Foreign Function Interface 7 + .Sh LIBRARY 8 + libffi, -lffi 9 + .Sh SYNOPSIS 10 + .In ffi/ffi.h 11 + .Ft ffi_status 12 + .Fo ffi_prep_cif 13 + .Fa "ffi_cif *cif" 14 + .Fa "ffi_abi abi" 15 + .Fa "unsigned int nargs" 16 + .Fa "ffi_type *rtype" 17 + .Fa "ffi_type **atypes" 18 + .Fc 19 + .Ft ffi_status 20 + .Fo ffi_prep_closure 21 + .Fa "ffi_closure *closure" 22 + .Fa "ffi_cif *cif" 23 + .Fa "void (*fun)(ffi_cif*,void*,void**,void*)" 24 + .Fa "void *user_data" 25 + .Fc 26 + .Ft void 27 + .Fo ffi_call 28 + .Fa "ffi_cif *cif" 29 + .Fa "void (*fn)(void)" 30 + .Fa "void *rvalue" 31 + .Fa "void **avalue" 32 + .Fc 33 + .Sh DESCRIPTION 34 + The foreign function interface provides a mechanism by which a function can 35 + generate a call to another function at runtime without requiring knowledge of 36 + the called function's interface at compile time. 37 + .Sh SEE ALSO 38 + .Xr ffi_prep_cif 3 , 39 + .Xr ffi_prep_closure 3 , 40 + .Xr ffi_call 3
+106
src/libffi/man/ffi_call.3
··· 1 + .Dd July 20, 2007 2 + .Dt ffi_call 3 3 + .Os Darwin 4 + .Sh NAME 5 + .Nm ffi_call 6 + .Nd Invoke a foreign function. 7 + .Sh SYNOPSIS 8 + .In ffi/ffi.h 9 + .Ft void 10 + .Fo ffi_call 11 + .Fa "ffi_cif *cif" 12 + .Fa "void (*fn)(void)" 13 + .Fa "void *rvalue" 14 + .Fa "void **avalue" 15 + .Fc 16 + .Sh DESCRIPTION 17 + The 18 + .Nm ffi_call 19 + function provides a simple mechanism for invoking a function without 20 + requiring knowledge of the function's interface at compile time. 21 + .Fa fn 22 + is called with the values retrieved from the pointers in the 23 + .Fa avalue 24 + array. The return value from 25 + .Fa fn 26 + is placed in storage pointed to by 27 + .Fa rvalue . 28 + .Fa cif 29 + contains information describing the data types, sizes and alignments of the 30 + arguments to and return value from 31 + .Fa fn , 32 + and must be initialized with 33 + .Nm ffi_prep_cif 34 + before it is used with 35 + .Nm ffi_call . 36 + .Pp 37 + .Fa rvalue 38 + must point to storage that is sizeof(long) or larger. For smaller 39 + return value sizes, the 40 + .Nm ffi_arg 41 + or 42 + .Nm ffi_sarg 43 + integral type must be used to hold 44 + the return value. 45 + .Sh EXAMPLES 46 + .Bd -literal 47 + #define MACOSX // for fficonfig.h on Darwin 48 + 49 + #include <ffi/ffi.h> 50 + #include <stdio.h> 51 + 52 + unsigned char 53 + foo(unsigned int, float); 54 + 55 + int 56 + main(int argc, const char **argv) 57 + { 58 + ffi_cif cif; 59 + ffi_type *arg_types[2]; 60 + void *arg_values[2]; 61 + ffi_status status; 62 + 63 + // Because the return value from foo() is smaller than sizeof(long), it 64 + // must be passed as ffi_arg or ffi_sarg. 65 + ffi_arg result; 66 + 67 + // Specify the data type of each argument. Available types are defined 68 + // in <ffi/ffi.h>. 69 + arg_types[0] = &ffi_type_uint; 70 + arg_types[1] = &ffi_type_float; 71 + 72 + // Prepare the ffi_cif structure. 73 + if ((status = ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 74 + 2, &ffi_type_uint8, arg_types)) != FFI_OK) 75 + { 76 + // Handle the ffi_status error. 77 + } 78 + 79 + // Specify the values of each argument. 80 + unsigned int arg1 = 42; 81 + float arg2 = 5.1; 82 + 83 + arg_values[0] = &arg1; 84 + arg_values[1] = &arg2; 85 + 86 + // Invoke the function. 87 + ffi_call(&cif, FFI_FN(foo), &result, arg_values); 88 + 89 + // The ffi_arg 'result' now contains the unsigned char returned from foo(), 90 + // which can be accessed by a typecast. 91 + printf("result is %hhu", (unsigned char)result); 92 + 93 + return 0; 94 + } 95 + 96 + // The target function. 97 + unsigned char 98 + foo(unsigned int x, float y) 99 + { 100 + unsigned char result = x - y; 101 + return result; 102 + } 103 + .Ed 104 + .Sh SEE ALSO 105 + .Xr ffi 3 , 106 + .Xr ffi_prep_cif 3
+71
src/libffi/man/ffi_prep_cif.3
··· 1 + .Dd July 20, 2007 2 + .Dt ffi_prep_cif 3 3 + .Os Darwin 4 + .Sh NAME 5 + .Nm ffi_prep_cif 6 + .Nd Prepare a 7 + .Nm ffi_cif 8 + structure for use with 9 + .Nm ffi_call 10 + or 11 + .Nm ffi_prep_closure . 12 + .Sh SYNOPSIS 13 + .In ffi/ffi.h 14 + .Ft ffi_status 15 + .Fo ffi_prep_cif 16 + .Fa "ffi_cif *cif" 17 + .Fa "ffi_abi abi" 18 + .Fa "unsigned int nargs" 19 + .Fa "ffi_type *rtype" 20 + .Fa "ffi_type **atypes" 21 + .Fc 22 + .Sh DESCRIPTION 23 + The 24 + .Nm ffi_prep_cif 25 + function prepares a 26 + .Nm ffi_cif 27 + structure for use with 28 + .Nm ffi_call 29 + or 30 + .Nm ffi_prep_closure . 31 + .Fa abi 32 + specifies a set of calling conventions to use. 33 + .Fa atypes 34 + is an array of 35 + .Fa nargs 36 + pointers to 37 + .Nm ffi_type 38 + structs that describe the data type, size and alignment of each argument. 39 + .Fa rtype 40 + points to an 41 + .Nm ffi_type 42 + that describes the data type, size and alignment of the 43 + return value. 44 + .Sh RETURN VALUES 45 + Upon successful completion, 46 + .Nm ffi_prep_cif 47 + returns 48 + .Nm FFI_OK . 49 + It will return 50 + .Nm FFI_BAD_TYPEDEF 51 + if 52 + .Fa cif 53 + is 54 + .Nm NULL 55 + or 56 + .Fa atypes 57 + or 58 + .Fa rtype 59 + is malformed. If 60 + .Fa abi 61 + does not refer to a valid ABI, 62 + .Nm FFI_BAD_ABI 63 + will be returned. Available ABIs are 64 + defined in 65 + .Nm <ffi/ppc-ffitarget.h> 66 + and 67 + .Nm <ffi/x86-ffitarget.h> . 68 + .Sh SEE ALSO 69 + .Xr ffi 3 , 70 + .Xr ffi_call 3 , 71 + .Xr ffi_prep_closure 3
+162
src/libffi/man/ffi_prep_closure.3
··· 1 + .Dd July 20, 2007 2 + .Dt ffi_prep_closure 3 3 + .Os Darwin 4 + .Sh NAME 5 + .Nm ffi_prep_closure 6 + .Nd Prepare a 7 + .Nm ffi_closure 8 + for execution. 9 + .Sh SYNOPSIS 10 + .In ffi/ffi.h 11 + .Ft ffi_status 12 + .Fo ffi_prep_closure 13 + .Fa "ffi_closure *closure" 14 + .Fa "ffi_cif *cif" 15 + .Fa "void (*fun)(ffi_cif*,void*,void**,void*)" 16 + .Fa "void *user_data" 17 + .Fc 18 + .Sh DESCRIPTION 19 + .Fa closure 20 + is prepared to execute 21 + .Fa fun . 22 + .Fa cif 23 + contains information describing the data types, sizes and alignments of the 24 + arguments to and return value from the function that will be called from 25 + .Fa fun , 26 + and must be initialized with 27 + .Nm ffi_prep_cif 28 + before it is used with 29 + .Nm ffi_prep_closure . 30 + .Fa user_data 31 + may point to additional data to be used in 32 + .Fa fun . 33 + If no additional data is needed, 34 + .Fa user_data 35 + may be 36 + .Nm NULL . 37 + When 38 + .Fa closure 39 + is invoked, 40 + .Fa fun 41 + is called with 42 + .Fa cif , 43 + an array of pointers to arguments, a pointer to a return value, and 44 + .Fa user_data . 45 + .Pp 46 + Some architectures do not allow the execution of data by default. In such cases, 47 + it is necessary to manually alter the permissions of the page that contains 48 + .Fa closure 49 + prior to its execution. 50 + .Sh RETURN VALUES 51 + Upon successful completion, 52 + .Nm ffi_prep_closure 53 + returns 54 + .Nm FFI_OK . 55 + If the ABI specified in 56 + .Fa cif 57 + does not refer to a valid ABI, 58 + .Nm FFI_BAD_ABI 59 + will be returned. Available ABIs are 60 + defined in 61 + .Nm <ffi/ppc-ffitarget.h> 62 + and 63 + .Nm <ffi/x86-ffitarget.h> . 64 + .Sh EXAMPLES 65 + .Bd -literal 66 + #define MACOSX // for fficonfig.h on Darwin 67 + 68 + #include <ffi/ffi.h> 69 + #include <sys/mman.h> // for mmap() 70 + 71 + unsigned char 72 + foo(unsigned int, float); 73 + 74 + static void 75 + foo_closure(ffi_cif*, void*, void**, void*); 76 + 77 + int 78 + main(int argc, const char **argv) 79 + { 80 + ffi_cif cif; 81 + ffi_closure *closure; 82 + ffi_type *arg_types[2]; 83 + ffi_arg result; 84 + ffi_status status; 85 + 86 + // Specify the data type of each argument. Available types are defined 87 + // in <ffi/ffi.h>. 88 + arg_types[0] = &ffi_type_uint; 89 + arg_types[1] = &ffi_type_float; 90 + 91 + // Allocate a page to hold the closure with read and write permissions. 92 + if ((closure = mmap(NULL, sizeof(ffi_closure), PROT_READ | PROT_WRITE, 93 + MAP_ANON | MAP_PRIVATE, -1, 0)) == (void*)-1) 94 + { 95 + // Check errno and handle the error. 96 + } 97 + 98 + // Prepare the ffi_cif structure. 99 + if ((status = ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 100 + 2, &ffi_type_uint8, arg_types)) != FFI_OK) 101 + { 102 + // Handle the ffi_status error. 103 + } 104 + 105 + // Prepare the ffi_closure structure. 106 + if ((status = ffi_prep_closure(closure, &cif, foo_closure, NULL)) != FFI_OK) 107 + { 108 + // Handle the ffi_status error. 109 + } 110 + 111 + // Ensure that the closure will execute on all architectures. 112 + if (mprotect(closure, sizeof(closure), PROT_READ | PROT_EXEC) == -1) 113 + { 114 + // Check errno and handle the error. 115 + } 116 + 117 + // The closure is now ready to be executed, and can be saved for later 118 + // execution if desired. 119 + 120 + // Invoke the closure. 121 + result = ((unsigned char(*)(float, unsigned int))closure)(42, 5.1); 122 + 123 + // Free the memory associated with the closure. 124 + if (munmap(closure, sizeof(closure)) == -1) 125 + { 126 + // Check errno and handle the error. 127 + } 128 + 129 + return 0; 130 + } 131 + 132 + // Invoking the closure transfers control to this function. 133 + static void 134 + foo_closure(ffi_cif* cif, void* result, void** args, void* userdata) 135 + { 136 + // Access the arguments to be sent to foo(). 137 + float arg1 = *(float*)args[0]; 138 + unsigned int arg2 = *(unsigned int*)args[1]; 139 + 140 + // Call foo() and save its return value. 141 + unsigned char ret_val = foo(arg1, arg2); 142 + 143 + // Copy the returned value into result. Because the return value of foo() 144 + // is smaller than sizeof(long), typecast it to ffi_arg. Use ffi_sarg 145 + // instead for signed types. 146 + *(ffi_arg*)result = (ffi_arg)ret_val; 147 + } 148 + 149 + // The closed-over function. 150 + unsigned char 151 + foo(unsigned int x, float y) 152 + { 153 + unsigned char result = x - y; 154 + return result; 155 + } 156 + .Ed 157 + .Sh SEE ALSO 158 + .Xr ffi 3 , 159 + .Xr ffi_prep_cif 3 , 160 + .Xr mmap 2 , 161 + .Xr munmap 2 , 162 + .Xr mprotect 2
+365
src/libffi/powerpc/ppc-darwin.S
··· 1 + #if defined(__ppc__) || defined(__ppc64__) 2 + 3 + /* ----------------------------------------------------------------------- 4 + ppc-darwin.S - Copyright (c) 2000 John Hornkvist 5 + Copyright (c) 2004 Free Software Foundation, Inc. 6 + 7 + PowerPC Assembly glue. 8 + 9 + Permission is hereby granted, free of charge, to any person obtaining 10 + a copy of this software and associated documentation files (the 11 + ``Software''), to deal in the Software without restriction, including 12 + without limitation the rights to use, copy, modify, merge, publish, 13 + distribute, sublicense, and/or sell copies of the Software, and to 14 + permit persons to whom the Software is furnished to do so, subject to 15 + the following conditions: 16 + 17 + The above copyright notice and this permission notice shall be included 18 + in all copies or substantial portions of the Software. 19 + 20 + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS 21 + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 23 + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR 24 + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 25 + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 + OTHER DEALINGS IN THE SOFTWARE. 27 + ----------------------------------------------------------------------- */ 28 + 29 + #define LIBFFI_ASM 30 + 31 + #include <fficonfig.h> 32 + #include <ffi.h> 33 + #include <ppc-darwin.h> 34 + #include <architecture/ppc/mode_independent_asm.h> 35 + 36 + .text 37 + .align 2 38 + .globl _ffi_prep_args 39 + 40 + .text 41 + .align 2 42 + .globl _ffi_call_DARWIN 43 + 44 + .text 45 + .align 2 46 + _ffi_call_DARWIN: 47 + LFB0: 48 + mr r12,r8 /* We only need r12 until the call, 49 + so it doesn't have to be saved. */ 50 + 51 + LFB1: 52 + /* Save the old stack pointer as AP. */ 53 + mr r8,r1 54 + 55 + LCFI0: 56 + #if defined(__ppc64__) 57 + /* Allocate the stack space we need. 58 + r4 (size of input data) 59 + 48 bytes (linkage area) 60 + 40 bytes (saved registers) 61 + 8 bytes (extra FPR) 62 + r4 + 96 bytes total 63 + */ 64 + 65 + addi r4,r4,-96 // Add our overhead. 66 + li r0,-32 // Align to 32 bytes. 67 + and r4,r4,r0 68 + #endif 69 + stgux r1,r1,r4 // Grow the stack. 70 + mflr r9 71 + 72 + /* Save registers we use. */ 73 + #if defined(__ppc64__) 74 + std r27,-40(r8) 75 + #endif 76 + stg r28,MODE_CHOICE(-16,-32)(r8) 77 + stg r29,MODE_CHOICE(-12,-24)(r8) 78 + stg r30,MODE_CHOICE(-8,-16)(r8) 79 + stg r31,MODE_CHOICE(-4,-8)(r8) 80 + stg r9,SF_RETURN(r8) /* return address */ 81 + #if !defined(POWERPC_DARWIN) /* TOC unused in OS X */ 82 + stg r2,MODE_CHOICE(20,40)(r1) 83 + #endif 84 + 85 + LCFI1: 86 + #if defined(__ppc64__) 87 + mr r27,r3 // our extended_cif 88 + #endif 89 + /* Save arguments over call. */ 90 + mr r31,r5 /* flags, */ 91 + mr r30,r6 /* rvalue, */ 92 + mr r29,r7 /* function address, */ 93 + mr r28,r8 /* our AP. */ 94 + 95 + LCFI2: 96 + /* Call ffi_prep_args. */ 97 + mr r4,r1 98 + li r9,0 99 + mtctr r12 /* r12 holds address of _ffi_prep_args. */ 100 + bctrl 101 + #if !defined(POWERPC_DARWIN) /* TOC unused in OS X */ 102 + lg r2,MODE_CHOICE(20,40)(r1) 103 + #endif 104 + 105 + /* Now do the call. 106 + Set up cr1 with bits 4-7 of the flags. */ 107 + mtcrf 0x40,r31 108 + 109 + /* Load all those argument registers. 110 + We have set up a nice stack frame, just load it into registers. */ 111 + lg r3,SF_ARG1(r1) 112 + lg r4,SF_ARG2(r1) 113 + lg r5,SF_ARG3(r1) 114 + lg r6,SF_ARG4(r1) 115 + nop 116 + lg r7,SF_ARG5(r1) 117 + lg r8,SF_ARG6(r1) 118 + lg r9,SF_ARG7(r1) 119 + lg r10,SF_ARG8(r1) 120 + 121 + /* Load all the FP registers. */ 122 + bf 6,L2 /* No floats to load. */ 123 + #if defined(__ppc64__) 124 + lfd f1,MODE_CHOICE(-16,-40)-(14*8)(r28) 125 + lfd f2,MODE_CHOICE(-16,-40)-(13*8)(r28) 126 + lfd f3,MODE_CHOICE(-16,-40)-(12*8)(r28) 127 + lfd f4,MODE_CHOICE(-16,-40)-(11*8)(r28) 128 + nop 129 + lfd f5,MODE_CHOICE(-16,-40)-(10*8)(r28) 130 + lfd f6,MODE_CHOICE(-16,-40)-(9*8)(r28) 131 + lfd f7,MODE_CHOICE(-16,-40)-(8*8)(r28) 132 + lfd f8,MODE_CHOICE(-16,-40)-(7*8)(r28) 133 + nop 134 + lfd f9,MODE_CHOICE(-16,-40)-(6*8)(r28) 135 + lfd f10,MODE_CHOICE(-16,-40)-(5*8)(r28) 136 + lfd f11,MODE_CHOICE(-16,-40)-(4*8)(r28) 137 + lfd f12,MODE_CHOICE(-16,-40)-(3*8)(r28) 138 + nop 139 + lfd f13,MODE_CHOICE(-16,-40)-(2*8)(r28) 140 + lfd f14,MODE_CHOICE(-16,-40)-(1*8)(r28) 141 + #elif defined(__ppc__) 142 + lfd f1,MODE_CHOICE(-16,-40)-(13*8)(r28) 143 + lfd f2,MODE_CHOICE(-16,-40)-(12*8)(r28) 144 + lfd f3,MODE_CHOICE(-16,-40)-(11*8)(r28) 145 + lfd f4,MODE_CHOICE(-16,-40)-(10*8)(r28) 146 + nop 147 + lfd f5,MODE_CHOICE(-16,-40)-(9*8)(r28) 148 + lfd f6,MODE_CHOICE(-16,-40)-(8*8)(r28) 149 + lfd f7,MODE_CHOICE(-16,-40)-(7*8)(r28) 150 + lfd f8,MODE_CHOICE(-16,-40)-(6*8)(r28) 151 + nop 152 + lfd f9,MODE_CHOICE(-16,-40)-(5*8)(r28) 153 + lfd f10,MODE_CHOICE(-16,-40)-(4*8)(r28) 154 + lfd f11,MODE_CHOICE(-16,-40)-(3*8)(r28) 155 + lfd f12,MODE_CHOICE(-16,-40)-(2*8)(r28) 156 + nop 157 + lfd f13,MODE_CHOICE(-16,-40)-(1*8)(r28) 158 + #else 159 + #error undefined architecture 160 + #endif 161 + 162 + L2: 163 + mr r12,r29 // Put the target address in r12 as specified. 164 + mtctr r12 // Get the address to call into CTR. 165 + nop 166 + nop 167 + bctrl // Make the call. 168 + 169 + // Deal with the return value. 170 + #if defined(__ppc64__) 171 + mtcrf 0x3,r31 // flags in cr6 and cr7 172 + bt 27,L(st_return_value) 173 + #elif defined(__ppc__) 174 + mtcrf 0x1,r31 // flags in cr7 175 + #else 176 + #error undefined architecture 177 + #endif 178 + 179 + bt 30,L(done_return_value) 180 + bt 29,L(fp_return_value) 181 + stg r3,0(r30) 182 + #if defined(__ppc__) 183 + bf 28,L(done_return_value) // Store the second long if necessary. 184 + stg r4,4(r30) 185 + #endif 186 + // Fall through 187 + 188 + L(done_return_value): 189 + lg r1,0(r1) // Restore stack pointer. 190 + // Restore the registers we used. 191 + lg r9,SF_RETURN(r1) // return address 192 + lg r31,MODE_CHOICE(-4,-8)(r1) 193 + mtlr r9 194 + lg r30,MODE_CHOICE(-8,-16)(r1) 195 + lg r29,MODE_CHOICE(-12,-24)(r1) 196 + lg r28,MODE_CHOICE(-16,-32)(r1) 197 + #if defined(__ppc64__) 198 + ld r27,-40(r1) 199 + #endif 200 + blr 201 + 202 + #if defined(__ppc64__) 203 + L(st_return_value): 204 + // Grow the stack enough to fit the registers. Leave room for 8 args 205 + // to trample the 1st 8 slots in param area. 206 + stgu r1,-SF_ROUND(280)(r1) // 64 + 104 + 48 + 64 207 + 208 + // Store GPRs 209 + std r3,SF_ARG9(r1) 210 + std r4,SF_ARG10(r1) 211 + std r5,SF_ARG11(r1) 212 + std r6,SF_ARG12(r1) 213 + nop 214 + std r7,SF_ARG13(r1) 215 + std r8,SF_ARG14(r1) 216 + std r9,SF_ARG15(r1) 217 + std r10,SF_ARG16(r1) 218 + 219 + // Store FPRs 220 + nop 221 + bf 26,L(call_struct_to_ram_form) 222 + stfd f1,SF_ARG17(r1) 223 + stfd f2,SF_ARG18(r1) 224 + stfd f3,SF_ARG19(r1) 225 + stfd f4,SF_ARG20(r1) 226 + nop 227 + stfd f5,SF_ARG21(r1) 228 + stfd f6,SF_ARG22(r1) 229 + stfd f7,SF_ARG23(r1) 230 + stfd f8,SF_ARG24(r1) 231 + nop 232 + stfd f9,SF_ARG25(r1) 233 + stfd f10,SF_ARG26(r1) 234 + stfd f11,SF_ARG27(r1) 235 + stfd f12,SF_ARG28(r1) 236 + nop 237 + stfd f13,SF_ARG29(r1) 238 + 239 + L(call_struct_to_ram_form): 240 + ld r3,0(r27) // extended_cif->cif* 241 + ld r3,16(r3) // ffi_cif->rtype* 242 + addi r4,r1,SF_ARG9 // stored GPRs 243 + addi r6,r1,SF_ARG17 // stored FPRs 244 + li r5,0 // GPR size ptr (NULL) 245 + li r7,0 // FPR size ptr (NULL) 246 + li r8,0 // FPR count ptr (NULL) 247 + li r10,0 // struct offset (NULL) 248 + mr r9,r30 // return area 249 + bl Lffi64_struct_to_ram_form$stub 250 + lg r1,0(r1) // Restore stack pointer. 251 + b L(done_return_value) 252 + #endif 253 + 254 + L(fp_return_value): 255 + /* Do we have long double to store? */ 256 + bf 31,L(fd_return_value) 257 + stfd f1,0(r30) 258 + stfd f2,8(r30) 259 + b L(done_return_value) 260 + 261 + L(fd_return_value): 262 + /* Do we have double to store? */ 263 + bf 28,L(float_return_value) 264 + stfd f1,0(r30) 265 + b L(done_return_value) 266 + 267 + L(float_return_value): 268 + /* We only have a float to store. */ 269 + stfs f1,0(r30) 270 + b L(done_return_value) 271 + 272 + LFE1: 273 + /* END(_ffi_call_DARWIN) */ 274 + 275 + /* Provide a null definition of _ffi_call_AIX. */ 276 + .text 277 + .align 2 278 + .globl _ffi_call_AIX 279 + .text 280 + .align 2 281 + _ffi_call_AIX: 282 + blr 283 + /* END(_ffi_call_AIX) */ 284 + 285 + .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms 286 + EH_frame1: 287 + .set L$set$0,LECIE1-LSCIE1 288 + .long L$set$0 ; Length of Common Information Entry 289 + LSCIE1: 290 + .long 0x0 ; CIE Identifier Tag 291 + .byte 0x1 ; CIE Version 292 + .ascii "zR\0" ; CIE Augmentation 293 + .byte 0x1 ; uleb128 0x1; CIE Code Alignment Factor 294 + .byte 0x7c ; sleb128 -4; CIE Data Alignment Factor 295 + .byte 0x41 ; CIE RA Column 296 + .byte 0x1 ; uleb128 0x1; Augmentation size 297 + .byte 0x10 ; FDE Encoding (pcrel) 298 + .byte 0xc ; DW_CFA_def_cfa 299 + .byte 0x1 ; uleb128 0x1 300 + .byte 0x0 ; uleb128 0x0 301 + .align LOG2_GPR_BYTES 302 + LECIE1: 303 + .globl _ffi_call_DARWIN.eh 304 + _ffi_call_DARWIN.eh: 305 + LSFDE1: 306 + .set L$set$1,LEFDE1-LASFDE1 307 + .long L$set$1 ; FDE Length 308 + 309 + LASFDE1: 310 + .long LASFDE1-EH_frame1 ; FDE CIE offset 311 + .g_long LFB0-. ; FDE initial location 312 + .set L$set$3,LFE1-LFB0 313 + .g_long L$set$3 ; FDE address range 314 + .byte 0x0 ; uleb128 0x0; Augmentation size 315 + .byte 0x4 ; DW_CFA_advance_loc4 316 + .set L$set$4,LCFI0-LFB1 317 + .long L$set$4 318 + .byte 0xd ; DW_CFA_def_cfa_register 319 + .byte 0x08 ; uleb128 0x08 320 + .byte 0x4 ; DW_CFA_advance_loc4 321 + .set L$set$5,LCFI1-LCFI0 322 + .long L$set$5 323 + .byte 0x11 ; DW_CFA_offset_extended_sf 324 + .byte 0x41 ; uleb128 0x41 325 + .byte 0x7e ; sleb128 -2 326 + .byte 0x9f ; DW_CFA_offset, column 0x1f 327 + .byte 0x1 ; uleb128 0x1 328 + .byte 0x9e ; DW_CFA_offset, column 0x1e 329 + .byte 0x2 ; uleb128 0x2 330 + .byte 0x9d ; DW_CFA_offset, column 0x1d 331 + .byte 0x3 ; uleb128 0x3 332 + .byte 0x9c ; DW_CFA_offset, column 0x1c 333 + .byte 0x4 ; uleb128 0x4 334 + .byte 0x4 ; DW_CFA_advance_loc4 335 + .set L$set$6,LCFI2-LCFI1 336 + .long L$set$6 337 + .byte 0xd ; DW_CFA_def_cfa_register 338 + .byte 0x1c ; uleb128 0x1c 339 + .align LOG2_GPR_BYTES 340 + LEFDE1: 341 + 342 + #if defined(__ppc64__) 343 + .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32 344 + .align LOG2_GPR_BYTES 345 + 346 + Lffi64_struct_to_ram_form$stub: 347 + .indirect_symbol _ffi64_struct_to_ram_form 348 + mflr r0 349 + bcl 20,31,LO$ffi64_struct_to_ram_form 350 + 351 + LO$ffi64_struct_to_ram_form: 352 + mflr r11 353 + addis r11,r11,ha16(L_ffi64_struct_to_ram_form$lazy_ptr - LO$ffi64_struct_to_ram_form) 354 + mtlr r0 355 + lgu r12,lo16(L_ffi64_struct_to_ram_form$lazy_ptr - LO$ffi64_struct_to_ram_form)(r11) 356 + mtctr r12 357 + bctr 358 + 359 + .lazy_symbol_pointer 360 + L_ffi64_struct_to_ram_form$lazy_ptr: 361 + .indirect_symbol _ffi64_struct_to_ram_form 362 + .g_long dyld_stub_binding_helper 363 + 364 + #endif // __ppc64__ 365 + #endif // __ppc__ || __ppc64__
+85
src/libffi/powerpc/ppc-darwin.h
··· 1 + /* ----------------------------------------------------------------------- 2 + ppc-darwin.h - Copyright (c) 2002, 2003, 2004, Free Software Foundation, 3 + Inc. 4 + 5 + Permission is hereby granted, free of charge, to any person obtaining 6 + a copy of this software and associated documentation files (the 7 + ``Software''), to deal in the Software without restriction, including 8 + without limitation the rights to use, copy, modify, merge, publish, 9 + distribute, sublicense, and/or sell copies of the Software, and to 10 + permit persons to whom the Software is furnished to do so, subject to 11 + the following conditions: 12 + 13 + The above copyright notice and this permission notice shall be included 14 + in all copies or substantial portions of the Software. 15 + 16 + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 + OTHER DEALINGS IN THE SOFTWARE. 23 + ----------------------------------------------------------------------- */ 24 + 25 + #define L(x) x 26 + 27 + #define SF_ARG9 MODE_CHOICE(56,112) 28 + #define SF_ARG10 MODE_CHOICE(60,120) 29 + #define SF_ARG11 MODE_CHOICE(64,128) 30 + #define SF_ARG12 MODE_CHOICE(68,136) 31 + #define SF_ARG13 MODE_CHOICE(72,144) 32 + #define SF_ARG14 MODE_CHOICE(76,152) 33 + #define SF_ARG15 MODE_CHOICE(80,160) 34 + #define SF_ARG16 MODE_CHOICE(84,168) 35 + #define SF_ARG17 MODE_CHOICE(88,176) 36 + #define SF_ARG18 MODE_CHOICE(92,184) 37 + #define SF_ARG19 MODE_CHOICE(96,192) 38 + #define SF_ARG20 MODE_CHOICE(100,200) 39 + #define SF_ARG21 MODE_CHOICE(104,208) 40 + #define SF_ARG22 MODE_CHOICE(108,216) 41 + #define SF_ARG23 MODE_CHOICE(112,224) 42 + #define SF_ARG24 MODE_CHOICE(116,232) 43 + #define SF_ARG25 MODE_CHOICE(120,240) 44 + #define SF_ARG26 MODE_CHOICE(124,248) 45 + #define SF_ARG27 MODE_CHOICE(128,256) 46 + #define SF_ARG28 MODE_CHOICE(132,264) 47 + #define SF_ARG29 MODE_CHOICE(136,272) 48 + 49 + #define ASM_NEEDS_REGISTERS 4 50 + #define NUM_GPR_ARG_REGISTERS 8 51 + #define NUM_FPR_ARG_REGISTERS 13 52 + 53 + #define FFI_TYPE_1_BYTE(x) ((x) == FFI_TYPE_UINT8 || (x) == FFI_TYPE_SINT8) 54 + #define FFI_TYPE_2_BYTE(x) ((x) == FFI_TYPE_UINT16 || (x) == FFI_TYPE_SINT16) 55 + #define FFI_TYPE_4_BYTE(x) \ 56 + ((x) == FFI_TYPE_UINT32 || (x) == FFI_TYPE_SINT32 ||\ 57 + (x) == FFI_TYPE_INT || (x) == FFI_TYPE_FLOAT) 58 + 59 + #if !defined(LIBFFI_ASM) 60 + 61 + enum { 62 + FLAG_RETURNS_NOTHING = 1 << (31 - 30), // cr7 63 + FLAG_RETURNS_FP = 1 << (31 - 29), 64 + FLAG_RETURNS_64BITS = 1 << (31 - 28), 65 + FLAG_RETURNS_128BITS = 1 << (31 - 31), 66 + 67 + FLAG_RETURNS_STRUCT = 1 << (31 - 27), // cr6 68 + FLAG_STRUCT_CONTAINS_FP = 1 << (31 - 26), 69 + 70 + FLAG_ARG_NEEDS_COPY = 1 << (31 - 7), 71 + FLAG_FP_ARGUMENTS = 1 << (31 - 6), // cr1.eq; specified by ABI 72 + FLAG_4_GPR_ARGUMENTS = 1 << (31 - 5), 73 + FLAG_RETVAL_REFERENCE = 1 << (31 - 4) 74 + }; 75 + 76 + #if defined(__ppc64__) 77 + void ffi64_struct_to_ram_form(const ffi_type*, const char*, unsigned int*, 78 + const char*, unsigned int*, unsigned int*, char*, unsigned int*); 79 + void ffi64_struct_to_reg_form(const ffi_type*, const char*, unsigned int*, 80 + unsigned int*, char*, unsigned int*, char*, unsigned int*); 81 + bool ffi64_stret_needs_ptr(const ffi_type* inType, 82 + unsigned short*, unsigned short*); 83 + #endif 84 + 85 + #endif // !defined(LIBFFI_ASM)
+308
src/libffi/powerpc/ppc-darwin_closure.S
··· 1 + #if defined(__ppc__) 2 + 3 + /* ----------------------------------------------------------------------- 4 + ppc-darwin_closure.S - Copyright (c) 2002, 2003, 2004, Free Software Foundation, 5 + Inc. based on ppc_closure.S 6 + 7 + PowerPC Assembly glue. 8 + 9 + Permission is hereby granted, free of charge, to any person obtaining 10 + a copy of this software and associated documentation files (the 11 + ``Software''), to deal in the Software without restriction, including 12 + without limitation the rights to use, copy, modify, merge, publish, 13 + distribute, sublicense, and/or sell copies of the Software, and to 14 + permit persons to whom the Software is furnished to do so, subject to 15 + the following conditions: 16 + 17 + The above copyright notice and this permission notice shall be included 18 + in all copies or substantial portions of the Software. 19 + 20 + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS 21 + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 23 + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR 24 + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 25 + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 + OTHER DEALINGS IN THE SOFTWARE. 27 + ----------------------------------------------------------------------- */ 28 + 29 + #define LIBFFI_ASM 30 + 31 + #include <ffi.h> 32 + #include <ppc-ffitarget.h> // for FFI_TRAMPOLINE_SIZE 33 + #include <ppc-darwin.h> 34 + #include <architecture/ppc/mode_independent_asm.h> 35 + 36 + .file "ppc-darwin_closure.S" 37 + .text 38 + .align LOG2_GPR_BYTES 39 + .globl _ffi_closure_ASM 40 + 41 + .text 42 + .align LOG2_GPR_BYTES 43 + 44 + _ffi_closure_ASM: 45 + LFB1: 46 + mflr r0 // Save return address 47 + stg r0,SF_RETURN(r1) 48 + 49 + LCFI0: 50 + /* 24/48 bytes (Linkage Area) 51 + 32/64 bytes (outgoing parameter area, always reserved) 52 + 104 bytes (13*8 from FPR) 53 + 16/32 bytes (result) 54 + 176/232 total bytes */ 55 + 56 + /* skip over caller save area and keep stack aligned to 16/32. */ 57 + stgu r1,-SF_ROUND(176)(r1) 58 + 59 + LCFI1: 60 + /* We want to build up an area for the parameters passed 61 + in registers. (both floating point and integer) */ 62 + 63 + /* 176/256 bytes (callee stack frame aligned to 16/32) 64 + 24/48 bytes (caller linkage area) 65 + 200/304 (start of caller parameter area aligned to 4/8) 66 + */ 67 + 68 + /* Save GPRs 3 - 10 (aligned to 4/8) 69 + in the parents outgoing area. */ 70 + stg r3,200(r1) 71 + stg r4,204(r1) 72 + stg r5,208(r1) 73 + stg r6,212(r1) 74 + stg r7,216(r1) 75 + stg r8,220(r1) 76 + stg r9,224(r1) 77 + stg r10,228(r1) 78 + 79 + /* Save FPRs 1 - 13. (aligned to 8) */ 80 + stfd f1,56(r1) 81 + stfd f2,64(r1) 82 + stfd f3,72(r1) 83 + stfd f4,80(r1) 84 + stfd f5,88(r1) 85 + stfd f6,96(r1) 86 + stfd f7,104(r1) 87 + stfd f8,112(r1) 88 + stfd f9,120(r1) 89 + stfd f10,128(r1) 90 + stfd f11,136(r1) 91 + stfd f12,144(r1) 92 + stfd f13,152(r1) 93 + 94 + // Set up registers for the routine that actually does the work. 95 + mr r3,r11 // context pointer from the trampoline 96 + addi r4,r1,160 // result storage 97 + addi r5,r1,200 // saved GPRs 98 + addi r6,r1,56 // saved FPRs 99 + bl Lffi_closure_helper_DARWIN$stub 100 + 101 + /* Now r3 contains the return type. Use it to look up in a table 102 + so we know how to deal with each type. */ 103 + addi r5,r1,160 // Copy result storage pointer. 104 + bl Lget_ret_type0_addr // Get pointer to Lret_type0 into LR. 105 + mflr r4 // Move to r4. 106 + slwi r3,r3,4 // Multiply return type by 16. 107 + add r3,r3,r4 // Add contents of table to table address. 108 + mtctr r3 109 + bctr 110 + 111 + LFE1: 112 + /* Each of the ret_typeX code fragments has to be exactly 16 bytes long 113 + (4 instructions). For cache effectiveness we align to a 16 byte boundary 114 + first. */ 115 + .align 4 116 + nop 117 + nop 118 + nop 119 + 120 + Lget_ret_type0_addr: 121 + blrl 122 + 123 + /* case FFI_TYPE_VOID */ 124 + Lret_type0: 125 + b Lfinish 126 + nop 127 + nop 128 + nop 129 + 130 + /* case FFI_TYPE_INT */ 131 + Lret_type1: 132 + lwz r3,0(r5) 133 + b Lfinish 134 + nop 135 + nop 136 + 137 + /* case FFI_TYPE_FLOAT */ 138 + Lret_type2: 139 + lfs f1,0(r5) 140 + b Lfinish 141 + nop 142 + nop 143 + 144 + /* case FFI_TYPE_DOUBLE */ 145 + Lret_type3: 146 + lfd f1,0(r5) 147 + b Lfinish 148 + nop 149 + nop 150 + 151 + /* case FFI_TYPE_LONGDOUBLE */ 152 + Lret_type4: 153 + lfd f1,0(r5) 154 + lfd f2,8(r5) 155 + b Lfinish 156 + nop 157 + 158 + /* case FFI_TYPE_UINT8 */ 159 + Lret_type5: 160 + lbz r3,3(r5) 161 + b Lfinish 162 + nop 163 + nop 164 + 165 + /* case FFI_TYPE_SINT8 */ 166 + Lret_type6: 167 + lbz r3,3(r5) 168 + extsb r3,r3 169 + b Lfinish 170 + nop 171 + 172 + /* case FFI_TYPE_UINT16 */ 173 + Lret_type7: 174 + lhz r3,2(r5) 175 + b Lfinish 176 + nop 177 + nop 178 + 179 + /* case FFI_TYPE_SINT16 */ 180 + Lret_type8: 181 + lha r3,2(r5) 182 + b Lfinish 183 + nop 184 + nop 185 + 186 + /* case FFI_TYPE_UINT32 */ 187 + Lret_type9: // same as Lret_type1 188 + lwz r3,0(r5) 189 + b Lfinish 190 + nop 191 + nop 192 + 193 + /* case FFI_TYPE_SINT32 */ 194 + Lret_type10: // same as Lret_type1 195 + lwz r3,0(r5) 196 + b Lfinish 197 + nop 198 + nop 199 + 200 + /* case FFI_TYPE_UINT64 */ 201 + Lret_type11: 202 + lwz r3,0(r5) 203 + lwz r4,4(r5) 204 + b Lfinish 205 + nop 206 + 207 + /* case FFI_TYPE_SINT64 */ 208 + Lret_type12: // same as Lret_type11 209 + lwz r3,0(r5) 210 + lwz r4,4(r5) 211 + b Lfinish 212 + nop 213 + 214 + /* case FFI_TYPE_STRUCT */ 215 + Lret_type13: 216 + b Lfinish 217 + nop 218 + nop 219 + nop 220 + 221 + /* End 16-byte aligned cases */ 222 + /* case FFI_TYPE_POINTER */ 223 + // This case assumes that FFI_TYPE_POINTER == FFI_TYPE_LAST. If more types 224 + // are added in future, the following code will need to be updated and 225 + // padded to 16 bytes. 226 + Lret_type14: 227 + lg r3,0(r5) 228 + // fall through 229 + 230 + /* case done */ 231 + Lfinish: 232 + addi r1,r1,SF_ROUND(176) // Restore stack pointer. 233 + lg r0,SF_RETURN(r1) // Restore return address. 234 + mtlr r0 // Restore link register. 235 + blr 236 + 237 + /* END(ffi_closure_ASM) */ 238 + 239 + .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support 240 + EH_frame1: 241 + .set L$set$0,LECIE1-LSCIE1 242 + .long L$set$0 ; Length of Common Information Entry 243 + LSCIE1: 244 + .long 0x0 ; CIE Identifier Tag 245 + .byte 0x1 ; CIE Version 246 + .ascii "zR\0" ; CIE Augmentation 247 + .byte 0x1 ; uleb128 0x1; CIE Code Alignment Factor 248 + .byte 0x7c ; sleb128 -4; CIE Data Alignment Factor 249 + .byte 0x41 ; CIE RA Column 250 + .byte 0x1 ; uleb128 0x1; Augmentation size 251 + .byte 0x10 ; FDE Encoding (pcrel) 252 + .byte 0xc ; DW_CFA_def_cfa 253 + .byte 0x1 ; uleb128 0x1 254 + .byte 0x0 ; uleb128 0x0 255 + .align LOG2_GPR_BYTES 256 + LECIE1: 257 + .globl _ffi_closure_ASM.eh 258 + _ffi_closure_ASM.eh: 259 + LSFDE1: 260 + .set L$set$1,LEFDE1-LASFDE1 261 + .long L$set$1 ; FDE Length 262 + 263 + LASFDE1: 264 + .long LASFDE1-EH_frame1 ; FDE CIE offset 265 + .g_long LFB1-. ; FDE initial location 266 + .set L$set$3,LFE1-LFB1 267 + .g_long L$set$3 ; FDE address range 268 + .byte 0x0 ; uleb128 0x0; Augmentation size 269 + .byte 0x4 ; DW_CFA_advance_loc4 270 + .set L$set$3,LCFI1-LCFI0 271 + .long L$set$3 272 + .byte 0xe ; DW_CFA_def_cfa_offset 273 + .byte 176,1 ; uleb128 176 274 + .byte 0x4 ; DW_CFA_advance_loc4 275 + .set L$set$4,LCFI0-LFB1 276 + .long L$set$4 277 + .byte 0x11 ; DW_CFA_offset_extended_sf 278 + .byte 0x41 ; uleb128 0x41 279 + .byte 0x7e ; sleb128 -2 280 + .align LOG2_GPR_BYTES 281 + 282 + LEFDE1: 283 + .data 284 + .align LOG2_GPR_BYTES 285 + LDFCM0: 286 + .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32 287 + .align LOG2_GPR_BYTES 288 + 289 + Lffi_closure_helper_DARWIN$stub: 290 + .indirect_symbol _ffi_closure_helper_DARWIN 291 + mflr r0 292 + bcl 20,31,LO$ffi_closure_helper_DARWIN 293 + 294 + LO$ffi_closure_helper_DARWIN: 295 + mflr r11 296 + addis r11,r11,ha16(L_ffi_closure_helper_DARWIN$lazy_ptr - LO$ffi_closure_helper_DARWIN) 297 + mtlr r0 298 + lgu r12,lo16(L_ffi_closure_helper_DARWIN$lazy_ptr - LO$ffi_closure_helper_DARWIN)(r11) 299 + mtctr r12 300 + bctr 301 + 302 + .lazy_symbol_pointer 303 + L_ffi_closure_helper_DARWIN$lazy_ptr: 304 + .indirect_symbol _ffi_closure_helper_DARWIN 305 + .g_long dyld_stub_binding_helper 306 + 307 + 308 + #endif // __ppc__
+1767
src/libffi/powerpc/ppc-ffi_darwin.c
··· 1 + #if defined(__ppc__) || defined(__ppc64__) 2 + 3 + /* ----------------------------------------------------------------------- 4 + ffi.c - Copyright (c) 1998 Geoffrey Keating 5 + 6 + PowerPC Foreign Function Interface 7 + 8 + Darwin ABI support (c) 2001 John Hornkvist 9 + AIX ABI support (c) 2002 Free Software Foundation, Inc. 10 + 11 + Permission is hereby granted, free of charge, to any person obtaining 12 + a copy of this software and associated documentation files (the 13 + ``Software''), to deal in the Software without restriction, including 14 + without limitation the rights to use, copy, modify, merge, publish, 15 + distribute, sublicense, and/or sell copies of the Software, and to 16 + permit persons to whom the Software is furnished to do so, subject to 17 + the following conditions: 18 + 19 + The above copyright notice and this permission notice shall be included 20 + in all copies or substantial portions of the Software. 21 + 22 + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS 23 + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 25 + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR 26 + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 27 + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 + OTHER DEALINGS IN THE SOFTWARE. 29 + ----------------------------------------------------------------------- */ 30 + 31 + #include <ffi.h> 32 + #include <ffi_common.h> 33 + 34 + #include <stdbool.h> 35 + #include <stdio.h> 36 + #include <stdlib.h> 37 + #include <ppc-darwin.h> 38 + #include <architecture/ppc/mode_independent_asm.h> 39 + 40 + #if defined(POWERPC_DARWIN) 41 + #include <libkern/OSCacheControl.h> // for sys_icache_invalidate() 42 + #endif 43 + 44 + extern void ffi_closure_ASM(void); 45 + 46 + // The layout of a function descriptor. A C function pointer really 47 + // points to one of these. 48 + typedef struct aix_fd_struct { 49 + void* code_pointer; 50 + void* toc; 51 + } aix_fd; 52 + 53 + /* ffi_prep_args is called by the assembly routine once stack space 54 + has been allocated for the function's arguments. 55 + 56 + The stack layout we want looks like this: 57 + 58 + | Return address from ffi_call_DARWIN | higher addresses 59 + |--------------------------------------------| 60 + | Previous backchain pointer 4/8 | stack pointer here 61 + |--------------------------------------------|-\ <<< on entry to 62 + | Saved r28-r31 (4/8)*4 | | ffi_call_DARWIN 63 + |--------------------------------------------| | 64 + | Parameters (at least 8*(4/8)=32/64) | | (176) +112 - +288 65 + |--------------------------------------------| | 66 + | Space for GPR2 4/8 | | 67 + |--------------------------------------------| | stack | 68 + | Reserved (4/8)*2 | | grows | 69 + |--------------------------------------------| | down V 70 + | Space for callee's LR 4/8 | | 71 + |--------------------------------------------| | lower addresses 72 + | Saved CR 4/8 | | 73 + |--------------------------------------------| | stack pointer here 74 + | Current backchain pointer 4/8 | | during 75 + |--------------------------------------------|-/ <<< ffi_call_DARWIN 76 + 77 + Note: ppc64 CR is saved in the low word of a long on the stack. 78 + */ 79 + 80 + /*@-exportheader@*/ 81 + void 82 + ffi_prep_args( 83 + extended_cif* inEcif, 84 + unsigned *const stack) 85 + /*@=exportheader@*/ 86 + { 87 + /* Copy the ecif to a local var so we can trample the arg. 88 + BC note: test this with GP later for possible problems... */ 89 + volatile extended_cif* ecif = inEcif; 90 + 91 + const unsigned bytes = ecif->cif->bytes; 92 + const unsigned flags = ecif->cif->flags; 93 + 94 + /* Cast the stack arg from int* to long*. sizeof(long) == 4 in 32-bit mode 95 + and 8 in 64-bit mode. */ 96 + unsigned long *const longStack = (unsigned long *const)stack; 97 + 98 + /* 'stacktop' points at the previous backchain pointer. */ 99 + #if defined(__ppc64__) 100 + // In ppc-darwin.s, an extra 96 bytes is reserved for the linkage area, 101 + // saved registers, and an extra FPR. 102 + unsigned long *const stacktop = 103 + (unsigned long *)(unsigned long)((char*)longStack + bytes + 96); 104 + #elif defined(__ppc__) 105 + unsigned long *const stacktop = longStack + (bytes / sizeof(long)); 106 + #else 107 + #error undefined architecture 108 + #endif 109 + 110 + /* 'fpr_base' points at the space for fpr1, and grows upwards as 111 + we use FPR registers. */ 112 + double* fpr_base = (double*)(stacktop - ASM_NEEDS_REGISTERS) - 113 + NUM_FPR_ARG_REGISTERS; 114 + 115 + #if defined(__ppc64__) 116 + // 64-bit saves an extra register, and uses an extra FPR. Knock fpr_base 117 + // down a couple pegs. 118 + fpr_base -= 2; 119 + #endif 120 + 121 + unsigned int fparg_count = 0; 122 + 123 + /* 'next_arg' grows up as we put parameters in it. */ 124 + unsigned long* next_arg = longStack + 6; /* 6 reserved positions. */ 125 + 126 + int i; 127 + double double_tmp; 128 + void** p_argv = ecif->avalue; 129 + unsigned long gprvalue; 130 + ffi_type** ptr = ecif->cif->arg_types; 131 + 132 + /* Check that everything starts aligned properly. */ 133 + FFI_ASSERT(stack == SF_ROUND(stack)); 134 + FFI_ASSERT(stacktop == SF_ROUND(stacktop)); 135 + FFI_ASSERT(bytes == SF_ROUND(bytes)); 136 + 137 + /* Deal with return values that are actually pass-by-reference. 138 + Rule: 139 + Return values are referenced by r3, so r4 is the first parameter. */ 140 + 141 + if (flags & FLAG_RETVAL_REFERENCE) 142 + *next_arg++ = (unsigned long)(char*)ecif->rvalue; 143 + 144 + /* Now for the arguments. */ 145 + for (i = ecif->cif->nargs; i > 0; i--, ptr++, p_argv++) 146 + { 147 + switch ((*ptr)->type) 148 + { 149 + /* If a floating-point parameter appears before all of the general- 150 + purpose registers are filled, the corresponding GPRs that match 151 + the size of the floating-point parameter are shadowed for the 152 + benefit of vararg and pre-ANSI functions. */ 153 + case FFI_TYPE_FLOAT: 154 + double_tmp = *(float*)*p_argv; 155 + 156 + if (fparg_count < NUM_FPR_ARG_REGISTERS) 157 + *fpr_base++ = double_tmp; 158 + 159 + *(double*)next_arg = double_tmp; 160 + 161 + next_arg++; 162 + fparg_count++; 163 + FFI_ASSERT(flags & FLAG_FP_ARGUMENTS); 164 + 165 + break; 166 + 167 + case FFI_TYPE_DOUBLE: 168 + double_tmp = *(double*)*p_argv; 169 + 170 + if (fparg_count < NUM_FPR_ARG_REGISTERS) 171 + *fpr_base++ = double_tmp; 172 + 173 + *(double*)next_arg = double_tmp; 174 + 175 + next_arg += MODE_CHOICE(2,1); 176 + fparg_count++; 177 + FFI_ASSERT(flags & FLAG_FP_ARGUMENTS); 178 + 179 + break; 180 + 181 + #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE 182 + case FFI_TYPE_LONGDOUBLE: 183 + #if defined(__ppc64__) 184 + if (fparg_count < NUM_FPR_ARG_REGISTERS) 185 + *(long double*)fpr_base = *(long double*)*p_argv; 186 + #elif defined(__ppc__) 187 + if (fparg_count < NUM_FPR_ARG_REGISTERS - 1) 188 + *(long double*)fpr_base = *(long double*)*p_argv; 189 + else if (fparg_count == NUM_FPR_ARG_REGISTERS - 1) 190 + *(double*)fpr_base = *(double*)*p_argv; 191 + #else 192 + #error undefined architecture 193 + #endif 194 + 195 + *(long double*)next_arg = *(long double*)*p_argv; 196 + fparg_count += 2; 197 + fpr_base += 2; 198 + next_arg += MODE_CHOICE(4,2); 199 + FFI_ASSERT(flags & FLAG_FP_ARGUMENTS); 200 + 201 + break; 202 + #endif // FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE 203 + 204 + case FFI_TYPE_UINT64: 205 + case FFI_TYPE_SINT64: 206 + #if defined(__ppc64__) 207 + gprvalue = *(long long*)*p_argv; 208 + goto putgpr; 209 + #elif defined(__ppc__) 210 + *(long long*)next_arg = *(long long*)*p_argv; 211 + next_arg += 2; 212 + break; 213 + #else 214 + #error undefined architecture 215 + #endif 216 + 217 + case FFI_TYPE_POINTER: 218 + gprvalue = *(unsigned long*)*p_argv; 219 + goto putgpr; 220 + 221 + case FFI_TYPE_UINT8: 222 + gprvalue = *(unsigned char*)*p_argv; 223 + goto putgpr; 224 + 225 + case FFI_TYPE_SINT8: 226 + gprvalue = *(signed char*)*p_argv; 227 + goto putgpr; 228 + 229 + case FFI_TYPE_UINT16: 230 + gprvalue = *(unsigned short*)*p_argv; 231 + goto putgpr; 232 + 233 + case FFI_TYPE_SINT16: 234 + gprvalue = *(signed short*)*p_argv; 235 + goto putgpr; 236 + 237 + case FFI_TYPE_STRUCT: 238 + { 239 + #if defined(__ppc64__) 240 + unsigned int gprSize = 0; 241 + unsigned int fprSize = 0; 242 + 243 + ffi64_struct_to_reg_form(*ptr, (char*)*p_argv, NULL, &fparg_count, 244 + (char*)next_arg, &gprSize, (char*)fpr_base, &fprSize); 245 + next_arg += gprSize / sizeof(long); 246 + fpr_base += fprSize / sizeof(double); 247 + 248 + #elif defined(__ppc__) 249 + char* dest_cpy = (char*)next_arg; 250 + 251 + /* Structures that match the basic modes (QI 1 byte, HI 2 bytes, 252 + SI 4 bytes) are aligned as if they were those modes. 253 + Structures with 3 byte in size are padded upwards. */ 254 + unsigned size_al = (*ptr)->size; 255 + 256 + /* If the first member of the struct is a double, then align 257 + the struct to double-word. */ 258 + if ((*ptr)->elements[0]->type == FFI_TYPE_DOUBLE) 259 + size_al = ALIGN((*ptr)->size, 8); 260 + 261 + if (ecif->cif->abi == FFI_DARWIN) 262 + { 263 + if (size_al < 3) 264 + dest_cpy += 4 - size_al; 265 + } 266 + 267 + memcpy((char*)dest_cpy, (char*)*p_argv, size_al); 268 + next_arg += (size_al + 3) / 4; 269 + #else 270 + #error undefined architecture 271 + #endif 272 + break; 273 + } 274 + 275 + case FFI_TYPE_INT: 276 + case FFI_TYPE_UINT32: 277 + case FFI_TYPE_SINT32: 278 + gprvalue = *(unsigned*)*p_argv; 279 + 280 + putgpr: 281 + *next_arg++ = gprvalue; 282 + break; 283 + 284 + default: 285 + break; 286 + } 287 + } 288 + 289 + /* Check that we didn't overrun the stack... */ 290 + //FFI_ASSERT(gpr_base <= stacktop - ASM_NEEDS_REGISTERS); 291 + //FFI_ASSERT((unsigned *)fpr_base 292 + // <= stacktop - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS); 293 + //FFI_ASSERT(flags & FLAG_4_GPR_ARGUMENTS || intarg_count <= 4); 294 + } 295 + 296 + #if defined(__ppc64__) 297 + 298 + bool 299 + ffi64_struct_contains_fp( 300 + const ffi_type* inType) 301 + { 302 + bool containsFP = false; 303 + unsigned int i; 304 + 305 + for (i = 0; inType->elements[i] != NULL && !containsFP; i++) 306 + { 307 + if (inType->elements[i]->type == FFI_TYPE_FLOAT || 308 + inType->elements[i]->type == FFI_TYPE_DOUBLE || 309 + inType->elements[i]->type == FFI_TYPE_LONGDOUBLE) 310 + containsFP = true; 311 + else if (inType->elements[i]->type == FFI_TYPE_STRUCT) 312 + containsFP = ffi64_struct_contains_fp(inType->elements[i]); 313 + } 314 + 315 + return containsFP; 316 + } 317 + 318 + #endif // defined(__ppc64__) 319 + 320 + /* Perform machine dependent cif processing. */ 321 + ffi_status 322 + ffi_prep_cif_machdep( 323 + ffi_cif* cif) 324 + { 325 + /* All this is for the DARWIN ABI. */ 326 + int i; 327 + ffi_type** ptr; 328 + int intarg_count = 0; 329 + int fparg_count = 0; 330 + unsigned int flags = 0; 331 + unsigned int size_al = 0; 332 + 333 + /* All the machine-independent calculation of cif->bytes will be wrong. 334 + Redo the calculation for DARWIN. */ 335 + 336 + /* Space for the frame pointer, callee's LR, CR, etc, and for 337 + the asm's temp regs. */ 338 + unsigned int bytes = (6 + ASM_NEEDS_REGISTERS) * sizeof(long); 339 + 340 + /* Return value handling. The rules are as follows: 341 + - 32-bit (or less) integer values are returned in gpr3; 342 + - Structures of size <= 4 bytes also returned in gpr3; 343 + - 64-bit integer values and structures between 5 and 8 bytes are 344 + returned in gpr3 and gpr4; 345 + - Single/double FP values are returned in fpr1; 346 + - Long double FP (if not equivalent to double) values are returned in 347 + fpr1 and fpr2; 348 + - Larger structures values are allocated space and a pointer is passed 349 + as the first argument. */ 350 + switch (cif->rtype->type) 351 + { 352 + #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE 353 + case FFI_TYPE_LONGDOUBLE: 354 + flags |= FLAG_RETURNS_128BITS; 355 + flags |= FLAG_RETURNS_FP; 356 + break; 357 + #endif // FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE 358 + 359 + case FFI_TYPE_DOUBLE: 360 + flags |= FLAG_RETURNS_64BITS; 361 + /* Fall through. */ 362 + case FFI_TYPE_FLOAT: 363 + flags |= FLAG_RETURNS_FP; 364 + break; 365 + 366 + #if defined(__ppc64__) 367 + case FFI_TYPE_POINTER: 368 + #endif 369 + case FFI_TYPE_UINT64: 370 + case FFI_TYPE_SINT64: 371 + flags |= FLAG_RETURNS_64BITS; 372 + break; 373 + 374 + case FFI_TYPE_STRUCT: 375 + { 376 + #if defined(__ppc64__) 377 + 378 + if (ffi64_stret_needs_ptr(cif->rtype, NULL, NULL)) 379 + { 380 + flags |= FLAG_RETVAL_REFERENCE; 381 + flags |= FLAG_RETURNS_NOTHING; 382 + intarg_count++; 383 + } 384 + else 385 + { 386 + flags |= FLAG_RETURNS_STRUCT; 387 + 388 + if (ffi64_struct_contains_fp(cif->rtype)) 389 + flags |= FLAG_STRUCT_CONTAINS_FP; 390 + } 391 + 392 + #elif defined(__ppc__) 393 + 394 + flags |= FLAG_RETVAL_REFERENCE; 395 + flags |= FLAG_RETURNS_NOTHING; 396 + intarg_count++; 397 + 398 + #else 399 + #error undefined architecture 400 + #endif 401 + break; 402 + } 403 + 404 + case FFI_TYPE_VOID: 405 + flags |= FLAG_RETURNS_NOTHING; 406 + break; 407 + 408 + default: 409 + /* Returns 32-bit integer, or similar. Nothing to do here. */ 410 + break; 411 + } 412 + 413 + /* The first NUM_GPR_ARG_REGISTERS words of integer arguments, and the 414 + first NUM_FPR_ARG_REGISTERS fp arguments, go in registers; the rest 415 + goes on the stack. Structures are passed as a pointer to a copy of 416 + the structure. Stuff on the stack needs to keep proper alignment. */ 417 + for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) 418 + { 419 + switch ((*ptr)->type) 420 + { 421 + case FFI_TYPE_FLOAT: 422 + case FFI_TYPE_DOUBLE: 423 + fparg_count++; 424 + /* If this FP arg is going on the stack, it must be 425 + 8-byte-aligned. */ 426 + if (fparg_count > NUM_FPR_ARG_REGISTERS 427 + && intarg_count % 2 != 0) 428 + intarg_count++; 429 + break; 430 + 431 + #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE 432 + case FFI_TYPE_LONGDOUBLE: 433 + fparg_count += 2; 434 + /* If this FP arg is going on the stack, it must be 435 + 8-byte-aligned. */ 436 + 437 + if ( 438 + #if defined(__ppc64__) 439 + fparg_count > NUM_FPR_ARG_REGISTERS + 1 440 + #elif defined(__ppc__) 441 + fparg_count > NUM_FPR_ARG_REGISTERS 442 + #else 443 + #error undefined architecture 444 + #endif 445 + && intarg_count % 2 != 0) 446 + intarg_count++; 447 + 448 + intarg_count += 2; 449 + break; 450 + #endif // FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE 451 + 452 + case FFI_TYPE_UINT64: 453 + case FFI_TYPE_SINT64: 454 + /* 'long long' arguments are passed as two words, but 455 + either both words must fit in registers or both go 456 + on the stack. If they go on the stack, they must 457 + be 8-byte-aligned. */ 458 + if (intarg_count == NUM_GPR_ARG_REGISTERS - 1 459 + || (intarg_count >= NUM_GPR_ARG_REGISTERS 460 + && intarg_count % 2 != 0)) 461 + intarg_count++; 462 + 463 + intarg_count += MODE_CHOICE(2,1); 464 + 465 + break; 466 + 467 + case FFI_TYPE_STRUCT: 468 + size_al = (*ptr)->size; 469 + /* If the first member of the struct is a double, then align 470 + the struct to double-word. */ 471 + if ((*ptr)->elements[0]->type == FFI_TYPE_DOUBLE) 472 + size_al = ALIGN((*ptr)->size, 8); 473 + 474 + #if defined(__ppc64__) 475 + // Look for FP struct members. 476 + unsigned int j; 477 + 478 + for (j = 0; (*ptr)->elements[j] != NULL; j++) 479 + { 480 + if ((*ptr)->elements[j]->type == FFI_TYPE_FLOAT || 481 + (*ptr)->elements[j]->type == FFI_TYPE_DOUBLE) 482 + { 483 + fparg_count++; 484 + 485 + if (fparg_count > NUM_FPR_ARG_REGISTERS) 486 + intarg_count++; 487 + } 488 + else if ((*ptr)->elements[j]->type == FFI_TYPE_LONGDOUBLE) 489 + { 490 + fparg_count += 2; 491 + 492 + if (fparg_count > NUM_FPR_ARG_REGISTERS + 1) 493 + intarg_count += 2; 494 + } 495 + else 496 + intarg_count++; 497 + } 498 + #elif defined(__ppc__) 499 + intarg_count += (size_al + 3) / 4; 500 + #else 501 + #error undefined architecture 502 + #endif 503 + 504 + break; 505 + 506 + default: 507 + /* Everything else is passed as a 4/8-byte word in a GPR, either 508 + the object itself or a pointer to it. */ 509 + intarg_count++; 510 + break; 511 + } 512 + } 513 + 514 + /* Space for the FPR registers, if needed. */ 515 + if (fparg_count != 0) 516 + { 517 + flags |= FLAG_FP_ARGUMENTS; 518 + #if defined(__ppc64__) 519 + bytes += (NUM_FPR_ARG_REGISTERS + 1) * sizeof(double); 520 + #elif defined(__ppc__) 521 + bytes += NUM_FPR_ARG_REGISTERS * sizeof(double); 522 + #else 523 + #error undefined architecture 524 + #endif 525 + } 526 + 527 + /* Stack space. */ 528 + #if defined(__ppc64__) 529 + if ((intarg_count + fparg_count) > NUM_GPR_ARG_REGISTERS) 530 + bytes += (intarg_count + fparg_count) * sizeof(long); 531 + #elif defined(__ppc__) 532 + if ((intarg_count + 2 * fparg_count) > NUM_GPR_ARG_REGISTERS) 533 + bytes += (intarg_count + 2 * fparg_count) * sizeof(long); 534 + #else 535 + #error undefined architecture 536 + #endif 537 + else 538 + bytes += NUM_GPR_ARG_REGISTERS * sizeof(long); 539 + 540 + /* The stack space allocated needs to be a multiple of 16/32 bytes. */ 541 + bytes = SF_ROUND(bytes); 542 + 543 + cif->flags = flags; 544 + cif->bytes = bytes; 545 + 546 + return FFI_OK; 547 + } 548 + 549 + /*@-declundef@*/ 550 + /*@-exportheader@*/ 551 + extern void 552 + ffi_call_AIX( 553 + /*@out@*/ extended_cif*, 554 + unsigned, 555 + unsigned, 556 + /*@out@*/ unsigned*, 557 + void (*fn)(void), 558 + void (*fn2)(extended_cif*, unsigned *const)); 559 + 560 + extern void 561 + ffi_call_DARWIN( 562 + /*@out@*/ extended_cif*, 563 + unsigned long, 564 + unsigned, 565 + /*@out@*/ unsigned*, 566 + void (*fn)(void), 567 + void (*fn2)(extended_cif*, unsigned *const)); 568 + /*@=declundef@*/ 569 + /*@=exportheader@*/ 570 + 571 + void 572 + ffi_call( 573 + /*@dependent@*/ ffi_cif* cif, 574 + void (*fn)(void), 575 + /*@out@*/ void* rvalue, 576 + /*@dependent@*/ void** avalue) 577 + { 578 + extended_cif ecif; 579 + 580 + ecif.cif = cif; 581 + ecif.avalue = avalue; 582 + 583 + /* If the return value is a struct and we don't have a return 584 + value address then we need to make one. */ 585 + if ((rvalue == NULL) && 586 + (cif->rtype->type == FFI_TYPE_STRUCT)) 587 + { 588 + /*@-sysunrecog@*/ 589 + ecif.rvalue = alloca(cif->rtype->size); 590 + /*@=sysunrecog@*/ 591 + } 592 + else 593 + ecif.rvalue = rvalue; 594 + 595 + switch (cif->abi) 596 + { 597 + case FFI_AIX: 598 + /*@-usedef@*/ 599 + ffi_call_AIX(&ecif, -cif->bytes, 600 + cif->flags, ecif.rvalue, fn, ffi_prep_args); 601 + /*@=usedef@*/ 602 + break; 603 + 604 + case FFI_DARWIN: 605 + /*@-usedef@*/ 606 + ffi_call_DARWIN(&ecif, -(long)cif->bytes, 607 + cif->flags, ecif.rvalue, fn, ffi_prep_args); 608 + /*@=usedef@*/ 609 + break; 610 + 611 + default: 612 + FFI_ASSERT(0); 613 + break; 614 + } 615 + } 616 + 617 + /* here I'd like to add the stack frame layout we use in darwin_closure.S 618 + and aix_clsoure.S 619 + 620 + SP previous -> +---------------------------------------+ <--- child frame 621 + | back chain to caller 4 | 622 + +---------------------------------------+ 4 623 + | saved CR 4 | 624 + +---------------------------------------+ 8 625 + | saved LR 4 | 626 + +---------------------------------------+ 12 627 + | reserved for compilers 4 | 628 + +---------------------------------------+ 16 629 + | reserved for binders 4 | 630 + +---------------------------------------+ 20 631 + | saved TOC pointer 4 | 632 + +---------------------------------------+ 24 633 + | always reserved 8*4=32 (previous GPRs)| 634 + | according to the linkage convention | 635 + | from AIX | 636 + +---------------------------------------+ 56 637 + | our FPR area 13*8=104 | 638 + | f1 | 639 + | . | 640 + | f13 | 641 + +---------------------------------------+ 160 642 + | result area 8 | 643 + +---------------------------------------+ 168 644 + | alignement to the next multiple of 16 | 645 + SP current --> +---------------------------------------+ 176 <- parent frame 646 + | back chain to caller 4 | 647 + +---------------------------------------+ 180 648 + | saved CR 4 | 649 + +---------------------------------------+ 184 650 + | saved LR 4 | 651 + +---------------------------------------+ 188 652 + | reserved for compilers 4 | 653 + +---------------------------------------+ 192 654 + | reserved for binders 4 | 655 + +---------------------------------------+ 196 656 + | saved TOC pointer 4 | 657 + +---------------------------------------+ 200 658 + | always reserved 8*4=32 we store our | 659 + | GPRs here | 660 + | r3 | 661 + | . | 662 + | r10 | 663 + +---------------------------------------+ 232 664 + | overflow part | 665 + +---------------------------------------+ xxx 666 + | ???? | 667 + +---------------------------------------+ xxx 668 + */ 669 + 670 + #if !defined(POWERPC_DARWIN) 671 + 672 + #define MIN_LINE_SIZE 32 673 + 674 + static void 675 + flush_icache( 676 + char* addr) 677 + { 678 + #ifndef _AIX 679 + __asm__ volatile ( 680 + "dcbf 0,%0\n" 681 + "sync\n" 682 + "icbi 0,%0\n" 683 + "sync\n" 684 + "isync" 685 + : : "r" (addr) : "memory"); 686 + #endif 687 + } 688 + 689 + static void 690 + flush_range( 691 + char* addr, 692 + int size) 693 + { 694 + int i; 695 + 696 + for (i = 0; i < size; i += MIN_LINE_SIZE) 697 + flush_icache(addr + i); 698 + 699 + flush_icache(addr + size - 1); 700 + } 701 + 702 + #endif // !defined(POWERPC_DARWIN) 703 + 704 + ffi_status 705 + ffi_prep_closure( 706 + ffi_closure* closure, 707 + ffi_cif* cif, 708 + void (*fun)(ffi_cif*, void*, void**, void*), 709 + void* user_data) 710 + { 711 + switch (cif->abi) 712 + { 713 + case FFI_DARWIN: 714 + { 715 + FFI_ASSERT (cif->abi == FFI_DARWIN); 716 + 717 + unsigned int* tramp = (unsigned int*)&closure->tramp[0]; 718 + 719 + #if defined(__ppc64__) 720 + tramp[0] = 0x7c0802a6; // mflr r0 721 + tramp[1] = 0x429f0005; // bcl 20,31,+0x8 722 + tramp[2] = 0x7d6802a6; // mflr r11 723 + tramp[3] = 0x7c0803a6; // mtlr r0 724 + tramp[4] = 0xe98b0018; // ld r12,24(r11) 725 + tramp[5] = 0x7d8903a6; // mtctr r12 726 + tramp[6] = 0xe96b0020; // ld r11,32(r11) 727 + tramp[7] = 0x4e800420; // bctr 728 + *(unsigned long*)&tramp[8] = (unsigned long)ffi_closure_ASM; 729 + *(unsigned long*)&tramp[10] = (unsigned long)closure; 730 + #elif defined(__ppc__) 731 + tramp[0] = 0x7c0802a6; // mflr r0 732 + tramp[1] = 0x429f0005; // bcl 20,31,+0x8 733 + tramp[2] = 0x7d6802a6; // mflr r11 734 + tramp[3] = 0x7c0803a6; // mtlr r0 735 + tramp[4] = 0x818b0018; // lwz r12,24(r11) 736 + tramp[5] = 0x7d8903a6; // mtctr r12 737 + tramp[6] = 0x816b001c; // lwz r11,28(r11) 738 + tramp[7] = 0x4e800420; // bctr 739 + tramp[8] = (unsigned long)ffi_closure_ASM; 740 + tramp[9] = (unsigned long)closure; 741 + #else 742 + #error undefined architecture 743 + #endif 744 + 745 + closure->cif = cif; 746 + closure->fun = fun; 747 + closure->user_data = user_data; 748 + 749 + // Flush the icache. Only necessary on Darwin. 750 + #if defined(POWERPC_DARWIN) 751 + sys_icache_invalidate(closure->tramp, FFI_TRAMPOLINE_SIZE); 752 + #else 753 + flush_range(closure->tramp, FFI_TRAMPOLINE_SIZE); 754 + #endif 755 + 756 + break; 757 + } 758 + 759 + case FFI_AIX: 760 + { 761 + FFI_ASSERT (cif->abi == FFI_AIX); 762 + 763 + ffi_aix_trampoline_struct* tramp_aix = 764 + (ffi_aix_trampoline_struct*)(closure->tramp); 765 + aix_fd* fd = (aix_fd*)(void*)ffi_closure_ASM; 766 + 767 + tramp_aix->code_pointer = fd->code_pointer; 768 + tramp_aix->toc = fd->toc; 769 + tramp_aix->static_chain = closure; 770 + closure->cif = cif; 771 + closure->fun = fun; 772 + closure->user_data = user_data; 773 + break; 774 + } 775 + 776 + default: 777 + return FFI_BAD_ABI; 778 + } 779 + 780 + return FFI_OK; 781 + } 782 + 783 + #if defined(__ppc__) 784 + typedef double ldbits[2]; 785 + 786 + typedef union 787 + { 788 + ldbits lb; 789 + long double ld; 790 + } ldu; 791 + #endif 792 + 793 + typedef union 794 + { 795 + float f; 796 + double d; 797 + } ffi_dblfl; 798 + 799 + /* The trampoline invokes ffi_closure_ASM, and on entry, r11 holds the 800 + address of the closure. After storing the registers that could possibly 801 + contain parameters to be passed into the stack frame and setting up space 802 + for a return value, ffi_closure_ASM invokes the following helper function 803 + to do most of the work. */ 804 + int 805 + ffi_closure_helper_DARWIN( 806 + ffi_closure* closure, 807 + void* rvalue, 808 + unsigned long* pgr, 809 + ffi_dblfl* pfr) 810 + { 811 + /* rvalue is the pointer to space for return value in closure assembly 812 + pgr is the pointer to where r3-r10 are stored in ffi_closure_ASM 813 + pfr is the pointer to where f1-f13 are stored in ffi_closure_ASM. */ 814 + 815 + #if defined(__ppc__) 816 + ldu temp_ld; 817 + #endif 818 + 819 + double temp; 820 + unsigned int i; 821 + unsigned int nf = 0; /* number of FPRs already used. */ 822 + unsigned int ng = 0; /* number of GPRs already used. */ 823 + ffi_cif* cif = closure->cif; 824 + long avn = cif->nargs; 825 + void** avalue = alloca(cif->nargs * sizeof(void*)); 826 + ffi_type** arg_types = cif->arg_types; 827 + 828 + /* Copy the caller's structure return value address so that the closure 829 + returns the data directly to the caller. */ 830 + #if defined(__ppc64__) 831 + if (cif->rtype->type == FFI_TYPE_STRUCT && 832 + ffi64_stret_needs_ptr(cif->rtype, NULL, NULL)) 833 + #elif defined(__ppc__) 834 + if (cif->rtype->type == FFI_TYPE_STRUCT) 835 + #else 836 + #error undefined architecture 837 + #endif 838 + { 839 + rvalue = (void*)*pgr; 840 + pgr++; 841 + ng++; 842 + } 843 + 844 + /* Grab the addresses of the arguments from the stack frame. */ 845 + for (i = 0; i < avn; i++) 846 + { 847 + switch (arg_types[i]->type) 848 + { 849 + case FFI_TYPE_SINT8: 850 + case FFI_TYPE_UINT8: 851 + avalue[i] = (char*)pgr + MODE_CHOICE(3,7); 852 + ng++; 853 + pgr++; 854 + break; 855 + 856 + case FFI_TYPE_SINT16: 857 + case FFI_TYPE_UINT16: 858 + avalue[i] = (char*)pgr + MODE_CHOICE(2,6); 859 + ng++; 860 + pgr++; 861 + break; 862 + 863 + #if defined(__ppc__) 864 + case FFI_TYPE_POINTER: 865 + #endif 866 + case FFI_TYPE_SINT32: 867 + case FFI_TYPE_UINT32: 868 + avalue[i] = (char*)pgr + MODE_CHOICE(0,4); 869 + ng++; 870 + pgr++; 871 + 872 + break; 873 + 874 + case FFI_TYPE_STRUCT: 875 + if (cif->abi == FFI_DARWIN) 876 + { 877 + #if defined(__ppc64__) 878 + unsigned int gprSize = 0; 879 + unsigned int fprSize = 0; 880 + unsigned int savedFPRSize = fprSize; 881 + 882 + avalue[i] = alloca(arg_types[i]->size); 883 + ffi64_struct_to_ram_form(arg_types[i], (const char*)pgr, 884 + &gprSize, (const char*)pfr, &fprSize, &nf, avalue[i], NULL); 885 + 886 + ng += gprSize / sizeof(long); 887 + pgr += gprSize / sizeof(long); 888 + pfr += (fprSize - savedFPRSize) / sizeof(double); 889 + 890 + #elif defined(__ppc__) 891 + /* Structures that match the basic modes (QI 1 byte, HI 2 bytes, 892 + SI 4 bytes) are aligned as if they were those modes. */ 893 + unsigned int size_al = size_al = arg_types[i]->size; 894 + 895 + /* If the first member of the struct is a double, then align 896 + the struct to double-word. */ 897 + if (arg_types[i]->elements[0]->type == FFI_TYPE_DOUBLE) 898 + size_al = ALIGN(arg_types[i]->size, 8); 899 + 900 + if (size_al < 3) 901 + avalue[i] = (void*)pgr + MODE_CHOICE(4,8) - size_al; 902 + else 903 + avalue[i] = (void*)pgr; 904 + 905 + ng += (size_al + 3) / sizeof(long); 906 + pgr += (size_al + 3) / sizeof(long); 907 + #else 908 + #error undefined architecture 909 + #endif 910 + } 911 + 912 + break; 913 + 914 + #if defined(__ppc64__) 915 + case FFI_TYPE_POINTER: 916 + #endif 917 + case FFI_TYPE_SINT64: 918 + case FFI_TYPE_UINT64: 919 + /* Long long ints are passed in 1 or 2 GPRs. */ 920 + avalue[i] = pgr; 921 + ng += MODE_CHOICE(2,1); 922 + pgr += MODE_CHOICE(2,1); 923 + 924 + break; 925 + 926 + case FFI_TYPE_FLOAT: 927 + /* A float value consumes a GPR. 928 + There are 13 64-bit floating point registers. */ 929 + if (nf < NUM_FPR_ARG_REGISTERS) 930 + { 931 + temp = pfr->d; 932 + pfr->f = (float)temp; 933 + avalue[i] = pfr; 934 + pfr++; 935 + } 936 + else 937 + avalue[i] = pgr; 938 + 939 + nf++; 940 + ng++; 941 + pgr++; 942 + break; 943 + 944 + case FFI_TYPE_DOUBLE: 945 + /* A double value consumes one or two GPRs. 946 + There are 13 64bit floating point registers. */ 947 + if (nf < NUM_FPR_ARG_REGISTERS) 948 + { 949 + avalue[i] = pfr; 950 + pfr++; 951 + } 952 + else 953 + avalue[i] = pgr; 954 + 955 + nf++; 956 + ng += MODE_CHOICE(2,1); 957 + pgr += MODE_CHOICE(2,1); 958 + 959 + break; 960 + 961 + #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE 962 + 963 + case FFI_TYPE_LONGDOUBLE: 964 + #if defined(__ppc64__) 965 + if (nf < NUM_FPR_ARG_REGISTERS) 966 + { 967 + avalue[i] = pfr; 968 + pfr += 2; 969 + } 970 + #elif defined(__ppc__) 971 + /* A long double value consumes 2/4 GPRs and 2 FPRs. 972 + There are 13 64bit floating point registers. */ 973 + if (nf < NUM_FPR_ARG_REGISTERS - 1) 974 + { 975 + avalue[i] = pfr; 976 + pfr += 2; 977 + } 978 + /* Here we have the situation where one part of the long double 979 + is stored in fpr13 and the other part is already on the stack. 980 + We use a union to pass the long double to avalue[i]. */ 981 + else if (nf == NUM_FPR_ARG_REGISTERS - 1) 982 + { 983 + memcpy (&temp_ld.lb[0], pfr, sizeof(temp_ld.lb[0])); 984 + memcpy (&temp_ld.lb[1], pgr + 2, sizeof(temp_ld.lb[1])); 985 + avalue[i] = &temp_ld.ld; 986 + } 987 + #else 988 + #error undefined architecture 989 + #endif 990 + else 991 + avalue[i] = pgr; 992 + 993 + nf += 2; 994 + ng += MODE_CHOICE(4,2); 995 + pgr += MODE_CHOICE(4,2); 996 + 997 + break; 998 + 999 + #endif /* FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE */ 1000 + 1001 + default: 1002 + FFI_ASSERT(0); 1003 + break; 1004 + } 1005 + } 1006 + 1007 + (closure->fun)(cif, rvalue, avalue, closure->user_data); 1008 + 1009 + /* Tell ffi_closure_ASM to perform return type promotions. */ 1010 + return cif->rtype->type; 1011 + } 1012 + 1013 + #if defined(__ppc64__) 1014 + 1015 + /* ffi64_struct_to_ram_form 1016 + 1017 + Rebuild a struct's natural layout from buffers of concatenated registers. 1018 + Return the number of registers used. 1019 + inGPRs[0-7] == r3, inFPRs[0-7] == f1 ... 1020 + */ 1021 + void 1022 + ffi64_struct_to_ram_form( 1023 + const ffi_type* inType, 1024 + const char* inGPRs, 1025 + unsigned int* ioGPRMarker, 1026 + const char* inFPRs, 1027 + unsigned int* ioFPRMarker, 1028 + unsigned int* ioFPRsUsed, 1029 + char* outStruct, // caller-allocated 1030 + unsigned int* ioStructMarker) 1031 + { 1032 + unsigned int srcGMarker = 0; 1033 + unsigned int srcFMarker = 0; 1034 + unsigned int savedFMarker = 0; 1035 + unsigned int fprsUsed = 0; 1036 + unsigned int savedFPRsUsed = 0; 1037 + unsigned int destMarker = 0; 1038 + 1039 + static unsigned int recurseCount = 0; 1040 + 1041 + if (ioGPRMarker) 1042 + srcGMarker = *ioGPRMarker; 1043 + 1044 + if (ioFPRMarker) 1045 + { 1046 + srcFMarker = *ioFPRMarker; 1047 + savedFMarker = srcFMarker; 1048 + } 1049 + 1050 + if (ioFPRsUsed) 1051 + { 1052 + fprsUsed = *ioFPRsUsed; 1053 + savedFPRsUsed = fprsUsed; 1054 + } 1055 + 1056 + if (ioStructMarker) 1057 + destMarker = *ioStructMarker; 1058 + 1059 + size_t i; 1060 + 1061 + switch (inType->size) 1062 + { 1063 + case 1: case 2: case 4: 1064 + srcGMarker += 8 - inType->size; 1065 + break; 1066 + 1067 + default: 1068 + break; 1069 + } 1070 + 1071 + for (i = 0; inType->elements[i] != NULL; i++) 1072 + { 1073 + switch (inType->elements[i]->type) 1074 + { 1075 + case FFI_TYPE_FLOAT: 1076 + srcFMarker = ALIGN(srcFMarker, 4); 1077 + srcGMarker = ALIGN(srcGMarker, 4); 1078 + destMarker = ALIGN(destMarker, 4); 1079 + 1080 + if (fprsUsed < NUM_FPR_ARG_REGISTERS) 1081 + { 1082 + *(float*)&outStruct[destMarker] = 1083 + (float)*(double*)&inFPRs[srcFMarker]; 1084 + srcFMarker += 8; 1085 + fprsUsed++; 1086 + } 1087 + else 1088 + *(float*)&outStruct[destMarker] = 1089 + (float)*(double*)&inGPRs[srcGMarker]; 1090 + 1091 + srcGMarker += 4; 1092 + destMarker += 4; 1093 + 1094 + // Skip to next GPR if next element won't fit and we're 1095 + // not already at a register boundary. 1096 + if (inType->elements[i + 1] != NULL && (destMarker % 8)) 1097 + { 1098 + if (!FFI_TYPE_1_BYTE(inType->elements[i + 1]->type) && 1099 + (!FFI_TYPE_2_BYTE(inType->elements[i + 1]->type) || 1100 + (ALIGN(srcGMarker, 8) - srcGMarker) < 2) && 1101 + (!FFI_TYPE_4_BYTE(inType->elements[i + 1]->type) || 1102 + (ALIGN(srcGMarker, 8) - srcGMarker) < 4)) 1103 + srcGMarker = ALIGN(srcGMarker, 8); 1104 + } 1105 + 1106 + break; 1107 + 1108 + case FFI_TYPE_DOUBLE: 1109 + srcFMarker = ALIGN(srcFMarker, 8); 1110 + destMarker = ALIGN(destMarker, 8); 1111 + 1112 + if (fprsUsed < NUM_FPR_ARG_REGISTERS) 1113 + { 1114 + *(double*)&outStruct[destMarker] = 1115 + *(double*)&inFPRs[srcFMarker]; 1116 + srcFMarker += 8; 1117 + fprsUsed++; 1118 + } 1119 + else 1120 + *(double*)&outStruct[destMarker] = 1121 + *(double*)&inGPRs[srcGMarker]; 1122 + 1123 + destMarker += 8; 1124 + 1125 + // Skip next GPR 1126 + srcGMarker += 8; 1127 + srcGMarker = ALIGN(srcGMarker, 8); 1128 + 1129 + break; 1130 + 1131 + case FFI_TYPE_LONGDOUBLE: 1132 + destMarker = ALIGN(destMarker, 16); 1133 + 1134 + if (fprsUsed < NUM_FPR_ARG_REGISTERS) 1135 + { 1136 + srcFMarker = ALIGN(srcFMarker, 8); 1137 + srcGMarker = ALIGN(srcGMarker, 8); 1138 + *(long double*)&outStruct[destMarker] = 1139 + *(long double*)&inFPRs[srcFMarker]; 1140 + srcFMarker += 16; 1141 + fprsUsed += 2; 1142 + } 1143 + else 1144 + { 1145 + srcFMarker = ALIGN(srcFMarker, 16); 1146 + srcGMarker = ALIGN(srcGMarker, 16); 1147 + *(long double*)&outStruct[destMarker] = 1148 + *(long double*)&inGPRs[srcGMarker]; 1149 + } 1150 + 1151 + destMarker += 16; 1152 + 1153 + // Skip next 2 GPRs 1154 + srcGMarker += 16; 1155 + srcGMarker = ALIGN(srcGMarker, 8); 1156 + 1157 + break; 1158 + 1159 + case FFI_TYPE_UINT8: 1160 + case FFI_TYPE_SINT8: 1161 + { 1162 + if (inType->alignment == 1) // chars only 1163 + { 1164 + if (inType->size == 1) 1165 + outStruct[destMarker++] = inGPRs[srcGMarker++]; 1166 + else if (inType->size == 2) 1167 + { 1168 + outStruct[destMarker++] = inGPRs[srcGMarker++]; 1169 + outStruct[destMarker++] = inGPRs[srcGMarker++]; 1170 + i++; 1171 + } 1172 + else 1173 + { 1174 + memcpy(&outStruct[destMarker], 1175 + &inGPRs[srcGMarker], inType->size); 1176 + srcGMarker += inType->size; 1177 + destMarker += inType->size; 1178 + i += inType->size - 1; 1179 + } 1180 + } 1181 + else // chars and other stuff 1182 + { 1183 + outStruct[destMarker++] = inGPRs[srcGMarker++]; 1184 + 1185 + // Skip to next GPR if next element won't fit and we're 1186 + // not already at a register boundary. 1187 + if (inType->elements[i + 1] != NULL && (srcGMarker % 8)) 1188 + { 1189 + if (!FFI_TYPE_1_BYTE(inType->elements[i + 1]->type) && 1190 + (!FFI_TYPE_2_BYTE(inType->elements[i + 1]->type) || 1191 + (ALIGN(srcGMarker, 8) - srcGMarker) < 2) && 1192 + (!FFI_TYPE_4_BYTE(inType->elements[i + 1]->type) || 1193 + (ALIGN(srcGMarker, 8) - srcGMarker) < 4)) 1194 + srcGMarker = ALIGN(srcGMarker, inType->alignment); // was 8 1195 + } 1196 + } 1197 + 1198 + break; 1199 + } 1200 + 1201 + case FFI_TYPE_UINT16: 1202 + case FFI_TYPE_SINT16: 1203 + srcGMarker = ALIGN(srcGMarker, 2); 1204 + destMarker = ALIGN(destMarker, 2); 1205 + 1206 + *(short*)&outStruct[destMarker] = 1207 + *(short*)&inGPRs[srcGMarker]; 1208 + srcGMarker += 2; 1209 + destMarker += 2; 1210 + 1211 + break; 1212 + 1213 + case FFI_TYPE_INT: 1214 + case FFI_TYPE_UINT32: 1215 + case FFI_TYPE_SINT32: 1216 + srcGMarker = ALIGN(srcGMarker, 4); 1217 + destMarker = ALIGN(destMarker, 4); 1218 + 1219 + *(int*)&outStruct[destMarker] = 1220 + *(int*)&inGPRs[srcGMarker]; 1221 + srcGMarker += 4; 1222 + destMarker += 4; 1223 + 1224 + break; 1225 + 1226 + case FFI_TYPE_POINTER: 1227 + case FFI_TYPE_UINT64: 1228 + case FFI_TYPE_SINT64: 1229 + srcGMarker = ALIGN(srcGMarker, 8); 1230 + destMarker = ALIGN(destMarker, 8); 1231 + 1232 + *(long long*)&outStruct[destMarker] = 1233 + *(long long*)&inGPRs[srcGMarker]; 1234 + srcGMarker += 8; 1235 + destMarker += 8; 1236 + 1237 + break; 1238 + 1239 + case FFI_TYPE_STRUCT: 1240 + recurseCount++; 1241 + ffi64_struct_to_ram_form(inType->elements[i], inGPRs, 1242 + &srcGMarker, inFPRs, &srcFMarker, &fprsUsed, 1243 + outStruct, &destMarker); 1244 + recurseCount--; 1245 + break; 1246 + 1247 + default: 1248 + FFI_ASSERT(0); // unknown element type 1249 + break; 1250 + } 1251 + } 1252 + 1253 + srcGMarker = ALIGN(srcGMarker, inType->alignment); 1254 + 1255 + // Take care of the special case for 16-byte structs, but not for 1256 + // nested structs. 1257 + if (recurseCount == 0 && srcGMarker == 16) 1258 + { 1259 + *(long double*)&outStruct[0] = *(long double*)&inGPRs[0]; 1260 + srcFMarker = savedFMarker; 1261 + fprsUsed = savedFPRsUsed; 1262 + } 1263 + 1264 + if (ioGPRMarker) 1265 + *ioGPRMarker = ALIGN(srcGMarker, 8); 1266 + 1267 + if (ioFPRMarker) 1268 + *ioFPRMarker = srcFMarker; 1269 + 1270 + if (ioFPRsUsed) 1271 + *ioFPRsUsed = fprsUsed; 1272 + 1273 + if (ioStructMarker) 1274 + *ioStructMarker = ALIGN(destMarker, 8); 1275 + } 1276 + 1277 + /* ffi64_struct_to_reg_form 1278 + 1279 + Copy a struct's elements into buffers that can be sliced into registers. 1280 + Return the sizes of the output buffers in bytes. Pass NULL buffer pointers 1281 + to calculate size only. 1282 + outGPRs[0-7] == r3, outFPRs[0-7] == f1 ... 1283 + */ 1284 + void 1285 + ffi64_struct_to_reg_form( 1286 + const ffi_type* inType, 1287 + const char* inStruct, 1288 + unsigned int* ioStructMarker, 1289 + unsigned int* ioFPRsUsed, 1290 + char* outGPRs, // caller-allocated 1291 + unsigned int* ioGPRSize, 1292 + char* outFPRs, // caller-allocated 1293 + unsigned int* ioFPRSize) 1294 + { 1295 + size_t i; 1296 + unsigned int srcMarker = 0; 1297 + unsigned int destGMarker = 0; 1298 + unsigned int destFMarker = 0; 1299 + unsigned int savedFMarker = 0; 1300 + unsigned int fprsUsed = 0; 1301 + unsigned int savedFPRsUsed = 0; 1302 + 1303 + static unsigned int recurseCount = 0; 1304 + 1305 + if (ioStructMarker) 1306 + srcMarker = *ioStructMarker; 1307 + 1308 + if (ioFPRsUsed) 1309 + { 1310 + fprsUsed = *ioFPRsUsed; 1311 + savedFPRsUsed = fprsUsed; 1312 + } 1313 + 1314 + if (ioGPRSize) 1315 + destGMarker = *ioGPRSize; 1316 + 1317 + if (ioFPRSize) 1318 + { 1319 + destFMarker = *ioFPRSize; 1320 + savedFMarker = destFMarker; 1321 + } 1322 + 1323 + switch (inType->size) 1324 + { 1325 + case 1: case 2: case 4: 1326 + destGMarker += 8 - inType->size; 1327 + break; 1328 + 1329 + default: 1330 + break; 1331 + } 1332 + 1333 + for (i = 0; inType->elements[i] != NULL; i++) 1334 + { 1335 + switch (inType->elements[i]->type) 1336 + { 1337 + // Shadow floating-point types in GPRs for vararg and pre-ANSI 1338 + // functions. 1339 + case FFI_TYPE_FLOAT: 1340 + // Nudge markers to next 4/8-byte boundary 1341 + srcMarker = ALIGN(srcMarker, 4); 1342 + destGMarker = ALIGN(destGMarker, 4); 1343 + destFMarker = ALIGN(destFMarker, 8); 1344 + 1345 + if (fprsUsed < NUM_FPR_ARG_REGISTERS) 1346 + { 1347 + if (outFPRs != NULL && inStruct != NULL) 1348 + *(double*)&outFPRs[destFMarker] = 1349 + (double)*(float*)&inStruct[srcMarker]; 1350 + 1351 + destFMarker += 8; 1352 + fprsUsed++; 1353 + } 1354 + 1355 + if (outGPRs != NULL && inStruct != NULL) 1356 + *(double*)&outGPRs[destGMarker] = 1357 + (double)*(float*)&inStruct[srcMarker]; 1358 + 1359 + srcMarker += 4; 1360 + destGMarker += 4; 1361 + 1362 + // Skip to next GPR if next element won't fit and we're 1363 + // not already at a register boundary. 1364 + if (inType->elements[i + 1] != NULL && (srcMarker % 8)) 1365 + { 1366 + if (!FFI_TYPE_1_BYTE(inType->elements[i + 1]->type) && 1367 + (!FFI_TYPE_2_BYTE(inType->elements[i + 1]->type) || 1368 + (ALIGN(destGMarker, 8) - destGMarker) < 2) && 1369 + (!FFI_TYPE_4_BYTE(inType->elements[i + 1]->type) || 1370 + (ALIGN(destGMarker, 8) - destGMarker) < 4)) 1371 + destGMarker = ALIGN(destGMarker, 8); 1372 + } 1373 + 1374 + break; 1375 + 1376 + case FFI_TYPE_DOUBLE: 1377 + srcMarker = ALIGN(srcMarker, 8); 1378 + destFMarker = ALIGN(destFMarker, 8); 1379 + 1380 + if (fprsUsed < NUM_FPR_ARG_REGISTERS) 1381 + { 1382 + if (outFPRs != NULL && inStruct != NULL) 1383 + *(double*)&outFPRs[destFMarker] = 1384 + *(double*)&inStruct[srcMarker]; 1385 + 1386 + destFMarker += 8; 1387 + fprsUsed++; 1388 + } 1389 + 1390 + if (outGPRs != NULL && inStruct != NULL) 1391 + *(double*)&outGPRs[destGMarker] = 1392 + *(double*)&inStruct[srcMarker]; 1393 + 1394 + srcMarker += 8; 1395 + 1396 + // Skip next GPR 1397 + destGMarker += 8; 1398 + destGMarker = ALIGN(destGMarker, 8); 1399 + 1400 + break; 1401 + 1402 + case FFI_TYPE_LONGDOUBLE: 1403 + srcMarker = ALIGN(srcMarker, 16); 1404 + 1405 + if (fprsUsed < NUM_FPR_ARG_REGISTERS) 1406 + { 1407 + destFMarker = ALIGN(destFMarker, 8); 1408 + destGMarker = ALIGN(destGMarker, 8); 1409 + 1410 + if (outFPRs != NULL && inStruct != NULL) 1411 + *(long double*)&outFPRs[destFMarker] = 1412 + *(long double*)&inStruct[srcMarker]; 1413 + 1414 + if (outGPRs != NULL && inStruct != NULL) 1415 + *(long double*)&outGPRs[destGMarker] = 1416 + *(long double*)&inStruct[srcMarker]; 1417 + 1418 + destFMarker += 16; 1419 + fprsUsed += 2; 1420 + } 1421 + else 1422 + { 1423 + destGMarker = ALIGN(destGMarker, 16); 1424 + 1425 + if (outGPRs != NULL && inStruct != NULL) 1426 + *(long double*)&outGPRs[destGMarker] = 1427 + *(long double*)&inStruct[srcMarker]; 1428 + } 1429 + 1430 + srcMarker += 16; 1431 + destGMarker += 16; // Skip next 2 GPRs 1432 + destGMarker = ALIGN(destGMarker, 8); // was 16 1433 + 1434 + break; 1435 + 1436 + case FFI_TYPE_UINT8: 1437 + case FFI_TYPE_SINT8: 1438 + if (inType->alignment == 1) // bytes only 1439 + { 1440 + if (inType->size == 1) 1441 + { 1442 + if (outGPRs != NULL && inStruct != NULL) 1443 + outGPRs[destGMarker] = inStruct[srcMarker]; 1444 + 1445 + srcMarker++; 1446 + destGMarker++; 1447 + } 1448 + else if (inType->size == 2) 1449 + { 1450 + if (outGPRs != NULL && inStruct != NULL) 1451 + { 1452 + outGPRs[destGMarker] = inStruct[srcMarker]; 1453 + outGPRs[destGMarker + 1] = inStruct[srcMarker + 1]; 1454 + } 1455 + 1456 + srcMarker += 2; 1457 + destGMarker += 2; 1458 + 1459 + i++; 1460 + } 1461 + else 1462 + { 1463 + if (outGPRs != NULL && inStruct != NULL) 1464 + { 1465 + // Avoid memcpy for small chunks. 1466 + if (inType->size <= sizeof(long)) 1467 + *(long*)&outGPRs[destGMarker] = 1468 + *(long*)&inStruct[srcMarker]; 1469 + else 1470 + memcpy(&outGPRs[destGMarker], 1471 + &inStruct[srcMarker], inType->size); 1472 + } 1473 + 1474 + srcMarker += inType->size; 1475 + destGMarker += inType->size; 1476 + i += inType->size - 1; 1477 + } 1478 + } 1479 + else // bytes and other stuff 1480 + { 1481 + if (outGPRs != NULL && inStruct != NULL) 1482 + outGPRs[destGMarker] = inStruct[srcMarker]; 1483 + 1484 + srcMarker++; 1485 + destGMarker++; 1486 + 1487 + // Skip to next GPR if next element won't fit and we're 1488 + // not already at a register boundary. 1489 + if (inType->elements[i + 1] != NULL && (destGMarker % 8)) 1490 + { 1491 + if (!FFI_TYPE_1_BYTE(inType->elements[i + 1]->type) && 1492 + (!FFI_TYPE_2_BYTE(inType->elements[i + 1]->type) || 1493 + (ALIGN(destGMarker, 8) - destGMarker) < 2) && 1494 + (!FFI_TYPE_4_BYTE(inType->elements[i + 1]->type) || 1495 + (ALIGN(destGMarker, 8) - destGMarker) < 4)) 1496 + destGMarker = ALIGN(destGMarker, inType->alignment); // was 8 1497 + } 1498 + } 1499 + 1500 + break; 1501 + 1502 + case FFI_TYPE_UINT16: 1503 + case FFI_TYPE_SINT16: 1504 + srcMarker = ALIGN(srcMarker, 2); 1505 + destGMarker = ALIGN(destGMarker, 2); 1506 + 1507 + if (outGPRs != NULL && inStruct != NULL) 1508 + *(short*)&outGPRs[destGMarker] = 1509 + *(short*)&inStruct[srcMarker]; 1510 + 1511 + srcMarker += 2; 1512 + destGMarker += 2; 1513 + 1514 + if (inType->elements[i + 1] == NULL) 1515 + destGMarker = ALIGN(destGMarker, inType->alignment); 1516 + 1517 + break; 1518 + 1519 + case FFI_TYPE_INT: 1520 + case FFI_TYPE_UINT32: 1521 + case FFI_TYPE_SINT32: 1522 + srcMarker = ALIGN(srcMarker, 4); 1523 + destGMarker = ALIGN(destGMarker, 4); 1524 + 1525 + if (outGPRs != NULL && inStruct != NULL) 1526 + *(int*)&outGPRs[destGMarker] = 1527 + *(int*)&inStruct[srcMarker]; 1528 + 1529 + srcMarker += 4; 1530 + destGMarker += 4; 1531 + 1532 + break; 1533 + 1534 + case FFI_TYPE_POINTER: 1535 + case FFI_TYPE_UINT64: 1536 + case FFI_TYPE_SINT64: 1537 + srcMarker = ALIGN(srcMarker, 8); 1538 + destGMarker = ALIGN(destGMarker, 8); 1539 + 1540 + if (outGPRs != NULL && inStruct != NULL) 1541 + *(long long*)&outGPRs[destGMarker] = 1542 + *(long long*)&inStruct[srcMarker]; 1543 + 1544 + srcMarker += 8; 1545 + destGMarker += 8; 1546 + 1547 + if (inType->elements[i + 1] == NULL) 1548 + destGMarker = ALIGN(destGMarker, inType->alignment); 1549 + 1550 + break; 1551 + 1552 + case FFI_TYPE_STRUCT: 1553 + recurseCount++; 1554 + ffi64_struct_to_reg_form(inType->elements[i], 1555 + inStruct, &srcMarker, &fprsUsed, outGPRs, 1556 + &destGMarker, outFPRs, &destFMarker); 1557 + recurseCount--; 1558 + break; 1559 + 1560 + default: 1561 + FFI_ASSERT(0); 1562 + break; 1563 + } 1564 + } 1565 + 1566 + destGMarker = ALIGN(destGMarker, inType->alignment); 1567 + 1568 + // Take care of the special case for 16-byte structs, but not for 1569 + // nested structs. 1570 + if (recurseCount == 0 && destGMarker == 16) 1571 + { 1572 + if (outGPRs != NULL && inStruct != NULL) 1573 + *(long double*)&outGPRs[0] = *(long double*)&inStruct[0]; 1574 + 1575 + destFMarker = savedFMarker; 1576 + fprsUsed = savedFPRsUsed; 1577 + } 1578 + 1579 + if (ioStructMarker) 1580 + *ioStructMarker = ALIGN(srcMarker, 8); 1581 + 1582 + if (ioFPRsUsed) 1583 + *ioFPRsUsed = fprsUsed; 1584 + 1585 + if (ioGPRSize) 1586 + *ioGPRSize = ALIGN(destGMarker, 8); 1587 + 1588 + if (ioFPRSize) 1589 + *ioFPRSize = ALIGN(destFMarker, 8); 1590 + } 1591 + 1592 + /* ffi64_stret_needs_ptr 1593 + 1594 + Determine whether a returned struct needs a pointer in r3 or can fit 1595 + in registers. 1596 + */ 1597 + 1598 + bool 1599 + ffi64_stret_needs_ptr( 1600 + const ffi_type* inType, 1601 + unsigned short* ioGPRCount, 1602 + unsigned short* ioFPRCount) 1603 + { 1604 + // Obvious case first- struct is larger than combined FPR size. 1605 + if (inType->size > 14 * 8) 1606 + return true; 1607 + 1608 + // Now the struct can physically fit in registers, determine if it 1609 + // also fits logically. 1610 + bool needsPtr = false; 1611 + unsigned short gprsUsed = 0; 1612 + unsigned short fprsUsed = 0; 1613 + size_t i; 1614 + 1615 + if (ioGPRCount) 1616 + gprsUsed = *ioGPRCount; 1617 + 1618 + if (ioFPRCount) 1619 + fprsUsed = *ioFPRCount; 1620 + 1621 + for (i = 0; inType->elements[i] != NULL && !needsPtr; i++) 1622 + { 1623 + switch (inType->elements[i]->type) 1624 + { 1625 + case FFI_TYPE_FLOAT: 1626 + case FFI_TYPE_DOUBLE: 1627 + gprsUsed++; 1628 + fprsUsed++; 1629 + 1630 + if (fprsUsed > 13) 1631 + needsPtr = true; 1632 + 1633 + break; 1634 + 1635 + case FFI_TYPE_LONGDOUBLE: 1636 + gprsUsed += 2; 1637 + fprsUsed += 2; 1638 + 1639 + if (fprsUsed > 14) 1640 + needsPtr = true; 1641 + 1642 + break; 1643 + 1644 + case FFI_TYPE_UINT8: 1645 + case FFI_TYPE_SINT8: 1646 + { 1647 + gprsUsed++; 1648 + 1649 + if (gprsUsed > 8) 1650 + { 1651 + needsPtr = true; 1652 + break; 1653 + } 1654 + 1655 + if (inType->elements[i + 1] == NULL) // last byte in the struct 1656 + break; 1657 + 1658 + // Count possible contiguous bytes ahead, up to 8. 1659 + unsigned short j; 1660 + 1661 + for (j = 1; j < 8; j++) 1662 + { 1663 + if (inType->elements[i + j] == NULL || 1664 + !FFI_TYPE_1_BYTE(inType->elements[i + j]->type)) 1665 + break; 1666 + } 1667 + 1668 + i += j - 1; // allow for i++ before the test condition 1669 + 1670 + break; 1671 + } 1672 + 1673 + case FFI_TYPE_UINT16: 1674 + case FFI_TYPE_SINT16: 1675 + case FFI_TYPE_INT: 1676 + case FFI_TYPE_UINT32: 1677 + case FFI_TYPE_SINT32: 1678 + case FFI_TYPE_POINTER: 1679 + case FFI_TYPE_UINT64: 1680 + case FFI_TYPE_SINT64: 1681 + gprsUsed++; 1682 + 1683 + if (gprsUsed > 8) 1684 + needsPtr = true; 1685 + 1686 + break; 1687 + 1688 + case FFI_TYPE_STRUCT: 1689 + needsPtr = ffi64_stret_needs_ptr( 1690 + inType->elements[i], &gprsUsed, &fprsUsed); 1691 + 1692 + break; 1693 + 1694 + default: 1695 + FFI_ASSERT(0); 1696 + break; 1697 + } 1698 + } 1699 + 1700 + if (ioGPRCount) 1701 + *ioGPRCount = gprsUsed; 1702 + 1703 + if (ioFPRCount) 1704 + *ioFPRCount = fprsUsed; 1705 + 1706 + return needsPtr; 1707 + } 1708 + 1709 + /* ffi64_data_size 1710 + 1711 + Calculate the size in bytes of an ffi type. 1712 + */ 1713 + 1714 + unsigned int 1715 + ffi64_data_size( 1716 + const ffi_type* inType) 1717 + { 1718 + unsigned int size = 0; 1719 + 1720 + switch (inType->type) 1721 + { 1722 + case FFI_TYPE_UINT8: 1723 + case FFI_TYPE_SINT8: 1724 + size = 1; 1725 + break; 1726 + 1727 + case FFI_TYPE_UINT16: 1728 + case FFI_TYPE_SINT16: 1729 + size = 2; 1730 + break; 1731 + 1732 + case FFI_TYPE_INT: 1733 + case FFI_TYPE_UINT32: 1734 + case FFI_TYPE_SINT32: 1735 + case FFI_TYPE_FLOAT: 1736 + size = 4; 1737 + break; 1738 + 1739 + case FFI_TYPE_POINTER: 1740 + case FFI_TYPE_UINT64: 1741 + case FFI_TYPE_SINT64: 1742 + case FFI_TYPE_DOUBLE: 1743 + size = 8; 1744 + break; 1745 + 1746 + case FFI_TYPE_LONGDOUBLE: 1747 + size = 16; 1748 + break; 1749 + 1750 + case FFI_TYPE_STRUCT: 1751 + ffi64_struct_to_reg_form( 1752 + inType, NULL, NULL, NULL, NULL, &size, NULL, NULL); 1753 + break; 1754 + 1755 + case FFI_TYPE_VOID: 1756 + break; 1757 + 1758 + default: 1759 + FFI_ASSERT(0); 1760 + break; 1761 + } 1762 + 1763 + return size; 1764 + } 1765 + 1766 + #endif /* defined(__ppc64__) */ 1767 + #endif /* __ppc__ || __ppc64__ */
+418
src/libffi/powerpc/ppc64-darwin_closure.S
··· 1 + #if defined(__ppc64__) 2 + 3 + /* ----------------------------------------------------------------------- 4 + ppc64-darwin_closure.S - Copyright (c) 2002, 2003, 2004, Free Software Foundation, 5 + Inc. based on ppc_closure.S 6 + 7 + PowerPC Assembly glue. 8 + 9 + Permission is hereby granted, free of charge, to any person obtaining 10 + a copy of this software and associated documentation files (the 11 + ``Software''), to deal in the Software without restriction, including 12 + without limitation the rights to use, copy, modify, merge, publish, 13 + distribute, sublicense, and/or sell copies of the Software, and to 14 + permit persons to whom the Software is furnished to do so, subject to 15 + the following conditions: 16 + 17 + The above copyright notice and this permission notice shall be included 18 + in all copies or substantial portions of the Software. 19 + 20 + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS 21 + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 23 + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR 24 + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 25 + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 + OTHER DEALINGS IN THE SOFTWARE. 27 + ----------------------------------------------------------------------- */ 28 + 29 + #define LIBFFI_ASM 30 + 31 + #include <ffi.h> 32 + #include <ppc-ffitarget.h> // for FFI_TRAMPOLINE_SIZE 33 + #include <ppc-darwin.h> 34 + #include <architecture/ppc/mode_independent_asm.h> 35 + 36 + .file "ppc64-darwin_closure.S" 37 + .text 38 + .align LOG2_GPR_BYTES 39 + .globl _ffi_closure_ASM 40 + 41 + .text 42 + .align LOG2_GPR_BYTES 43 + 44 + _ffi_closure_ASM: 45 + LFB1: 46 + mflr r0 47 + stg r0,SF_RETURN(r1) // save return address 48 + 49 + // Save GPRs 3 - 10 (aligned to 8) in the parents outgoing area. 50 + stg r3,SF_ARG1(r1) 51 + stg r4,SF_ARG2(r1) 52 + stg r5,SF_ARG3(r1) 53 + stg r6,SF_ARG4(r1) 54 + stg r7,SF_ARG5(r1) 55 + stg r8,SF_ARG6(r1) 56 + stg r9,SF_ARG7(r1) 57 + stg r10,SF_ARG8(r1) 58 + 59 + LCFI0: 60 + /* 48 bytes (Linkage Area) 61 + 64 bytes (outgoing parameter area, always reserved) 62 + 112 bytes (14*8 for incoming FPR) 63 + ? bytes (result) 64 + 112 bytes (14*8 for outgoing FPR) 65 + 16 bytes (2 saved registers) 66 + 352 + ? total bytes 67 + */ 68 + 69 + std r31,-8(r1) // Save registers we use. 70 + std r30,-16(r1) 71 + mr r30,r1 // Save the old SP. 72 + mr r31,r11 // Save the ffi_closure around ffi64_data_size. 73 + 74 + // Calculate the space we need. 75 + stdu r1,-SF_MINSIZE(r1) 76 + ld r3,FFI_TRAMPOLINE_SIZE(r31) // ffi_closure->cif* 77 + ld r3,16(r3) // ffi_cif->rtype* 78 + bl Lffi64_data_size$stub 79 + ld r1,0(r1) 80 + 81 + addi r3,r3,352 // Add our overhead. 82 + neg r3,r3 83 + li r0,-32 // Align to 32 bytes. 84 + and r3,r3,r0 85 + stdux r1,r1,r3 // Grow the stack. 86 + 87 + mr r11,r31 // Copy the ffi_closure back. 88 + 89 + LCFI1: 90 + // We want to build up an area for the parameters passed 91 + // in registers. (both floating point and integer) 92 + 93 + /* 320 bytes (callee stack frame aligned to 32) 94 + 48 bytes (caller linkage area) 95 + 368 (start of caller parameter area aligned to 8) 96 + */ 97 + 98 + // Save FPRs 1 - 14. (aligned to 8) 99 + stfd f1,112(r1) 100 + stfd f2,120(r1) 101 + stfd f3,128(r1) 102 + stfd f4,136(r1) 103 + stfd f5,144(r1) 104 + stfd f6,152(r1) 105 + stfd f7,160(r1) 106 + stfd f8,168(r1) 107 + stfd f9,176(r1) 108 + stfd f10,184(r1) 109 + stfd f11,192(r1) 110 + stfd f12,200(r1) 111 + stfd f13,208(r1) 112 + stfd f14,216(r1) 113 + 114 + // Set up registers for the routine that actually does the work. 115 + mr r3,r11 // context pointer from the trampoline 116 + addi r4,r1,224 // result storage 117 + addi r5,r30,SF_ARG1 // saved GPRs 118 + addi r6,r1,112 // saved FPRs 119 + bl Lffi_closure_helper_DARWIN$stub 120 + 121 + // Look the proper starting point in table 122 + // by using return type as an offset. 123 + addi r5,r1,224 // Get pointer to results area. 124 + bl Lget_ret_type0_addr // Get pointer to Lret_type0 into LR. 125 + mflr r4 // Move to r4. 126 + slwi r3,r3,4 // Now multiply return type by 16. 127 + add r3,r3,r4 // Add contents of table to table address. 128 + mtctr r3 129 + bctr 130 + 131 + LFE1: 132 + // Each of the ret_typeX code fragments has to be exactly 16 bytes long 133 + // (4 instructions). For cache effectiveness we align to a 16 byte 134 + // boundary first. 135 + .align 4 136 + nop 137 + nop 138 + nop 139 + 140 + Lget_ret_type0_addr: 141 + blrl 142 + 143 + // case FFI_TYPE_VOID 144 + Lret_type0: 145 + b Lfinish 146 + nop 147 + nop 148 + nop 149 + 150 + // case FFI_TYPE_INT 151 + Lret_type1: 152 + lwz r3,4(r5) 153 + b Lfinish 154 + nop 155 + nop 156 + 157 + // case FFI_TYPE_FLOAT 158 + Lret_type2: 159 + lfs f1,0(r5) 160 + b Lfinish 161 + nop 162 + nop 163 + 164 + // case FFI_TYPE_DOUBLE 165 + Lret_type3: 166 + lfd f1,0(r5) 167 + b Lfinish 168 + nop 169 + nop 170 + 171 + // case FFI_TYPE_LONGDOUBLE 172 + Lret_type4: 173 + lfd f1,0(r5) 174 + lfd f2,8(r5) 175 + b Lfinish 176 + nop 177 + 178 + // case FFI_TYPE_UINT8 179 + Lret_type5: 180 + lbz r3,7(r5) 181 + b Lfinish 182 + nop 183 + nop 184 + 185 + // case FFI_TYPE_SINT8 186 + Lret_type6: 187 + lbz r3,7(r5) 188 + extsb r3,r3 189 + b Lfinish 190 + nop 191 + 192 + // case FFI_TYPE_UINT16 193 + Lret_type7: 194 + lhz r3,6(r5) 195 + b Lfinish 196 + nop 197 + nop 198 + 199 + // case FFI_TYPE_SINT16 200 + Lret_type8: 201 + lha r3,6(r5) 202 + b Lfinish 203 + nop 204 + nop 205 + 206 + // case FFI_TYPE_UINT32 207 + Lret_type9: // same as Lret_type1 208 + lwz r3,4(r5) 209 + b Lfinish 210 + nop 211 + nop 212 + 213 + // case FFI_TYPE_SINT32 214 + Lret_type10: // same as Lret_type1 215 + lwz r3,4(r5) 216 + b Lfinish 217 + nop 218 + nop 219 + 220 + // case FFI_TYPE_UINT64 221 + Lret_type11: 222 + ld r3,0(r5) 223 + b Lfinish 224 + nop 225 + nop 226 + 227 + // case FFI_TYPE_SINT64 228 + Lret_type12: // same as Lret_type11 229 + ld r3,0(r5) 230 + b Lfinish 231 + nop 232 + nop 233 + 234 + // case FFI_TYPE_STRUCT 235 + Lret_type13: 236 + b Lret_struct 237 + nop 238 + nop 239 + nop 240 + 241 + // ** End 16-byte aligned cases ** 242 + // case FFI_TYPE_POINTER 243 + // This case assumes that FFI_TYPE_POINTER == FFI_TYPE_LAST. If more types 244 + // are added in future, the following code will need to be updated and 245 + // padded to 16 bytes. 246 + Lret_type14: 247 + lg r3,0(r5) 248 + b Lfinish 249 + 250 + // copy struct into registers 251 + Lret_struct: 252 + ld r31,FFI_TRAMPOLINE_SIZE(r31) // ffi_closure->cif* 253 + ld r3,16(r31) // ffi_cif->rtype* 254 + ld r31,24(r31) // ffi_cif->flags 255 + mr r4,r5 // copy struct* to 2nd arg 256 + addi r7,r1,SF_ARG9 // GPR return area 257 + addi r9,r30,-16-(14*8) // FPR return area 258 + li r5,0 // struct offset ptr (NULL) 259 + li r6,0 // FPR used count ptr (NULL) 260 + li r8,0 // GPR return area size ptr (NULL) 261 + li r10,0 // FPR return area size ptr (NULL) 262 + bl Lffi64_struct_to_reg_form$stub 263 + 264 + // Load GPRs 265 + ld r3,SF_ARG9(r1) 266 + ld r4,SF_ARG10(r1) 267 + ld r5,SF_ARG11(r1) 268 + ld r6,SF_ARG12(r1) 269 + nop 270 + ld r7,SF_ARG13(r1) 271 + ld r8,SF_ARG14(r1) 272 + ld r9,SF_ARG15(r1) 273 + ld r10,SF_ARG16(r1) 274 + nop 275 + 276 + // Load FPRs 277 + mtcrf 0x2,r31 278 + bf 26,Lfinish 279 + lfd f1,-16-(14*8)(r30) 280 + lfd f2,-16-(13*8)(r30) 281 + lfd f3,-16-(12*8)(r30) 282 + lfd f4,-16-(11*8)(r30) 283 + nop 284 + lfd f5,-16-(10*8)(r30) 285 + lfd f6,-16-(9*8)(r30) 286 + lfd f7,-16-(8*8)(r30) 287 + lfd f8,-16-(7*8)(r30) 288 + nop 289 + lfd f9,-16-(6*8)(r30) 290 + lfd f10,-16-(5*8)(r30) 291 + lfd f11,-16-(4*8)(r30) 292 + lfd f12,-16-(3*8)(r30) 293 + nop 294 + lfd f13,-16-(2*8)(r30) 295 + lfd f14,-16-(1*8)(r30) 296 + // Fall through 297 + 298 + // case done 299 + Lfinish: 300 + lg r1,0(r1) // Restore stack pointer. 301 + ld r31,-8(r1) // Restore registers we used. 302 + ld r30,-16(r1) 303 + lg r0,SF_RETURN(r1) // Get return address. 304 + mtlr r0 // Reset link register. 305 + blr 306 + 307 + // END(ffi_closure_ASM) 308 + 309 + .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support 310 + EH_frame1: 311 + .set L$set$0,LECIE1-LSCIE1 312 + .long L$set$0 ; Length of Common Information Entry 313 + LSCIE1: 314 + .long 0x0 ; CIE Identifier Tag 315 + .byte 0x1 ; CIE Version 316 + .ascii "zR\0" ; CIE Augmentation 317 + .byte 0x1 ; uleb128 0x1; CIE Code Alignment Factor 318 + .byte 0x7c ; sleb128 -4; CIE Data Alignment Factor 319 + .byte 0x41 ; CIE RA Column 320 + .byte 0x1 ; uleb128 0x1; Augmentation size 321 + .byte 0x10 ; FDE Encoding (pcrel) 322 + .byte 0xc ; DW_CFA_def_cfa 323 + .byte 0x1 ; uleb128 0x1 324 + .byte 0x0 ; uleb128 0x0 325 + .align LOG2_GPR_BYTES 326 + LECIE1: 327 + .globl _ffi_closure_ASM.eh 328 + _ffi_closure_ASM.eh: 329 + LSFDE1: 330 + .set L$set$1,LEFDE1-LASFDE1 331 + .long L$set$1 ; FDE Length 332 + 333 + LASFDE1: 334 + .long LASFDE1-EH_frame1 ; FDE CIE offset 335 + .g_long LFB1-. ; FDE initial location 336 + .set L$set$3,LFE1-LFB1 337 + .g_long L$set$3 ; FDE address range 338 + .byte 0x0 ; uleb128 0x0; Augmentation size 339 + .byte 0x4 ; DW_CFA_advance_loc4 340 + .set L$set$3,LCFI1-LCFI0 341 + .long L$set$3 342 + .byte 0xe ; DW_CFA_def_cfa_offset 343 + .byte 176,1 ; uleb128 176 344 + .byte 0x4 ; DW_CFA_advance_loc4 345 + .set L$set$4,LCFI0-LFB1 346 + .long L$set$4 347 + .byte 0x11 ; DW_CFA_offset_extended_sf 348 + .byte 0x41 ; uleb128 0x41 349 + .byte 0x7e ; sleb128 -2 350 + .align LOG2_GPR_BYTES 351 + 352 + LEFDE1: 353 + .data 354 + .align LOG2_GPR_BYTES 355 + LDFCM0: 356 + .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32 357 + .align LOG2_GPR_BYTES 358 + 359 + Lffi_closure_helper_DARWIN$stub: 360 + .indirect_symbol _ffi_closure_helper_DARWIN 361 + mflr r0 362 + bcl 20,31,LO$ffi_closure_helper_DARWIN 363 + 364 + LO$ffi_closure_helper_DARWIN: 365 + mflr r11 366 + addis r11,r11,ha16(L_ffi_closure_helper_DARWIN$lazy_ptr - LO$ffi_closure_helper_DARWIN) 367 + mtlr r0 368 + lgu r12,lo16(L_ffi_closure_helper_DARWIN$lazy_ptr - LO$ffi_closure_helper_DARWIN)(r11) 369 + mtctr r12 370 + bctr 371 + 372 + .lazy_symbol_pointer 373 + L_ffi_closure_helper_DARWIN$lazy_ptr: 374 + .indirect_symbol _ffi_closure_helper_DARWIN 375 + .g_long dyld_stub_binding_helper 376 + 377 + .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32 378 + .align LOG2_GPR_BYTES 379 + 380 + Lffi64_struct_to_reg_form$stub: 381 + .indirect_symbol _ffi64_struct_to_reg_form 382 + mflr r0 383 + bcl 20,31,LO$ffi64_struct_to_reg_form 384 + 385 + LO$ffi64_struct_to_reg_form: 386 + mflr r11 387 + addis r11,r11,ha16(L_ffi64_struct_to_reg_form$lazy_ptr - LO$ffi64_struct_to_reg_form) 388 + mtlr r0 389 + lgu r12,lo16(L_ffi64_struct_to_reg_form$lazy_ptr - LO$ffi64_struct_to_reg_form)(r11) 390 + mtctr r12 391 + bctr 392 + 393 + .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32 394 + .align LOG2_GPR_BYTES 395 + 396 + Lffi64_data_size$stub: 397 + .indirect_symbol _ffi64_data_size 398 + mflr r0 399 + bcl 20,31,LO$ffi64_data_size 400 + 401 + LO$ffi64_data_size: 402 + mflr r11 403 + addis r11,r11,ha16(L_ffi64_data_size$lazy_ptr - LO$ffi64_data_size) 404 + mtlr r0 405 + lgu r12,lo16(L_ffi64_data_size$lazy_ptr - LO$ffi64_data_size)(r11) 406 + mtctr r12 407 + bctr 408 + 409 + .lazy_symbol_pointer 410 + L_ffi64_struct_to_reg_form$lazy_ptr: 411 + .indirect_symbol _ffi64_struct_to_reg_form 412 + .g_long dyld_stub_binding_helper 413 + 414 + L_ffi64_data_size$lazy_ptr: 415 + .indirect_symbol _ffi64_data_size 416 + .g_long dyld_stub_binding_helper 417 + 418 + #endif // __ppc64__
+115
src/libffi/types.c
··· 1 + /* ----------------------------------------------------------------------- 2 + types.c - Copyright (c) 1996, 1998 Red Hat, Inc. 3 + 4 + Predefined ffi_types needed by libffi. 5 + 6 + Permission is hereby granted, free of charge, to any person obtaining 7 + a copy of this software and associated documentation files (the 8 + ``Software''), to deal in the Software without restriction, including 9 + without limitation the rights to use, copy, modify, merge, publish, 10 + distribute, sublicense, and/or sell copies of the Software, and to 11 + permit persons to whom the Software is furnished to do so, subject to 12 + the following conditions: 13 + 14 + The above copyright notice and this permission notice shall be included 15 + in all copies or substantial portions of the Software. 16 + 17 + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS 18 + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 + IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR 21 + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 22 + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 + OTHER DEALINGS IN THE SOFTWARE. 24 + ----------------------------------------------------------------------- */ 25 + 26 + #include <ffi.h> 27 + #include <ffi_common.h> 28 + 29 + /* Type definitions */ 30 + #define FFI_INTEGRAL_TYPEDEF(n, s, a, t) \ 31 + ffi_type ffi_type_##n = { s, a, t, NULL } 32 + #define FFI_AGGREGATE_TYPEDEF(n, e) \ 33 + ffi_type ffi_type_##n = { 0, 0, FFI_TYPE_STRUCT, e } 34 + 35 + FFI_INTEGRAL_TYPEDEF(uint8, 1, 1, FFI_TYPE_UINT8); 36 + FFI_INTEGRAL_TYPEDEF(sint8, 1, 1, FFI_TYPE_SINT8); 37 + FFI_INTEGRAL_TYPEDEF(uint16, 2, 2, FFI_TYPE_UINT16); 38 + FFI_INTEGRAL_TYPEDEF(sint16, 2, 2, FFI_TYPE_SINT16); 39 + FFI_INTEGRAL_TYPEDEF(uint32, 4, 4, FFI_TYPE_UINT32); 40 + FFI_INTEGRAL_TYPEDEF(sint32, 4, 4, FFI_TYPE_SINT32); 41 + FFI_INTEGRAL_TYPEDEF(float, 4, 4, FFI_TYPE_FLOAT); 42 + 43 + /* Size and alignment are fake here. They must not be 0. */ 44 + FFI_INTEGRAL_TYPEDEF(void, 1, 1, FFI_TYPE_VOID); 45 + 46 + #if defined ALPHA || defined SPARC64 || defined X86_64 || \ 47 + defined S390X || defined IA64 || defined POWERPC64 48 + FFI_INTEGRAL_TYPEDEF(pointer, 8, 8, FFI_TYPE_POINTER); 49 + #else 50 + FFI_INTEGRAL_TYPEDEF(pointer, 4, 4, FFI_TYPE_POINTER); 51 + #endif 52 + 53 + #if defined X86 || defined ARM || defined M68K || defined(X86_DARWIN) 54 + 55 + # ifdef X86_64 56 + FFI_INTEGRAL_TYPEDEF(uint64, 8, 8, FFI_TYPE_UINT64); 57 + FFI_INTEGRAL_TYPEDEF(sint64, 8, 8, FFI_TYPE_SINT64); 58 + # else 59 + FFI_INTEGRAL_TYPEDEF(uint64, 8, 4, FFI_TYPE_UINT64); 60 + FFI_INTEGRAL_TYPEDEF(sint64, 8, 4, FFI_TYPE_SINT64); 61 + # endif 62 + 63 + #elif defined(POWERPC_DARWIN) 64 + FFI_INTEGRAL_TYPEDEF(uint64, 8, 8, FFI_TYPE_UINT64); 65 + FFI_INTEGRAL_TYPEDEF(sint64, 8, 8, FFI_TYPE_SINT64); 66 + #elif defined SH 67 + FFI_INTEGRAL_TYPEDEF(uint64, 8, 4, FFI_TYPE_UINT64); 68 + FFI_INTEGRAL_TYPEDEF(sint64, 8, 4, FFI_TYPE_SINT64); 69 + #else 70 + FFI_INTEGRAL_TYPEDEF(uint64, 8, 8, FFI_TYPE_UINT64); 71 + FFI_INTEGRAL_TYPEDEF(sint64, 8, 8, FFI_TYPE_SINT64); 72 + #endif 73 + 74 + #if defined X86 || defined X86_WIN32 || defined M68K || defined(X86_DARWIN) 75 + 76 + # if defined X86_WIN32 || defined X86_64 77 + FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE); 78 + # else 79 + FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE); 80 + # endif 81 + 82 + # ifdef X86_DARWIN 83 + FFI_INTEGRAL_TYPEDEF(longdouble, 16, 16, FFI_TYPE_LONGDOUBLE); 84 + # else 85 + FFI_INTEGRAL_TYPEDEF(longdouble, 12, 4, FFI_TYPE_LONGDOUBLE); 86 + # endif 87 + 88 + #elif defined ARM || defined SH || defined POWERPC_AIX 89 + FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE); 90 + FFI_INTEGRAL_TYPEDEF(longdouble, 8, 4, FFI_TYPE_LONGDOUBLE); 91 + #elif defined POWERPC_DARWIN 92 + FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE); 93 + 94 + # if __GNUC__ >= 4 95 + FFI_INTEGRAL_TYPEDEF(longdouble, 16, 16, FFI_TYPE_LONGDOUBLE); 96 + # else 97 + FFI_INTEGRAL_TYPEDEF(longdouble, 8, 8, FFI_TYPE_LONGDOUBLE); 98 + # endif 99 + 100 + #elif defined SPARC 101 + FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE); 102 + 103 + # ifdef SPARC64 104 + FFI_INTEGRAL_TYPEDEF(longdouble, 16, 16, FFI_TYPE_LONGDOUBLE); 105 + # else 106 + FFI_INTEGRAL_TYPEDEF(longdouble, 16, 8, FFI_TYPE_LONGDOUBLE); 107 + # endif 108 + 109 + #elif defined X86_64 || defined POWERPC64 110 + FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE); 111 + FFI_INTEGRAL_TYPEDEF(longdouble, 16, 16, FFI_TYPE_LONGDOUBLE); 112 + #else 113 + FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE); 114 + FFI_INTEGRAL_TYPEDEF(longdouble, 8, 8, FFI_TYPE_LONGDOUBLE); 115 + #endif
+416
src/libffi/x86/darwin64.S
··· 1 + /* ----------------------------------------------------------------------- 2 + darwin64.S - Copyright (c) 2006 Free Software Foundation, Inc. 3 + derived from unix64.S 4 + 5 + x86-64 Foreign Function Interface for Darwin. 6 + 7 + Permission is hereby granted, free of charge, to any person obtaining 8 + a copy of this software and associated documentation files (the 9 + ``Software''), to deal in the Software without restriction, including 10 + without limitation the rights to use, copy, modify, merge, publish, 11 + distribute, sublicense, and/or sell copies of the Software, and to 12 + permit persons to whom the Software is furnished to do so, subject to 13 + the following conditions: 14 + 15 + The above copyright notice and this permission notice shall be included 16 + in all copies or substantial portions of the Software. 17 + 18 + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR 22 + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 23 + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 + OTHER DEALINGS IN THE SOFTWARE. 25 + ----------------------------------------------------------------------- */ 26 + 27 + #ifdef __x86_64__ 28 + #define LIBFFI_ASM 29 + #include <fficonfig.h> 30 + #include <ffi.h> 31 + 32 + .file "darwin64.S" 33 + .text 34 + 35 + /* ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags, 36 + void *raddr, void (*fnaddr)()); 37 + 38 + Bit o trickiness here -- ARGS+BYTES is the base of the stack frame 39 + for this function. This has been allocated by ffi_call. We also 40 + deallocate some of the stack that has been alloca'd. */ 41 + 42 + .align 8 43 + .globl _ffi_call_unix64 44 + 45 + _ffi_call_unix64: 46 + LUW0: 47 + movq (%rsp), %r10 /* Load return address. */ 48 + leaq (%rdi, %rsi), %rax /* Find local stack base. */ 49 + movq %rdx, (%rax) /* Save flags. */ 50 + movq %rcx, 8(%rax) /* Save raddr. */ 51 + movq %rbp, 16(%rax) /* Save old frame pointer. */ 52 + movq %r10, 24(%rax) /* Relocate return address. */ 53 + movq %rax, %rbp /* Finalize local stack frame. */ 54 + LUW1: 55 + movq %rdi, %r10 /* Save a copy of the register area. */ 56 + movq %r8, %r11 /* Save a copy of the target fn. */ 57 + movl %r9d, %eax /* Set number of SSE registers. */ 58 + 59 + /* Load up all argument registers. */ 60 + movq (%r10), %rdi 61 + movq 8(%r10), %rsi 62 + movq 16(%r10), %rdx 63 + movq 24(%r10), %rcx 64 + movq 32(%r10), %r8 65 + movq 40(%r10), %r9 66 + testl %eax, %eax 67 + jnz Lload_sse 68 + Lret_from_load_sse: 69 + 70 + /* Deallocate the reg arg area. */ 71 + leaq 176(%r10), %rsp 72 + 73 + /* Call the user function. */ 74 + call *%r11 75 + 76 + /* Deallocate stack arg area; local stack frame in redzone. */ 77 + leaq 24(%rbp), %rsp 78 + 79 + movq 0(%rbp), %rcx /* Reload flags. */ 80 + movq 8(%rbp), %rdi /* Reload raddr. */ 81 + movq 16(%rbp), %rbp /* Reload old frame pointer. */ 82 + LUW2: 83 + 84 + /* The first byte of the flags contains the FFI_TYPE. */ 85 + movzbl %cl, %r10d 86 + leaq Lstore_table(%rip), %r11 87 + movslq (%r11, %r10, 4), %r10 88 + addq %r11, %r10 89 + jmp *%r10 90 + 91 + Lstore_table: 92 + .long Lst_void-Lstore_table /* FFI_TYPE_VOID */ 93 + .long Lst_sint32-Lstore_table /* FFI_TYPE_INT */ 94 + .long Lst_float-Lstore_table /* FFI_TYPE_FLOAT */ 95 + .long Lst_double-Lstore_table /* FFI_TYPE_DOUBLE */ 96 + .long Lst_ldouble-Lstore_table /* FFI_TYPE_LONGDOUBLE */ 97 + .long Lst_uint8-Lstore_table /* FFI_TYPE_UINT8 */ 98 + .long Lst_sint8-Lstore_table /* FFI_TYPE_SINT8 */ 99 + .long Lst_uint16-Lstore_table /* FFI_TYPE_UINT16 */ 100 + .long Lst_sint16-Lstore_table /* FFI_TYPE_SINT16 */ 101 + .long Lst_uint32-Lstore_table /* FFI_TYPE_UINT32 */ 102 + .long Lst_sint32-Lstore_table /* FFI_TYPE_SINT32 */ 103 + .long Lst_int64-Lstore_table /* FFI_TYPE_UINT64 */ 104 + .long Lst_int64-Lstore_table /* FFI_TYPE_SINT64 */ 105 + .long Lst_struct-Lstore_table /* FFI_TYPE_STRUCT */ 106 + .long Lst_int64-Lstore_table /* FFI_TYPE_POINTER */ 107 + 108 + .text 109 + .align 8 110 + Lst_void: 111 + ret 112 + .align 8 113 + Lst_uint8: 114 + movzbq %al, %rax 115 + movq %rax, (%rdi) 116 + ret 117 + .align 8 118 + Lst_sint8: 119 + movsbq %al, %rax 120 + movq %rax, (%rdi) 121 + ret 122 + .align 8 123 + Lst_uint16: 124 + movzwq %ax, %rax 125 + movq %rax, (%rdi) 126 + .align 8 127 + Lst_sint16: 128 + movswq %ax, %rax 129 + movq %rax, (%rdi) 130 + ret 131 + .align 8 132 + Lst_uint32: 133 + movl %eax, %eax 134 + movq %rax, (%rdi) 135 + .align 8 136 + Lst_sint32: 137 + cltq 138 + movq %rax, (%rdi) 139 + ret 140 + .align 8 141 + Lst_int64: 142 + movq %rax, (%rdi) 143 + ret 144 + .align 8 145 + Lst_float: 146 + movss %xmm0, (%rdi) 147 + ret 148 + .align 8 149 + Lst_double: 150 + movsd %xmm0, (%rdi) 151 + ret 152 + Lst_ldouble: 153 + fstpt (%rdi) 154 + ret 155 + .align 8 156 + Lst_struct: 157 + leaq -20(%rsp), %rsi /* Scratch area in redzone. */ 158 + 159 + /* We have to locate the values now, and since we don't want to 160 + write too much data into the user's return value, we spill the 161 + value to a 16 byte scratch area first. Bits 8, 9, and 10 162 + control where the values are located. Only one of the three 163 + bits will be set; see ffi_prep_cif_machdep for the pattern. */ 164 + movd %xmm0, %r10 165 + movd %xmm1, %r11 166 + testl $0x100, %ecx 167 + cmovnz %rax, %rdx 168 + cmovnz %r10, %rax 169 + testl $0x200, %ecx 170 + cmovnz %r10, %rdx 171 + testl $0x400, %ecx 172 + cmovnz %r10, %rax 173 + cmovnz %r11, %rdx 174 + movq %rax, (%rsi) 175 + movq %rdx, 8(%rsi) 176 + 177 + /* Bits 12-31 contain the true size of the structure. Copy from 178 + the scratch area to the true destination. */ 179 + shrl $12, %ecx 180 + rep movsb 181 + ret 182 + 183 + /* Many times we can avoid loading any SSE registers at all. 184 + It's not worth an indirect jump to load the exact set of 185 + SSE registers needed; zero or all is a good compromise. */ 186 + .align 8 187 + LUW3: 188 + Lload_sse: 189 + movdqa 48(%r10), %xmm0 190 + movdqa 64(%r10), %xmm1 191 + movdqa 80(%r10), %xmm2 192 + movdqa 96(%r10), %xmm3 193 + movdqa 112(%r10), %xmm4 194 + movdqa 128(%r10), %xmm5 195 + movdqa 144(%r10), %xmm6 196 + movdqa 160(%r10), %xmm7 197 + jmp Lret_from_load_sse 198 + 199 + LUW4: 200 + .align 8 201 + .globl _ffi_closure_unix64 202 + 203 + _ffi_closure_unix64: 204 + LUW5: 205 + /* The carry flag is set by the trampoline iff SSE registers 206 + are used. Don't clobber it before the branch instruction. */ 207 + leaq -200(%rsp), %rsp 208 + LUW6: 209 + movq %rdi, (%rsp) 210 + movq %rsi, 8(%rsp) 211 + movq %rdx, 16(%rsp) 212 + movq %rcx, 24(%rsp) 213 + movq %r8, 32(%rsp) 214 + movq %r9, 40(%rsp) 215 + jc Lsave_sse 216 + Lret_from_save_sse: 217 + 218 + movq %r10, %rdi 219 + leaq 176(%rsp), %rsi 220 + movq %rsp, %rdx 221 + leaq 208(%rsp), %rcx 222 + call _ffi_closure_unix64_inner@PLT 223 + 224 + /* Deallocate stack frame early; return value is now in redzone. */ 225 + addq $200, %rsp 226 + LUW7: 227 + 228 + /* The first byte of the return value contains the FFI_TYPE. */ 229 + movzbl %al, %r10d 230 + leaq Lload_table(%rip), %r11 231 + movslq (%r11, %r10, 4), %r10 232 + addq %r11, %r10 233 + jmp *%r10 234 + 235 + Lload_table: 236 + .long Lld_void-Lload_table /* FFI_TYPE_VOID */ 237 + .long Lld_int32-Lload_table /* FFI_TYPE_INT */ 238 + .long Lld_float-Lload_table /* FFI_TYPE_FLOAT */ 239 + .long Lld_double-Lload_table /* FFI_TYPE_DOUBLE */ 240 + .long Lld_ldouble-Lload_table /* FFI_TYPE_LONGDOUBLE */ 241 + .long Lld_int8-Lload_table /* FFI_TYPE_UINT8 */ 242 + .long Lld_int8-Lload_table /* FFI_TYPE_SINT8 */ 243 + .long Lld_int16-Lload_table /* FFI_TYPE_UINT16 */ 244 + .long Lld_int16-Lload_table /* FFI_TYPE_SINT16 */ 245 + .long Lld_int32-Lload_table /* FFI_TYPE_UINT32 */ 246 + .long Lld_int32-Lload_table /* FFI_TYPE_SINT32 */ 247 + .long Lld_int64-Lload_table /* FFI_TYPE_UINT64 */ 248 + .long Lld_int64-Lload_table /* FFI_TYPE_SINT64 */ 249 + .long Lld_struct-Lload_table /* FFI_TYPE_STRUCT */ 250 + .long Lld_int64-Lload_table /* FFI_TYPE_POINTER */ 251 + 252 + .text 253 + .align 8 254 + Lld_void: 255 + ret 256 + .align 8 257 + Lld_int8: 258 + movzbl -24(%rsp), %eax 259 + ret 260 + .align 8 261 + Lld_int16: 262 + movzwl -24(%rsp), %eax 263 + ret 264 + .align 8 265 + Lld_int32: 266 + movl -24(%rsp), %eax 267 + ret 268 + .align 8 269 + Lld_int64: 270 + movq -24(%rsp), %rax 271 + ret 272 + .align 8 273 + Lld_float: 274 + movss -24(%rsp), %xmm0 275 + ret 276 + .align 8 277 + Lld_double: 278 + movsd -24(%rsp), %xmm0 279 + ret 280 + .align 8 281 + Lld_ldouble: 282 + fldt -24(%rsp) 283 + ret 284 + .align 8 285 + Lld_struct: 286 + /* There are four possibilities here, %rax/%rdx, %xmm0/%rax, 287 + %rax/%xmm0, %xmm0/%xmm1. We collapse two by always loading 288 + both rdx and xmm1 with the second word. For the remaining, 289 + bit 8 set means xmm0 gets the second word, and bit 9 means 290 + that rax gets the second word. */ 291 + movq -24(%rsp), %rcx 292 + movq -16(%rsp), %rdx 293 + movq -16(%rsp), %xmm1 294 + testl $0x100, %eax 295 + cmovnz %rdx, %rcx 296 + movd %rcx, %xmm0 297 + testl $0x200, %eax 298 + movq -24(%rsp), %rax 299 + cmovnz %rdx, %rax 300 + ret 301 + 302 + /* See the comment above Lload_sse; the same logic applies here. */ 303 + .align 8 304 + LUW8: 305 + Lsave_sse: 306 + movdqa %xmm0, 48(%rsp) 307 + movdqa %xmm1, 64(%rsp) 308 + movdqa %xmm2, 80(%rsp) 309 + movdqa %xmm3, 96(%rsp) 310 + movdqa %xmm4, 112(%rsp) 311 + movdqa %xmm5, 128(%rsp) 312 + movdqa %xmm6, 144(%rsp) 313 + movdqa %xmm7, 160(%rsp) 314 + jmp Lret_from_save_sse 315 + 316 + LUW9: 317 + //.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support 318 + .text 319 + EH_frame1: 320 + .set L$set$0,LECIE1-LSCIE1 /* CIE Length */ 321 + .long L$set$0 322 + LSCIE1: 323 + .long 0x0 /* CIE Identifier Tag */ 324 + .byte 0x1 /* CIE Version */ 325 + .ascii "zR\0" /* CIE Augmentation */ 326 + .byte 0x1 /* uleb128 0x1; CIE Code Alignment Factor */ 327 + .byte 0x78 /* sleb128 -8; CIE Data Alignment Factor */ 328 + .byte 0x10 /* CIE RA Column */ 329 + .byte 0x1 /* uleb128 0x1; Augmentation size */ 330 + .byte 0x10 /* FDE Encoding (pcrel sdata4) */ 331 + .byte 0xc /* DW_CFA_def_cfa, %rsp offset 8 */ 332 + .byte 0x7 /* uleb128 0x7 */ 333 + .byte 0x8 /* uleb128 0x8 */ 334 + .byte 0x90 /* DW_CFA_offset, column 0x10 */ 335 + .byte 0x1 336 + .align 8 337 + LECIE1: 338 + .globl _ffi_call_unix64.eh 339 + _ffi_call_unix64.eh: 340 + LSFDE1: 341 + .set L$set$1,LEFDE1-LASFDE1 /* FDE Length */ 342 + .long L$set$1 343 + LASFDE1: 344 + .long LASFDE1-EH_frame1 /* FDE CIE offset */ 345 + .quad LUW0-. /* FDE initial location */ 346 + .set L$set$2,LUW4-LUW0 /* FDE address range */ 347 + .quad L$set$2 348 + .byte 0x0 /* Augmentation size */ 349 + .byte 0x4 /* DW_CFA_advance_loc4 */ 350 + .set L$set$3,LUW1-LUW0 351 + .long L$set$3 352 + 353 + /* New stack frame based off rbp. This is a itty bit of unwind 354 + trickery in that the CFA *has* changed. There is no easy way 355 + to describe it correctly on entry to the function. Fortunately, 356 + it doesn't matter too much since at all points we can correctly 357 + unwind back to ffi_call. Note that the location to which we 358 + moved the return address is (the new) CFA-8, so from the 359 + perspective of the unwind info, it hasn't moved. */ 360 + .byte 0xc /* DW_CFA_def_cfa, %rbp offset 32 */ 361 + .byte 0x6 362 + .byte 0x20 363 + .byte 0x80+6 /* DW_CFA_offset, %rbp offset 2*-8 */ 364 + .byte 0x2 365 + .byte 0xa /* DW_CFA_remember_state */ 366 + 367 + .byte 0x4 /* DW_CFA_advance_loc4 */ 368 + .set L$set$4,LUW2-LUW1 369 + .long L$set$4 370 + .byte 0xc /* DW_CFA_def_cfa, %rsp offset 8 */ 371 + .byte 0x7 372 + .byte 0x8 373 + .byte 0xc0+6 /* DW_CFA_restore, %rbp */ 374 + 375 + .byte 0x4 /* DW_CFA_advance_loc4 */ 376 + .set L$set$5,LUW3-LUW2 377 + .long L$set$5 378 + .byte 0xb /* DW_CFA_restore_state */ 379 + 380 + .align 8 381 + LEFDE1: 382 + .globl _ffi_closure_unix64.eh 383 + _ffi_closure_unix64.eh: 384 + LSFDE3: 385 + .set L$set$6,LEFDE3-LASFDE3 /* FDE Length */ 386 + .long L$set$6 387 + LASFDE3: 388 + .long LASFDE3-EH_frame1 /* FDE CIE offset */ 389 + .quad LUW5-. /* FDE initial location */ 390 + .set L$set$7,LUW9-LUW5 /* FDE address range */ 391 + .quad L$set$7 392 + .byte 0x0 /* Augmentation size */ 393 + 394 + .byte 0x4 /* DW_CFA_advance_loc4 */ 395 + .set L$set$8,LUW6-LUW5 396 + .long L$set$8 397 + .byte 0xe /* DW_CFA_def_cfa_offset */ 398 + .byte 208,1 /* uleb128 208 */ 399 + .byte 0xa /* DW_CFA_remember_state */ 400 + 401 + .byte 0x4 /* DW_CFA_advance_loc4 */ 402 + .set L$set$9,LUW7-LUW6 403 + .long L$set$9 404 + .byte 0xe /* DW_CFA_def_cfa_offset */ 405 + .byte 0x8 406 + 407 + .byte 0x4 /* DW_CFA_advance_loc4 */ 408 + .set L$set$10,LUW8-LUW7 409 + .long L$set$10 410 + .byte 0xb /* DW_CFA_restore_state */ 411 + 412 + .align 8 413 + LEFDE3: 414 + // .subsections_via_symbols 415 + 416 + #endif /* __x86_64__ */
+418
src/libffi/x86/x86-darwin.S
··· 1 + #ifdef __i386__ 2 + /* ----------------------------------------------------------------------- 3 + darwin.S - Copyright (c) 1996, 1998, 2001, 2002, 2003 Red Hat, Inc. 4 + 5 + X86 Foreign Function Interface 6 + 7 + Permission is hereby granted, free of charge, to any person obtaining 8 + a copy of this software and associated documentation files (the 9 + ``Software''), to deal in the Software without restriction, including 10 + without limitation the rights to use, copy, modify, merge, publish, 11 + distribute, sublicense, and/or sell copies of the Software, and to 12 + permit persons to whom the Software is furnished to do so, subject to 13 + the following conditions: 14 + 15 + The above copyright notice and this permission notice shall be included 16 + in all copies or substantial portions of the Software. 17 + 18 + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 + IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR 22 + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 23 + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 + OTHER DEALINGS IN THE SOFTWARE. 25 + ----------------------------------------------------------------------- */ 26 + 27 + /* 28 + * This file is based on sysv.S and then hacked up by Ronald who hasn't done 29 + * assembly programming in 8 years. 30 + */ 31 + 32 + #ifndef __x86_64__ 33 + 34 + #define LIBFFI_ASM 35 + #include <fficonfig.h> 36 + #include <ffi.h> 37 + 38 + #ifdef PyObjC_STRICT_DEBUGGING 39 + /* XXX: Debugging of stack alignment, to be removed */ 40 + #define ASSERT_STACK_ALIGNED movdqa -16(%esp), %xmm0 41 + #else 42 + #define ASSERT_STACK_ALIGNED 43 + #endif 44 + 45 + .text 46 + 47 + .globl _ffi_prep_args 48 + 49 + .align 16 50 + .globl _ffi_call_SYSV 51 + 52 + _ffi_call_SYSV: 53 + LFB1: 54 + pushl %ebp 55 + LCFI0: 56 + movl %esp,%ebp 57 + LCFI1: 58 + subl $8,%esp 59 + /* Make room for all of the new args. */ 60 + movl 16(%ebp),%ecx 61 + subl %ecx,%esp 62 + 63 + movl %esp,%eax 64 + 65 + /* Place all of the ffi_prep_args in position */ 66 + subl $8,%esp 67 + pushl 12(%ebp) 68 + pushl %eax 69 + call *8(%ebp) 70 + 71 + /* Return stack to previous state and call the function */ 72 + addl $16,%esp 73 + 74 + call *28(%ebp) 75 + 76 + /* Remove the space we pushed for the args */ 77 + movl 16(%ebp),%ecx 78 + addl %ecx,%esp 79 + 80 + /* Load %ecx with the return type code */ 81 + movl 20(%ebp),%ecx 82 + 83 + /* If the return value pointer is NULL, assume no return value. */ 84 + cmpl $0,24(%ebp) 85 + jne Lretint 86 + 87 + /* Even if there is no space for the return value, we are 88 + obliged to handle floating-point values. */ 89 + cmpl $FFI_TYPE_FLOAT,%ecx 90 + jne Lnoretval 91 + fstp %st(0) 92 + 93 + jmp Lepilogue 94 + 95 + Lretint: 96 + cmpl $FFI_TYPE_INT,%ecx 97 + jne Lretfloat 98 + /* Load %ecx with the pointer to storage for the return value */ 99 + movl 24(%ebp),%ecx 100 + movl %eax,0(%ecx) 101 + jmp Lepilogue 102 + 103 + Lretfloat: 104 + cmpl $FFI_TYPE_FLOAT,%ecx 105 + jne Lretdouble 106 + /* Load %ecx with the pointer to storage for the return value */ 107 + movl 24(%ebp),%ecx 108 + fstps (%ecx) 109 + jmp Lepilogue 110 + 111 + Lretdouble: 112 + cmpl $FFI_TYPE_DOUBLE,%ecx 113 + jne Lretlongdouble 114 + /* Load %ecx with the pointer to storage for the return value */ 115 + movl 24(%ebp),%ecx 116 + fstpl (%ecx) 117 + jmp Lepilogue 118 + 119 + Lretlongdouble: 120 + cmpl $FFI_TYPE_LONGDOUBLE,%ecx 121 + jne Lretint64 122 + /* Load %ecx with the pointer to storage for the return value */ 123 + movl 24(%ebp),%ecx 124 + fstpt (%ecx) 125 + jmp Lepilogue 126 + 127 + Lretint64: 128 + cmpl $FFI_TYPE_SINT64,%ecx 129 + jne Lretstruct1b 130 + /* Load %ecx with the pointer to storage for the return value */ 131 + movl 24(%ebp),%ecx 132 + movl %eax,0(%ecx) 133 + movl %edx,4(%ecx) 134 + jmp Lepilogue 135 + 136 + Lretstruct1b: 137 + cmpl $FFI_TYPE_SINT8,%ecx 138 + jne Lretstruct2b 139 + /* Load %ecx with the pointer to storage for the return value */ 140 + movl 24(%ebp),%ecx 141 + movb %al,0(%ecx) 142 + jmp Lepilogue 143 + 144 + Lretstruct2b: 145 + cmpl $FFI_TYPE_SINT16,%ecx 146 + jne Lretstruct 147 + /* Load %ecx with the pointer to storage for the return value */ 148 + movl 24(%ebp),%ecx 149 + movw %ax,0(%ecx) 150 + jmp Lepilogue 151 + 152 + Lretstruct: 153 + cmpl $FFI_TYPE_STRUCT,%ecx 154 + jne Lnoretval 155 + /* Nothing to do! */ 156 + addl $4,%esp 157 + popl %ebp 158 + ret 159 + 160 + Lnoretval: 161 + Lepilogue: 162 + addl $8,%esp 163 + movl %ebp,%esp 164 + popl %ebp 165 + ret 166 + LFE1: 167 + .ffi_call_SYSV_end: 168 + 169 + .align 16 170 + FFI_HIDDEN (ffi_closure_SYSV) 171 + .globl _ffi_closure_SYSV 172 + 173 + _ffi_closure_SYSV: 174 + LFB2: 175 + pushl %ebp 176 + LCFI2: 177 + movl %esp, %ebp 178 + LCFI3: 179 + subl $56, %esp 180 + leal -40(%ebp), %edx 181 + movl %edx, -12(%ebp) /* resp */ 182 + leal 8(%ebp), %edx 183 + movl %edx, 4(%esp) /* args = __builtin_dwarf_cfa () */ 184 + leal -12(%ebp), %edx 185 + movl %edx, (%esp) /* &resp */ 186 + movl %ebx, 8(%esp) 187 + LCFI7: 188 + call L_ffi_closure_SYSV_inner$stub 189 + movl 8(%esp), %ebx 190 + movl -12(%ebp), %ecx 191 + cmpl $FFI_TYPE_INT, %eax 192 + je Lcls_retint 193 + cmpl $FFI_TYPE_FLOAT, %eax 194 + je Lcls_retfloat 195 + cmpl $FFI_TYPE_DOUBLE, %eax 196 + je Lcls_retdouble 197 + cmpl $FFI_TYPE_LONGDOUBLE, %eax 198 + je Lcls_retldouble 199 + cmpl $FFI_TYPE_SINT64, %eax 200 + je Lcls_retllong 201 + cmpl $FFI_TYPE_SINT8, %eax 202 + je Lcls_retstruct1 203 + cmpl $FFI_TYPE_SINT16, %eax 204 + je Lcls_retstruct2 205 + cmpl $FFI_TYPE_STRUCT, %eax 206 + je Lcls_retstruct 207 + Lcls_epilogue: 208 + movl %ebp, %esp 209 + popl %ebp 210 + ret 211 + Lcls_retint: 212 + movl (%ecx), %eax 213 + jmp Lcls_epilogue 214 + Lcls_retfloat: 215 + flds (%ecx) 216 + jmp Lcls_epilogue 217 + Lcls_retdouble: 218 + fldl (%ecx) 219 + jmp Lcls_epilogue 220 + Lcls_retldouble: 221 + fldt (%ecx) 222 + jmp Lcls_epilogue 223 + Lcls_retllong: 224 + movl (%ecx), %eax 225 + movl 4(%ecx), %edx 226 + jmp Lcls_epilogue 227 + Lcls_retstruct1: 228 + movsbl (%ecx), %eax 229 + jmp Lcls_epilogue 230 + Lcls_retstruct2: 231 + movswl (%ecx), %eax 232 + jmp Lcls_epilogue 233 + Lcls_retstruct: 234 + lea -8(%ebp),%esp 235 + movl %ebp, %esp 236 + popl %ebp 237 + ret $4 238 + LFE2: 239 + 240 + #if !FFI_NO_RAW_API 241 + 242 + #define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) & ~3) 243 + #define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4) 244 + #define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) 245 + #define CIF_FLAGS_OFFSET 20 246 + 247 + .align 16 248 + FFI_HIDDEN (ffi_closure_raw_SYSV) 249 + .globl _ffi_closure_raw_SYSV 250 + 251 + _ffi_closure_raw_SYSV: 252 + LFB3: 253 + pushl %ebp 254 + LCFI4: 255 + movl %esp, %ebp 256 + LCFI5: 257 + pushl %esi 258 + LCFI6: 259 + subl $36, %esp 260 + movl RAW_CLOSURE_CIF_OFFSET(%eax), %esi /* closure->cif */ 261 + movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */ 262 + movl %edx, 12(%esp) /* user_data */ 263 + leal 8(%ebp), %edx /* __builtin_dwarf_cfa () */ 264 + movl %edx, 8(%esp) /* raw_args */ 265 + leal -24(%ebp), %edx 266 + movl %edx, 4(%esp) /* &res */ 267 + movl %esi, (%esp) /* cif */ 268 + call *RAW_CLOSURE_FUN_OFFSET(%eax) /* closure->fun */ 269 + movl CIF_FLAGS_OFFSET(%esi), %eax /* rtype */ 270 + cmpl $FFI_TYPE_INT, %eax 271 + je Lrcls_retint 272 + cmpl $FFI_TYPE_FLOAT, %eax 273 + je Lrcls_retfloat 274 + cmpl $FFI_TYPE_DOUBLE, %eax 275 + je Lrcls_retdouble 276 + cmpl $FFI_TYPE_LONGDOUBLE, %eax 277 + je Lrcls_retldouble 278 + cmpl $FFI_TYPE_SINT64, %eax 279 + je Lrcls_retllong 280 + Lrcls_epilogue: 281 + addl $36, %esp 282 + popl %esi 283 + popl %ebp 284 + ret 285 + Lrcls_retint: 286 + movl -24(%ebp), %eax 287 + jmp Lrcls_epilogue 288 + Lrcls_retfloat: 289 + flds -24(%ebp) 290 + jmp Lrcls_epilogue 291 + Lrcls_retdouble: 292 + fldl -24(%ebp) 293 + jmp Lrcls_epilogue 294 + Lrcls_retldouble: 295 + fldt -24(%ebp) 296 + jmp Lrcls_epilogue 297 + Lrcls_retllong: 298 + movl -24(%ebp), %eax 299 + movl -20(%ebp), %edx 300 + jmp Lrcls_epilogue 301 + LFE3: 302 + #endif 303 + 304 + .section __IMPORT,__jump_table,symbol_stubs,self_modifying_code+pure_instructions,5 305 + L_ffi_closure_SYSV_inner$stub: 306 + .indirect_symbol _ffi_closure_SYSV_inner 307 + hlt ; hlt ; hlt ; hlt ; hlt 308 + 309 + 310 + .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support 311 + EH_frame1: 312 + .set L$set$0,LECIE1-LSCIE1 313 + .long L$set$0 314 + LSCIE1: 315 + .long 0x0 316 + .byte 0x1 317 + .ascii "zR\0" 318 + .byte 0x1 319 + .byte 0x7c 320 + .byte 0x8 321 + .byte 0x1 322 + .byte 0x10 323 + .byte 0xc 324 + .byte 0x5 325 + .byte 0x4 326 + .byte 0x88 327 + .byte 0x1 328 + .align 4 329 + LECIE1: 330 + .globl _ffi_call_SYSV.eh 331 + _ffi_call_SYSV.eh: 332 + LSFDE1: 333 + .set L$set$1,LEFDE1-LASFDE1 334 + .long L$set$1 335 + LASFDE1: 336 + .long LASFDE1-EH_frame1 337 + .long LFB1-. 338 + .set L$set$2,LFE1-LFB1 339 + .long L$set$2 340 + .byte 0x0 341 + .byte 0x4 342 + .set L$set$3,LCFI0-LFB1 343 + .long L$set$3 344 + .byte 0xe 345 + .byte 0x8 346 + .byte 0x84 347 + .byte 0x2 348 + .byte 0x4 349 + .set L$set$4,LCFI1-LCFI0 350 + .long L$set$4 351 + .byte 0xd 352 + .byte 0x4 353 + .align 4 354 + LEFDE1: 355 + .globl _ffi_closure_SYSV.eh 356 + _ffi_closure_SYSV.eh: 357 + LSFDE2: 358 + .set L$set$5,LEFDE2-LASFDE2 359 + .long L$set$5 360 + LASFDE2: 361 + .long LASFDE2-EH_frame1 362 + .long LFB2-. 363 + .set L$set$6,LFE2-LFB2 364 + .long L$set$6 365 + .byte 0x0 366 + .byte 0x4 367 + .set L$set$7,LCFI2-LFB2 368 + .long L$set$7 369 + .byte 0xe 370 + .byte 0x8 371 + .byte 0x84 372 + .byte 0x2 373 + .byte 0x4 374 + .set L$set$8,LCFI3-LCFI2 375 + .long L$set$8 376 + .byte 0xd 377 + .byte 0x4 378 + .align 4 379 + LEFDE2: 380 + 381 + #if !FFI_NO_RAW_API 382 + 383 + .globl _ffi_closure_raw_SYSV.eh 384 + _ffi_closure_raw_SYSV.eh: 385 + LSFDE3: 386 + .set L$set$10,LEFDE3-LASFDE3 387 + .long L$set$10 388 + LASFDE3: 389 + .long LASFDE3-EH_frame1 390 + .long LFB3-. 391 + .set L$set$11,LFE3-LFB3 392 + .long L$set$11 393 + .byte 0x0 394 + .byte 0x4 395 + .set L$set$12,LCFI4-LFB3 396 + .long L$set$12 397 + .byte 0xe 398 + .byte 0x8 399 + .byte 0x84 400 + .byte 0x2 401 + .byte 0x4 402 + .set L$set$13,LCFI5-LCFI4 403 + .long L$set$13 404 + .byte 0xd 405 + .byte 0x4 406 + .byte 0x4 407 + .set L$set$14,LCFI6-LCFI5 408 + .long L$set$14 409 + .byte 0x85 410 + .byte 0x3 411 + .align 4 412 + LEFDE3: 413 + 414 + #endif 415 + 416 + #endif /* ifndef __x86_64__ */ 417 + 418 + #endif /* defined __i386__ */
+646
src/libffi/x86/x86-ffi64.c
··· 1 + #ifdef __x86_64__ 2 + 3 + /* ----------------------------------------------------------------------- 4 + x86-ffi64.c - Copyright (c) 2002 Bo Thorsen <bo@suse.de> 5 + 6 + x86-64 Foreign Function Interface 7 + 8 + Permission is hereby granted, free of charge, to any person obtaining 9 + a copy of this software and associated documentation files (the 10 + ``Software''), to deal in the Software without restriction, including 11 + without limitation the rights to use, copy, modify, merge, publish, 12 + distribute, sublicense, and/or sell copies of the Software, and to 13 + permit persons to whom the Software is furnished to do so, subject to 14 + the following conditions: 15 + 16 + The above copyright notice and this permission notice shall be included 17 + in all copies or substantial portions of the Software. 18 + 19 + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS 20 + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 + IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR 23 + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 24 + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 + OTHER DEALINGS IN THE SOFTWARE. 26 + ----------------------------------------------------------------------- */ 27 + 28 + #include <ffi.h> 29 + #include <ffi_common.h> 30 + 31 + #include <stdlib.h> 32 + #include <stdarg.h> 33 + 34 + #define MAX_GPR_REGS 6 35 + #define MAX_SSE_REGS 8 36 + 37 + typedef struct RegisterArgs { 38 + /* Registers for argument passing. */ 39 + UINT64 gpr[MAX_GPR_REGS]; 40 + __int128_t sse[MAX_SSE_REGS]; 41 + } RegisterArgs; 42 + 43 + extern void 44 + ffi_call_unix64( 45 + void* args, 46 + unsigned long bytes, 47 + unsigned flags, 48 + void* raddr, 49 + void (*fnaddr)(), 50 + unsigned ssecount); 51 + 52 + /* All reference to register classes here is identical to the code in 53 + gcc/config/i386/i386.c. Do *not* change one without the other. */ 54 + 55 + /* Register class used for passing given 64bit part of the argument. 56 + These represent classes as documented by the PS ABI, with the exception 57 + of SSESF, SSEDF classes, that are basically SSE class, just gcc will 58 + use SF or DFmode move instead of DImode to avoid reformating penalties. 59 + 60 + Similary we play games with INTEGERSI_CLASS to use cheaper SImode moves 61 + whenever possible (upper half does contain padding). */ 62 + enum x86_64_reg_class 63 + { 64 + X86_64_NO_CLASS, 65 + X86_64_INTEGER_CLASS, 66 + X86_64_INTEGERSI_CLASS, 67 + X86_64_SSE_CLASS, 68 + X86_64_SSESF_CLASS, 69 + X86_64_SSEDF_CLASS, 70 + X86_64_SSEUP_CLASS, 71 + X86_64_X87_CLASS, 72 + X86_64_X87UP_CLASS, 73 + X86_64_COMPLEX_X87_CLASS, 74 + X86_64_MEMORY_CLASS 75 + }; 76 + 77 + #define MAX_CLASSES 4 78 + #define SSE_CLASS_P(X) ((X) >= X86_64_SSE_CLASS && X <= X86_64_SSEUP_CLASS) 79 + 80 + /* x86-64 register passing implementation. See x86-64 ABI for details. Goal 81 + of this code is to classify each 8bytes of incoming argument by the register 82 + class and assign registers accordingly. */ 83 + 84 + /* Return the union class of CLASS1 and CLASS2. 85 + See the x86-64 PS ABI for details. */ 86 + static enum x86_64_reg_class 87 + merge_classes( 88 + enum x86_64_reg_class class1, 89 + enum x86_64_reg_class class2) 90 + { 91 + /* Rule #1: If both classes are equal, this is the resulting class. */ 92 + if (class1 == class2) 93 + return class1; 94 + 95 + /* Rule #2: If one of the classes is NO_CLASS, the resulting class is 96 + the other class. */ 97 + if (class1 == X86_64_NO_CLASS) 98 + return class2; 99 + 100 + if (class2 == X86_64_NO_CLASS) 101 + return class1; 102 + 103 + /* Rule #3: If one of the classes is MEMORY, the result is MEMORY. */ 104 + if (class1 == X86_64_MEMORY_CLASS || class2 == X86_64_MEMORY_CLASS) 105 + return X86_64_MEMORY_CLASS; 106 + 107 + /* Rule #4: If one of the classes is INTEGER, the result is INTEGER. */ 108 + if ((class1 == X86_64_INTEGERSI_CLASS && class2 == X86_64_SSESF_CLASS) 109 + || (class2 == X86_64_INTEGERSI_CLASS && class1 == X86_64_SSESF_CLASS)) 110 + return X86_64_INTEGERSI_CLASS; 111 + 112 + if (class1 == X86_64_INTEGER_CLASS || class1 == X86_64_INTEGERSI_CLASS 113 + || class2 == X86_64_INTEGER_CLASS || class2 == X86_64_INTEGERSI_CLASS) 114 + return X86_64_INTEGER_CLASS; 115 + 116 + /* Rule #5: If one of the classes is X87, X87UP, or COMPLEX_X87 class, 117 + MEMORY is used. */ 118 + if (class1 == X86_64_X87_CLASS 119 + || class1 == X86_64_X87UP_CLASS 120 + || class1 == X86_64_COMPLEX_X87_CLASS 121 + || class2 == X86_64_X87_CLASS 122 + || class2 == X86_64_X87UP_CLASS 123 + || class2 == X86_64_COMPLEX_X87_CLASS) 124 + return X86_64_MEMORY_CLASS; 125 + 126 + /* Rule #6: Otherwise class SSE is used. */ 127 + return X86_64_SSE_CLASS; 128 + } 129 + 130 + /* Classify the argument of type TYPE and mode MODE. 131 + CLASSES will be filled by the register class used to pass each word 132 + of the operand. The number of words is returned. In case the parameter 133 + should be passed in memory, 0 is returned. As a special case for zero 134 + sized containers, classes[0] will be NO_CLASS and 1 is returned. 135 + 136 + See the x86-64 PS ABI for details. */ 137 + 138 + static int 139 + classify_argument( 140 + ffi_type* type, 141 + enum x86_64_reg_class classes[], 142 + size_t byte_offset) 143 + { 144 + switch (type->type) 145 + { 146 + case FFI_TYPE_UINT8: 147 + case FFI_TYPE_SINT8: 148 + case FFI_TYPE_UINT16: 149 + case FFI_TYPE_SINT16: 150 + case FFI_TYPE_UINT32: 151 + case FFI_TYPE_SINT32: 152 + case FFI_TYPE_UINT64: 153 + case FFI_TYPE_SINT64: 154 + case FFI_TYPE_POINTER: 155 + if (byte_offset + type->size <= 4) 156 + classes[0] = X86_64_INTEGERSI_CLASS; 157 + else 158 + classes[0] = X86_64_INTEGER_CLASS; 159 + 160 + return 1; 161 + 162 + case FFI_TYPE_FLOAT: 163 + if (byte_offset == 0) 164 + classes[0] = X86_64_SSESF_CLASS; 165 + else 166 + classes[0] = X86_64_SSE_CLASS; 167 + 168 + return 1; 169 + 170 + case FFI_TYPE_DOUBLE: 171 + classes[0] = X86_64_SSEDF_CLASS; 172 + return 1; 173 + 174 + case FFI_TYPE_LONGDOUBLE: 175 + classes[0] = X86_64_X87_CLASS; 176 + classes[1] = X86_64_X87UP_CLASS; 177 + return 2; 178 + 179 + case FFI_TYPE_STRUCT: 180 + { 181 + ffi_type** ptr; 182 + int i; 183 + enum x86_64_reg_class subclasses[MAX_CLASSES]; 184 + const int UNITS_PER_WORD = 8; 185 + int words = 186 + (type->size + UNITS_PER_WORD - 1) / UNITS_PER_WORD; 187 + 188 + /* If the struct is larger than 16 bytes, pass it on the stack. */ 189 + if (type->size > 16) 190 + return 0; 191 + 192 + for (i = 0; i < words; i++) 193 + classes[i] = X86_64_NO_CLASS; 194 + 195 + /* Merge the fields of structure. */ 196 + for (ptr = type->elements; *ptr != NULL; ptr++) 197 + { 198 + byte_offset = ALIGN(byte_offset, (*ptr)->alignment); 199 + 200 + int num = classify_argument(*ptr, subclasses, byte_offset % 8); 201 + 202 + if (num == 0) 203 + return 0; 204 + 205 + int pos = byte_offset / 8; 206 + 207 + for (i = 0; i < num; i++) 208 + { 209 + classes[i + pos] = 210 + merge_classes(subclasses[i], classes[i + pos]); 211 + } 212 + 213 + byte_offset += (*ptr)->size; 214 + } 215 + 216 + /* Final merger cleanup. */ 217 + for (i = 0; i < words; i++) 218 + { 219 + /* If one class is MEMORY, everything should be passed in 220 + memory. */ 221 + if (classes[i] == X86_64_MEMORY_CLASS) 222 + return 0; 223 + 224 + /* The X86_64_SSEUP_CLASS should be always preceded by 225 + X86_64_SSE_CLASS. */ 226 + if (classes[i] == X86_64_SSEUP_CLASS 227 + && (i == 0 || classes[i - 1] != X86_64_SSE_CLASS)) 228 + classes[i] = X86_64_SSE_CLASS; 229 + 230 + /* X86_64_X87UP_CLASS should be preceded by X86_64_X87_CLASS. */ 231 + if (classes[i] == X86_64_X87UP_CLASS 232 + && (i == 0 || classes[i - 1] != X86_64_X87_CLASS)) 233 + classes[i] = X86_64_SSE_CLASS; 234 + } 235 + 236 + return words; 237 + } 238 + 239 + default: 240 + FFI_ASSERT(0); 241 + } 242 + 243 + return 0; /* Never reached. */ 244 + } 245 + 246 + /* Examine the argument and return set number of register required in each 247 + class. Return zero if parameter should be passed in memory, otherwise 248 + the number of registers. */ 249 + static int 250 + examine_argument( 251 + ffi_type* type, 252 + enum x86_64_reg_class classes[MAX_CLASSES], 253 + _Bool in_return, 254 + int* pngpr, 255 + int* pnsse) 256 + { 257 + int n = classify_argument(type, classes, 0); 258 + int ngpr = 0; 259 + int nsse = 0; 260 + int i; 261 + 262 + if (n == 0) 263 + return 0; 264 + 265 + for (i = 0; i < n; ++i) 266 + { 267 + switch (classes[i]) 268 + { 269 + case X86_64_INTEGER_CLASS: 270 + case X86_64_INTEGERSI_CLASS: 271 + ngpr++; 272 + break; 273 + 274 + case X86_64_SSE_CLASS: 275 + case X86_64_SSESF_CLASS: 276 + case X86_64_SSEDF_CLASS: 277 + nsse++; 278 + break; 279 + 280 + case X86_64_NO_CLASS: 281 + case X86_64_SSEUP_CLASS: 282 + break; 283 + 284 + case X86_64_X87_CLASS: 285 + case X86_64_X87UP_CLASS: 286 + case X86_64_COMPLEX_X87_CLASS: 287 + return in_return != 0; 288 + 289 + default: 290 + abort(); 291 + } 292 + } 293 + 294 + *pngpr = ngpr; 295 + *pnsse = nsse; 296 + 297 + return n; 298 + } 299 + 300 + /* Perform machine dependent cif processing. */ 301 + ffi_status 302 + ffi_prep_cif_machdep( 303 + ffi_cif* cif) 304 + { 305 + int gprcount = 0; 306 + int ssecount = 0; 307 + int flags = cif->rtype->type; 308 + int i, avn, n, ngpr, nsse; 309 + enum x86_64_reg_class classes[MAX_CLASSES]; 310 + size_t bytes; 311 + 312 + if (flags != FFI_TYPE_VOID) 313 + { 314 + n = examine_argument (cif->rtype, classes, 1, &ngpr, &nsse); 315 + 316 + if (n == 0) 317 + { 318 + /* The return value is passed in memory. A pointer to that 319 + memory is the first argument. Allocate a register for it. */ 320 + gprcount++; 321 + 322 + /* We don't have to do anything in asm for the return. */ 323 + flags = FFI_TYPE_VOID; 324 + } 325 + else if (flags == FFI_TYPE_STRUCT) 326 + { 327 + /* Mark which registers the result appears in. */ 328 + _Bool sse0 = SSE_CLASS_P(classes[0]); 329 + _Bool sse1 = n == 2 && SSE_CLASS_P(classes[1]); 330 + 331 + if (sse0 && !sse1) 332 + flags |= 1 << 8; 333 + else if (!sse0 && sse1) 334 + flags |= 1 << 9; 335 + else if (sse0 && sse1) 336 + flags |= 1 << 10; 337 + 338 + /* Mark the true size of the structure. */ 339 + flags |= cif->rtype->size << 12; 340 + } 341 + } 342 + 343 + /* Go over all arguments and determine the way they should be passed. 344 + If it's in a register and there is space for it, let that be so. If 345 + not, add it's size to the stack byte count. */ 346 + for (bytes = 0, i = 0, avn = cif->nargs; i < avn; i++) 347 + { 348 + if (examine_argument(cif->arg_types[i], classes, 0, &ngpr, &nsse) == 0 349 + || gprcount + ngpr > MAX_GPR_REGS 350 + || ssecount + nsse > MAX_SSE_REGS) 351 + { 352 + long align = cif->arg_types[i]->alignment; 353 + 354 + if (align < 8) 355 + align = 8; 356 + 357 + bytes = ALIGN(bytes, align); 358 + bytes += cif->arg_types[i]->size; 359 + } 360 + else 361 + { 362 + gprcount += ngpr; 363 + ssecount += nsse; 364 + } 365 + } 366 + 367 + if (ssecount) 368 + flags |= 1 << 11; 369 + 370 + cif->flags = flags; 371 + cif->bytes = bytes; 372 + 373 + return FFI_OK; 374 + } 375 + 376 + void 377 + ffi_call( 378 + ffi_cif* cif, 379 + void (*fn)(), 380 + void* rvalue, 381 + void** avalue) 382 + { 383 + enum x86_64_reg_class classes[MAX_CLASSES]; 384 + char* stack; 385 + char* argp; 386 + ffi_type** arg_types; 387 + int gprcount, ssecount, ngpr, nsse, i, avn; 388 + _Bool ret_in_memory; 389 + RegisterArgs* reg_args; 390 + 391 + /* Can't call 32-bit mode from 64-bit mode. */ 392 + FFI_ASSERT(cif->abi == FFI_UNIX64); 393 + 394 + /* If the return value is a struct and we don't have a return value 395 + address then we need to make one. Note the setting of flags to 396 + VOID above in ffi_prep_cif_machdep. */ 397 + ret_in_memory = (cif->rtype->type == FFI_TYPE_STRUCT 398 + && (cif->flags & 0xff) == FFI_TYPE_VOID); 399 + 400 + if (rvalue == NULL && ret_in_memory) 401 + rvalue = alloca (cif->rtype->size); 402 + 403 + /* Allocate the space for the arguments, plus 4 words of temp space. */ 404 + stack = alloca(sizeof(RegisterArgs) + cif->bytes + 4 * 8); 405 + reg_args = (RegisterArgs*)stack; 406 + argp = stack + sizeof(RegisterArgs); 407 + 408 + gprcount = ssecount = 0; 409 + 410 + /* If the return value is passed in memory, add the pointer as the 411 + first integer argument. */ 412 + if (ret_in_memory) 413 + reg_args->gpr[gprcount++] = (long) rvalue; 414 + 415 + avn = cif->nargs; 416 + arg_types = cif->arg_types; 417 + 418 + for (i = 0; i < avn; ++i) 419 + { 420 + size_t size = arg_types[i]->size; 421 + int n; 422 + 423 + n = examine_argument (arg_types[i], classes, 0, &ngpr, &nsse); 424 + 425 + if (n == 0 426 + || gprcount + ngpr > MAX_GPR_REGS 427 + || ssecount + nsse > MAX_SSE_REGS) 428 + { 429 + long align = arg_types[i]->alignment; 430 + 431 + /* Stack arguments are *always* at least 8 byte aligned. */ 432 + if (align < 8) 433 + align = 8; 434 + 435 + /* Pass this argument in memory. */ 436 + argp = (void *) ALIGN (argp, align); 437 + memcpy (argp, avalue[i], size); 438 + argp += size; 439 + } 440 + else 441 + { /* The argument is passed entirely in registers. */ 442 + char *a = (char *) avalue[i]; 443 + SINT64 signExtendedValue = 0; 444 + int j; 445 + 446 + /* Sign-extend small signed values to fill the entire register. */ 447 + switch (arg_types[i]->type) { 448 + case FFI_TYPE_SINT8: 449 + signExtendedValue = (SINT64) *((SINT8 *) avalue[i]); 450 + a = (char *) &signExtendedValue; 451 + size = 8; 452 + break; 453 + case FFI_TYPE_SINT16: 454 + signExtendedValue = (SINT64) *((SINT16*) avalue[i]); 455 + a = (char *) &signExtendedValue; 456 + size = 8; 457 + break; 458 + case FFI_TYPE_SINT32: 459 + signExtendedValue = (SINT64) *((SINT32*) avalue[i]); 460 + a = (char *) &signExtendedValue; 461 + size = 8; 462 + break; 463 + default: 464 + break; 465 + } 466 + 467 + for (j = 0; j < n; j++, a += 8, size -= 8) 468 + { 469 + switch (classes[j]) 470 + { 471 + case X86_64_INTEGER_CLASS: 472 + case X86_64_INTEGERSI_CLASS: 473 + reg_args->gpr[gprcount] = 0; 474 + memcpy (&reg_args->gpr[gprcount], a, size < 8 ? size : 8); 475 + gprcount++; 476 + break; 477 + 478 + case X86_64_SSE_CLASS: 479 + case X86_64_SSEDF_CLASS: 480 + reg_args->sse[ssecount++] = *(UINT64 *) a; 481 + break; 482 + 483 + case X86_64_SSESF_CLASS: 484 + reg_args->sse[ssecount++] = *(UINT32 *) a; 485 + break; 486 + 487 + default: 488 + abort(); 489 + } 490 + } 491 + } 492 + } 493 + 494 + ffi_call_unix64 (stack, cif->bytes + sizeof(RegisterArgs), 495 + cif->flags, rvalue, fn, ssecount); 496 + } 497 + 498 + extern void ffi_closure_unix64(void); 499 + 500 + ffi_status 501 + ffi_prep_closure( 502 + ffi_closure* closure, 503 + ffi_cif* cif, 504 + void (*fun)(ffi_cif*, void*, void**, void*), 505 + void* user_data) 506 + { 507 + if (cif->abi != FFI_UNIX64) 508 + return FFI_BAD_ABI; 509 + 510 + volatile unsigned short* tramp = 511 + (volatile unsigned short*)&closure->tramp[0]; 512 + 513 + tramp[0] = 0xbb49; /* mov <code>, %r11 */ 514 + *(void* volatile*)&tramp[1] = ffi_closure_unix64; 515 + tramp[5] = 0xba49; /* mov <data>, %r10 */ 516 + *(void* volatile*)&tramp[6] = closure; 517 + 518 + /* Set the carry bit if the function uses any sse registers. 519 + This is clc or stc, together with the first byte of the jmp. */ 520 + tramp[10] = cif->flags & (1 << 11) ? 0x49f9 : 0x49f8; 521 + tramp[11] = 0xe3ff; /* jmp *%r11 */ 522 + 523 + closure->cif = cif; 524 + closure->fun = fun; 525 + closure->user_data = user_data; 526 + 527 + return FFI_OK; 528 + } 529 + 530 + int 531 + ffi_closure_unix64_inner( 532 + ffi_closure* closure, 533 + void* rvalue, 534 + RegisterArgs* reg_args, 535 + char* argp) 536 + { 537 + ffi_cif* cif = closure->cif; 538 + void** avalue = alloca(cif->nargs * sizeof(void *)); 539 + ffi_type** arg_types; 540 + long i, avn; 541 + int gprcount = 0; 542 + int ssecount = 0; 543 + int ngpr, nsse; 544 + int ret; 545 + 546 + ret = cif->rtype->type; 547 + 548 + if (ret != FFI_TYPE_VOID) 549 + { 550 + enum x86_64_reg_class classes[MAX_CLASSES]; 551 + int n = examine_argument (cif->rtype, classes, 1, &ngpr, &nsse); 552 + 553 + if (n == 0) 554 + { 555 + /* The return value goes in memory. Arrange for the closure 556 + return value to go directly back to the original caller. */ 557 + rvalue = (void *) reg_args->gpr[gprcount++]; 558 + 559 + /* We don't have to do anything in asm for the return. */ 560 + ret = FFI_TYPE_VOID; 561 + } 562 + else if (ret == FFI_TYPE_STRUCT && n == 2) 563 + { 564 + /* Mark which register the second word of the structure goes in. */ 565 + _Bool sse0 = SSE_CLASS_P (classes[0]); 566 + _Bool sse1 = SSE_CLASS_P (classes[1]); 567 + 568 + if (!sse0 && sse1) 569 + ret |= 1 << 8; 570 + else if (sse0 && !sse1) 571 + ret |= 1 << 9; 572 + } 573 + } 574 + 575 + avn = cif->nargs; 576 + arg_types = cif->arg_types; 577 + 578 + for (i = 0; i < avn; ++i) 579 + { 580 + enum x86_64_reg_class classes[MAX_CLASSES]; 581 + int n; 582 + 583 + n = examine_argument (arg_types[i], classes, 0, &ngpr, &nsse); 584 + 585 + if (n == 0 586 + || gprcount + ngpr > MAX_GPR_REGS 587 + || ssecount + nsse > MAX_SSE_REGS) 588 + { 589 + long align = arg_types[i]->alignment; 590 + 591 + /* Stack arguments are *always* at least 8 byte aligned. */ 592 + if (align < 8) 593 + align = 8; 594 + 595 + /* Pass this argument in memory. */ 596 + argp = (void *) ALIGN (argp, align); 597 + avalue[i] = argp; 598 + argp += arg_types[i]->size; 599 + } 600 + 601 + #if !defined(X86_DARWIN) 602 + /* If the argument is in a single register, or two consecutive 603 + registers, then we can use that address directly. */ 604 + else if (n == 1 || (n == 2 && 605 + SSE_CLASS_P (classes[0]) == SSE_CLASS_P (classes[1]))) 606 + { 607 + // The argument is in a single register. 608 + if (SSE_CLASS_P (classes[0])) 609 + { 610 + avalue[i] = &reg_args->sse[ssecount]; 611 + ssecount += n; 612 + } 613 + else 614 + { 615 + avalue[i] = &reg_args->gpr[gprcount]; 616 + gprcount += n; 617 + } 618 + } 619 + #endif 620 + 621 + /* Otherwise, allocate space to make them consecutive. */ 622 + else 623 + { 624 + char *a = alloca (16); 625 + int j; 626 + 627 + avalue[i] = a; 628 + 629 + for (j = 0; j < n; j++, a += 8) 630 + { 631 + if (SSE_CLASS_P (classes[j])) 632 + memcpy (a, &reg_args->sse[ssecount++], 8); 633 + else 634 + memcpy (a, &reg_args->gpr[gprcount++], 8); 635 + } 636 + } 637 + } 638 + 639 + /* Invoke the closure. */ 640 + closure->fun (cif, rvalue, avalue, closure->user_data); 641 + 642 + /* Tell assembly how to perform return type promotions. */ 643 + return ret; 644 + } 645 + 646 + #endif /* __x86_64__ */
+436
src/libffi/x86/x86-ffi_darwin.c
··· 1 + #ifdef __i386__ 2 + /* ----------------------------------------------------------------------- 3 + ffi.c - Copyright (c) 1996, 1998, 1999, 2001 Red Hat, Inc. 4 + Copyright (c) 2002 Ranjit Mathew 5 + Copyright (c) 2002 Bo Thorsen 6 + Copyright (c) 2002 Roger Sayle 7 + 8 + x86 Foreign Function Interface 9 + 10 + Permission is hereby granted, free of charge, to any person obtaining 11 + a copy of this software and associated documentation files (the 12 + ``Software''), to deal in the Software without restriction, including 13 + without limitation the rights to use, copy, modify, merge, publish, 14 + distribute, sublicense, and/or sell copies of the Software, and to 15 + permit persons to whom the Software is furnished to do so, subject to 16 + the following conditions: 17 + 18 + The above copyright notice and this permission notice shall be included 19 + in all copies or substantial portions of the Software. 20 + 21 + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS 22 + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 + IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR 25 + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 26 + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 + OTHER DEALINGS IN THE SOFTWARE. 28 + ----------------------------------------------------------------------- */ 29 + 30 + #include <ffi.h> 31 + #include <ffi_common.h> 32 + 33 + #include <stdlib.h> 34 + 35 + /* ffi_prep_args is called by the assembly routine once stack space 36 + has been allocated for the function's arguments */ 37 + 38 + void ffi_prep_args(char *stack, extended_cif *ecif) 39 + { 40 + register unsigned int i; 41 + register void **p_argv; 42 + register char *argp; 43 + register ffi_type **p_arg; 44 + 45 + argp = stack; 46 + 47 + if (ecif->cif->flags == FFI_TYPE_STRUCT) 48 + { 49 + *(void **) argp = ecif->rvalue; 50 + argp += 4; 51 + } 52 + 53 + p_argv = ecif->avalue; 54 + 55 + for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; 56 + i != 0; 57 + i--, p_arg++) 58 + { 59 + size_t z; 60 + 61 + /* Align if necessary */ 62 + if ((sizeof(int) - 1) & (unsigned) argp) 63 + argp = (char *) ALIGN(argp, sizeof(int)); 64 + 65 + z = (*p_arg)->size; 66 + if (z < sizeof(int)) 67 + { 68 + z = sizeof(int); 69 + switch ((*p_arg)->type) 70 + { 71 + case FFI_TYPE_SINT8: 72 + *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); 73 + break; 74 + 75 + case FFI_TYPE_UINT8: 76 + *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); 77 + break; 78 + 79 + case FFI_TYPE_SINT16: 80 + *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); 81 + break; 82 + 83 + case FFI_TYPE_UINT16: 84 + *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); 85 + break; 86 + 87 + case FFI_TYPE_SINT32: 88 + *(signed int *) argp = (signed int)*(SINT32 *)(* p_argv); 89 + break; 90 + 91 + case FFI_TYPE_UINT32: 92 + *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); 93 + break; 94 + 95 + case FFI_TYPE_STRUCT: 96 + *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); 97 + break; 98 + 99 + default: 100 + FFI_ASSERT(0); 101 + } 102 + } 103 + else 104 + { 105 + memcpy(argp, *p_argv, z); 106 + } 107 + p_argv++; 108 + argp += z; 109 + } 110 + 111 + return; 112 + } 113 + 114 + /* Perform machine dependent cif processing */ 115 + ffi_status ffi_prep_cif_machdep(ffi_cif *cif) 116 + { 117 + /* Set the return type flag */ 118 + switch (cif->rtype->type) 119 + { 120 + case FFI_TYPE_VOID: 121 + #ifdef X86 122 + case FFI_TYPE_STRUCT: 123 + case FFI_TYPE_UINT8: 124 + case FFI_TYPE_UINT16: 125 + case FFI_TYPE_SINT8: 126 + case FFI_TYPE_SINT16: 127 + #endif 128 + 129 + case FFI_TYPE_SINT64: 130 + case FFI_TYPE_FLOAT: 131 + case FFI_TYPE_DOUBLE: 132 + case FFI_TYPE_LONGDOUBLE: 133 + cif->flags = (unsigned) cif->rtype->type; 134 + break; 135 + 136 + case FFI_TYPE_UINT64: 137 + cif->flags = FFI_TYPE_SINT64; 138 + break; 139 + 140 + #ifndef X86 141 + case FFI_TYPE_STRUCT: 142 + if (cif->rtype->size == 1) 143 + { 144 + cif->flags = FFI_TYPE_SINT8; /* same as char size */ 145 + } 146 + else if (cif->rtype->size == 2) 147 + { 148 + cif->flags = FFI_TYPE_SINT16; /* same as short size */ 149 + } 150 + else if (cif->rtype->size == 4) 151 + { 152 + cif->flags = FFI_TYPE_INT; /* same as int type */ 153 + } 154 + else if (cif->rtype->size == 8) 155 + { 156 + cif->flags = FFI_TYPE_SINT64; /* same as int64 type */ 157 + } 158 + else 159 + { 160 + cif->flags = FFI_TYPE_STRUCT; 161 + } 162 + break; 163 + #endif 164 + 165 + default: 166 + cif->flags = FFI_TYPE_INT; 167 + break; 168 + } 169 + 170 + #ifdef X86_DARWIN 171 + cif->bytes = (cif->bytes + 15) & ~0xF; 172 + #endif 173 + 174 + return FFI_OK; 175 + } 176 + 177 + extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, 178 + unsigned, unsigned, unsigned *, void (*fn)()); 179 + 180 + #ifdef X86_WIN32 181 + extern void ffi_call_STDCALL(void (*)(char *, extended_cif *), extended_cif *, 182 + unsigned, unsigned, unsigned *, void (*fn)()); 183 + 184 + #endif /* X86_WIN32 */ 185 + 186 + void ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue) 187 + { 188 + extended_cif ecif; 189 + 190 + ecif.cif = cif; 191 + ecif.avalue = avalue; 192 + 193 + /* If the return value is a struct and we don't have a return */ 194 + /* value address then we need to make one */ 195 + 196 + if ((rvalue == NULL) && 197 + (cif->flags == FFI_TYPE_STRUCT)) 198 + { 199 + ecif.rvalue = alloca(cif->rtype->size); 200 + } 201 + else 202 + ecif.rvalue = rvalue; 203 + 204 + 205 + switch (cif->abi) 206 + { 207 + case FFI_SYSV: 208 + ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, 209 + fn); 210 + break; 211 + #ifdef X86_WIN32 212 + case FFI_STDCALL: 213 + ffi_call_STDCALL(ffi_prep_args, &ecif, cif->bytes, cif->flags, 214 + ecif.rvalue, fn); 215 + break; 216 + #endif /* X86_WIN32 */ 217 + default: 218 + FFI_ASSERT(0); 219 + break; 220 + } 221 + } 222 + 223 + 224 + /** private members **/ 225 + 226 + static void ffi_prep_incoming_args_SYSV (char *stack, void **ret, 227 + void** args, ffi_cif* cif); 228 + void FFI_HIDDEN ffi_closure_SYSV (ffi_closure *) 229 + __attribute__ ((regparm(1))); 230 + unsigned int FFI_HIDDEN ffi_closure_SYSV_inner (ffi_closure *, void **, void *) 231 + __attribute__ ((regparm(1))); 232 + void FFI_HIDDEN ffi_closure_raw_SYSV (ffi_raw_closure *) 233 + __attribute__ ((regparm(1))); 234 + 235 + /* This function is jumped to by the trampoline */ 236 + 237 + unsigned int FFI_HIDDEN 238 + ffi_closure_SYSV_inner (closure, respp, args) 239 + ffi_closure *closure; 240 + void **respp; 241 + void *args; 242 + { 243 + // our various things... 244 + ffi_cif *cif; 245 + void **arg_area; 246 + 247 + cif = closure->cif; 248 + arg_area = (void**) alloca (cif->nargs * sizeof (void*)); 249 + 250 + /* this call will initialize ARG_AREA, such that each 251 + * element in that array points to the corresponding 252 + * value on the stack; and if the function returns 253 + * a structure, it will re-set RESP to point to the 254 + * structure return address. */ 255 + 256 + ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif); 257 + 258 + (closure->fun) (cif, *respp, arg_area, closure->user_data); 259 + 260 + return cif->flags; 261 + } 262 + 263 + static void 264 + ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, void **avalue, 265 + ffi_cif *cif) 266 + { 267 + register unsigned int i; 268 + register void **p_argv; 269 + register char *argp; 270 + register ffi_type **p_arg; 271 + 272 + argp = stack; 273 + 274 + if ( cif->flags == FFI_TYPE_STRUCT ) { 275 + *rvalue = *(void **) argp; 276 + argp += 4; 277 + } 278 + 279 + p_argv = avalue; 280 + 281 + for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++) 282 + { 283 + size_t z; 284 + 285 + /* Align if necessary */ 286 + if ((sizeof(int) - 1) & (unsigned) argp) { 287 + argp = (char *) ALIGN(argp, sizeof(int)); 288 + } 289 + 290 + z = (*p_arg)->size; 291 + 292 + /* because we're little endian, this is what it turns into. */ 293 + 294 + *p_argv = (void*) argp; 295 + 296 + p_argv++; 297 + argp += z; 298 + } 299 + 300 + return; 301 + } 302 + 303 + /* How to make a trampoline. Derived from gcc/config/i386/i386.c. */ 304 + 305 + #define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \ 306 + ({ unsigned char *__tramp = (unsigned char*)(TRAMP); \ 307 + unsigned int __fun = (unsigned int)(FUN); \ 308 + unsigned int __ctx = (unsigned int)(CTX); \ 309 + unsigned int __dis = __fun - (__ctx + FFI_TRAMPOLINE_SIZE); \ 310 + *(unsigned char*) &__tramp[0] = 0xb8; \ 311 + *(unsigned int*) &__tramp[1] = __ctx; /* movl __ctx, %eax */ \ 312 + *(unsigned char *) &__tramp[5] = 0xe9; \ 313 + *(unsigned int*) &__tramp[6] = __dis; /* jmp __fun */ \ 314 + }) 315 + 316 + 317 + /* the cif must already be prep'ed */ 318 + ffi_status 319 + ffi_prep_closure (ffi_closure* closure, 320 + ffi_cif* cif, 321 + void (*fun)(ffi_cif*,void*,void**,void*), 322 + void *user_data) 323 + { 324 + if (cif->abi != FFI_SYSV) 325 + return FFI_BAD_ABI; 326 + 327 + FFI_INIT_TRAMPOLINE (&closure->tramp[0], \ 328 + &ffi_closure_SYSV, \ 329 + (void*)closure); 330 + 331 + closure->cif = cif; 332 + closure->user_data = user_data; 333 + closure->fun = fun; 334 + 335 + return FFI_OK; 336 + } 337 + 338 + /* ------- Native raw API support -------------------------------- */ 339 + 340 + #if !FFI_NO_RAW_API 341 + 342 + ffi_status 343 + ffi_prep_raw_closure_loc (ffi_raw_closure* closure, 344 + ffi_cif* cif, 345 + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), 346 + void *user_data, 347 + void *codeloc) 348 + { 349 + int i; 350 + 351 + FFI_ASSERT (cif->abi == FFI_SYSV); 352 + 353 + // we currently don't support certain kinds of arguments for raw 354 + // closures. This should be implemented by a separate assembly language 355 + // routine, since it would require argument processing, something we 356 + // don't do now for performance. 357 + 358 + for (i = cif->nargs-1; i >= 0; i--) 359 + { 360 + FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_STRUCT); 361 + FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_LONGDOUBLE); 362 + } 363 + 364 + 365 + FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_raw_SYSV, 366 + codeloc); 367 + 368 + closure->cif = cif; 369 + closure->user_data = user_data; 370 + closure->fun = fun; 371 + 372 + return FFI_OK; 373 + } 374 + 375 + static void 376 + ffi_prep_args_raw(char *stack, extended_cif *ecif) 377 + { 378 + memcpy (stack, ecif->avalue, ecif->cif->bytes); 379 + } 380 + 381 + /* we borrow this routine from libffi (it must be changed, though, to 382 + * actually call the function passed in the first argument. as of 383 + * libffi-1.20, this is not the case.) 384 + */ 385 + 386 + extern void 387 + ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, unsigned, 388 + unsigned, unsigned *, void (*fn)()); 389 + 390 + #ifdef X86_WIN32 391 + extern void 392 + ffi_call_STDCALL(void (*)(char *, extended_cif *), extended_cif *, unsigned, 393 + unsigned, unsigned *, void (*fn)()); 394 + #endif /* X86_WIN32 */ 395 + 396 + void 397 + ffi_raw_call(ffi_cif *cif, void (*fn)(), void *rvalue, ffi_raw *fake_avalue) 398 + { 399 + extended_cif ecif; 400 + void **avalue = (void **)fake_avalue; 401 + 402 + ecif.cif = cif; 403 + ecif.avalue = avalue; 404 + 405 + /* If the return value is a struct and we don't have a return */ 406 + /* value address then we need to make one */ 407 + 408 + if ((rvalue == NULL) && 409 + (cif->rtype->type == FFI_TYPE_STRUCT)) 410 + { 411 + ecif.rvalue = alloca(cif->rtype->size); 412 + } 413 + else 414 + ecif.rvalue = rvalue; 415 + 416 + 417 + switch (cif->abi) 418 + { 419 + case FFI_SYSV: 420 + ffi_call_SYSV(ffi_prep_args_raw, &ecif, cif->bytes, cif->flags, 421 + ecif.rvalue, fn); 422 + break; 423 + #ifdef X86_WIN32 424 + case FFI_STDCALL: 425 + ffi_call_STDCALL(ffi_prep_args_raw, &ecif, cif->bytes, cif->flags, 426 + ecif.rvalue, fn); 427 + break; 428 + #endif /* X86_WIN32 */ 429 + default: 430 + FFI_ASSERT(0); 431 + break; 432 + } 433 + } 434 + 435 + #endif 436 + #endif // __i386__
-32
src/libncurses/CMakeLists.txt
··· 1 - project(libncurses) 2 - 3 - cmake_minimum_required(VERSION 2.4.0) 4 - if(COMMAND cmake_policy) 5 - cmake_policy(SET CMP0003 NEW) 6 - endif(COMMAND cmake_policy) 7 - 8 - enable_language(ASM_NASM) 9 - 10 - #if (NOT "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1}" MATCHES ".*clang") 11 - # message(FATAL_ERROR "Clang is the only supported compiler.") 12 - #endif (NOT "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1}" MATCHES ".*clang") 13 - 14 - #configure_file(config.h.in config.h) 15 - #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fblocks -std=c++0x") 16 - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") 17 - 18 - set(libncurses_SRCS 19 - wrap.c 20 - ) 21 - 22 - SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib${SUFFIX}/darling") 23 - #SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--enable-new-dtags") 24 - SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) 25 - SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) 26 - 27 - add_library(ncursesdarwin SHARED ${libncurses_SRCS}) 28 - # -luuid to make uuid_ functions available for Darwin apps 29 - target_link_libraries(ncursesdarwin -lncurses) 30 - 31 - install(TARGETS ncursesdarwin DESTINATION "lib${SUFFIX}/darling") 32 -
-148
src/libncurses/wrap.c
··· 1 - #include <curses.h> 2 - #include <stdlib.h> 3 - #include <stdint.h> 4 - 5 - uint32_t __darwin_acs_map[256]; 6 - 7 - WINDOW* __darwin_initscr(void) 8 - { 9 - WINDOW* win = initscr(); 10 - 11 - for (int i = 0; i < 256; i++) 12 - __darwin_acs_map[i] = acs_map[i]; 13 - 14 - return win; 15 - } 16 - 17 - int __darwin_wborder (WINDOW * w,uint32_t c1,uint32_t c2,uint32_t c3,uint32_t c4,uint32_t c5,uint32_t c6,uint32_t c7,uint32_t c8) 18 - { 19 - return wborder(w,c1,c2,c3,c4,c5,c6,c7,c8); 20 - } 21 - 22 - int __darwin_pechochar (WINDOW * w, const uint32_t c) 23 - { 24 - return pechochar(w, c); 25 - } 26 - 27 - int __darwin_slk_attroff (const uint32_t c) 28 - { 29 - return slk_attroff(c); 30 - } 31 - 32 - int __darwin_slk_attron (const uint32_t c) 33 - { 34 - return slk_attron(c); 35 - } 36 - 37 - int __darwin_slk_attrset (const uint32_t c) 38 - { 39 - return slk_attrset(c); 40 - } 41 - 42 - uint32_t __darwin_termattrs (void) 43 - { 44 - return termattrs(); 45 - } 46 - 47 - int __darwin_vidattr (uint32_t c) 48 - { 49 - return vidattr(c); 50 - } 51 - 52 - int __darwin_vidputs (uint32_t, NCURSES_OUTC); 53 - 54 - int __darwin_waddch (WINDOW *w, const uint32_t c) 55 - { 56 - return waddch(w, c); 57 - } 58 - 59 - int __darwin_waddchnstr (WINDOW * w,const uint32_t * c,int n) 60 - { 61 - chtype* nc = malloc(sizeof(chtype)*n); 62 - for (int i = 0; i < n; i++) 63 - nc[i] = c[i]; 64 - int rv = waddchnstr(w, nc, n); 65 - free(nc); 66 - return rv; 67 - } 68 - 69 - int __darwin_wbkgd (WINDOW * w, uint32_t c) 70 - { 71 - return wbkgd(w, c); 72 - } 73 - 74 - void __darwin_wbkgdset (WINDOW *w,uint32_t c) 75 - { 76 - wbkgdset(w, c); 77 - } 78 - 79 - int __darwin_wechochar (WINDOW *w, const uint32_t c) 80 - { 81 - return wechochar(w, c); 82 - } 83 - 84 - int __darwin_whline (WINDOW *w, uint32_t c, int n) 85 - { 86 - return whline(w, c, n); 87 - } 88 - 89 - uint32_t __darwin_winch (WINDOW *w) 90 - { 91 - return winch(w); 92 - } 93 - 94 - int __darwin_winchnstr (WINDOW *w, uint32_t *c, int n) 95 - { 96 - chtype* nc = malloc(sizeof(chtype)*n); 97 - int rv = winchnstr(w, nc, n); 98 - for (int i = 0; i < n; i++) 99 - c[i] = nc[i]; 100 - free(nc); 101 - return rv; 102 - } 103 - 104 - int __darwin_winsch (WINDOW *w, uint32_t c) 105 - { 106 - return winsch(w, c); 107 - } 108 - 109 - int __darwin_wvline (WINDOW *w,uint32_t c,int n) 110 - { 111 - return wvline(w,c,n); 112 - } 113 - 114 - int __darwin_slk_attroff_sp (SCREEN*, const uint32_t); 115 - int __darwin_slk_attron_sp (SCREEN*, const uint32_t); 116 - int __darwin_slk_attrset_sp (SCREEN*, const uint32_t); 117 - uint32_t __darwin_termattrs_sp (SCREEN*); 118 - int __darwin_vidattr_sp (SCREEN*, uint32_t); 119 - int __darwin_vidputs_sp (SCREEN*, uint32_t, NCURSES_SP_OUTC); 120 - 121 - uint32_t __darwin_slk_attr (void) 122 - { 123 - return slk_attr(); 124 - } 125 - 126 - int __darwin_slk_attr_set (const uint32_t a,short s,void* p) 127 - { 128 - return slk_attr_set(a,s,p); 129 - } 130 - int __darwin_wattr_on (WINDOW *w, uint32_t a, void *p) 131 - { 132 - return wattr_on(w,a,p); 133 - } 134 - 135 - int __darwin_wattr_off (WINDOW *w, uint32_t a, void *p) 136 - { 137 - return wattr_off(w,a,p); 138 - } 139 - 140 - int __darwin_wchgat (WINDOW *w, int i, uint32_t a, short s, const void *p) 141 - { 142 - return wchgat(w, i, a, s, p); 143 - } 144 - 145 - uint32_t __darwin_slk_attr_sp (SCREEN*); 146 - int __darwin_slk_attr_set_sp (SCREEN*, const uint32_t, short, void*); 147 - 148 -
-58
src/util/Regexp.cpp
··· 1 - #include "Regexp.h" 2 - #include <stdexcept> 3 - 4 - namespace Darling { 5 - 6 - Regexp::Regexp(const std::string& re, bool caseInsensitive) 7 - { 8 - int flags, rv; 9 - 10 - flags = REG_EXTENDED; 11 - 12 - if (caseInsensitive) 13 - flags |= REG_ICASE; 14 - 15 - rv = ::regcomp(&m_regex, re.c_str(), flags); 16 - if (rv) 17 - throwError(rv); 18 - } 19 - 20 - Regexp::~Regexp() 21 - { 22 - regfree(&m_regex); 23 - } 24 - 25 - void Regexp::throwError(int code) 26 - { 27 - char buffer[512]; 28 - 29 - ::regerror(code, &m_regex, buffer, sizeof(buffer)); 30 - 31 - throw std::invalid_argument(buffer); 32 - } 33 - 34 - bool Regexp::matches(const std::string& input) 35 - { 36 - int rv; 37 - regmatch_t matches[50]; 38 - 39 - m_matches.clear(); 40 - 41 - rv = ::regexec(&m_regex, input.c_str(), sizeof(matches)/sizeof(matches[0]), matches, 0); 42 - 43 - if (rv == REG_NOMATCH) 44 - return false; 45 - else if (rv == REG_NOERROR) 46 - { 47 - for (int i = 0; i < sizeof(matches)/sizeof(matches[0]) && matches[i].rm_so != -1; i++) 48 - { 49 - m_matches.push_back(input.substr(matches[i].rm_so, matches[i].rm_eo - matches[i].rm_so)); 50 - } 51 - return true; 52 - } 53 - else 54 - throwError(rv); 55 - } 56 - 57 - } 58 -
-29
src/util/Regexp.h
··· 1 - #ifndef REGEXP_H 2 - #define REGEXP_H 3 - #include <regex.h> 4 - #include <string> 5 - #include <vector> 6 - 7 - namespace Darling { 8 - 9 - class Regexp 10 - { 11 - public: 12 - Regexp(const std::string& re, bool caseInsensitive = false); 13 - ~Regexp(); 14 - 15 - bool matches(const std::string& input); 16 - 17 - inline size_t groups() const { return m_matches.size(); } 18 - inline std::string group(size_t index) const { return m_matches.at(index); } 19 - private: 20 - void throwError(int code) __attribute__((noreturn)); 21 - private: 22 - regex_t m_regex; 23 - std::vector<std::string> m_matches; 24 - }; 25 - 26 - } // namespace Darling 27 - 28 - #endif 29 -