~ubuntu-branches/ubuntu/maverick/python3.1/maverick

« back to all changes in this revision

Viewing changes to Modules/_ctypes/libffi_osx/powerpc/ppc-darwin.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-03-23 00:01:27 UTC
  • Revision ID: james.westby@ubuntu.com-20090323000127-5fstfxju4ufrhthq
Tags: upstream-3.1~a1+20090322
ImportĀ upstreamĀ versionĀ 3.1~a1+20090322

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
26
#define L(x) x
 
27
 
 
28
#define SF_ARG9         MODE_CHOICE(56,112)
 
29
#define SF_ARG10        MODE_CHOICE(60,120)
 
30
#define SF_ARG11        MODE_CHOICE(64,128)
 
31
#define SF_ARG12        MODE_CHOICE(68,136)
 
32
#define SF_ARG13        MODE_CHOICE(72,144)
 
33
#define SF_ARG14        MODE_CHOICE(76,152)
 
34
#define SF_ARG15        MODE_CHOICE(80,160)
 
35
#define SF_ARG16        MODE_CHOICE(84,168)
 
36
#define SF_ARG17        MODE_CHOICE(88,176)
 
37
#define SF_ARG18        MODE_CHOICE(92,184)
 
38
#define SF_ARG19        MODE_CHOICE(96,192)
 
39
#define SF_ARG20        MODE_CHOICE(100,200)
 
40
#define SF_ARG21        MODE_CHOICE(104,208)
 
41
#define SF_ARG22        MODE_CHOICE(108,216)
 
42
#define SF_ARG23        MODE_CHOICE(112,224)
 
43
#define SF_ARG24        MODE_CHOICE(116,232)
 
44
#define SF_ARG25        MODE_CHOICE(120,240)
 
45
#define SF_ARG26        MODE_CHOICE(124,248)
 
46
#define SF_ARG27        MODE_CHOICE(128,256)
 
47
#define SF_ARG28        MODE_CHOICE(132,264)
 
48
#define SF_ARG29        MODE_CHOICE(136,272)
 
49
 
 
50
#define ASM_NEEDS_REGISTERS             4
 
51
#define NUM_GPR_ARG_REGISTERS   8
 
52
#define NUM_FPR_ARG_REGISTERS   13
 
53
 
 
54
#define FFI_TYPE_1_BYTE(x)      ((x) == FFI_TYPE_UINT8 || (x) == FFI_TYPE_SINT8)
 
55
#define FFI_TYPE_2_BYTE(x)      ((x) == FFI_TYPE_UINT16 || (x) == FFI_TYPE_SINT16)
 
56
#define FFI_TYPE_4_BYTE(x)      \
 
57
        ((x) == FFI_TYPE_UINT32 || (x) == FFI_TYPE_SINT32 ||\
 
58
        (x) == FFI_TYPE_INT || (x) == FFI_TYPE_FLOAT)
 
59
 
 
60
 
 
61
#if !defined(LIBFFI_ASM)
 
62
 
 
63
enum {
 
64
        FLAG_RETURNS_NOTHING    = 1 << (31 - 30),       //      cr7
 
65
        FLAG_RETURNS_FP                 = 1 << (31 - 29),
 
66
        FLAG_RETURNS_64BITS             = 1 << (31 - 28),
 
67
        FLAG_RETURNS_128BITS    = 1 << (31 - 31),
 
68
 
 
69
        FLAG_RETURNS_STRUCT             = 1 << (31 - 27),       //      cr6
 
70
        FLAG_STRUCT_CONTAINS_FP = 1 << (31 - 26),
 
71
 
 
72
        FLAG_ARG_NEEDS_COPY             = 1 << (31 - 7),
 
73
        FLAG_FP_ARGUMENTS               = 1 << (31 - 6),        //      cr1.eq; specified by ABI
 
74
        FLAG_4_GPR_ARGUMENTS    = 1 << (31 - 5),
 
75
        FLAG_RETVAL_REFERENCE   = 1 << (31 - 4)
 
76
};
 
77
 
 
78
 
 
79
void ffi_prep_args(extended_cif*   inEcif, unsigned *const stack);
 
80
 
 
81
typedef union
 
82
{
 
83
        float   f;
 
84
        double  d;
 
85
} ffi_dblfl;
 
86
 
 
87
int ffi_closure_helper_DARWIN( ffi_closure*    closure,
 
88
        void*                   rvalue, unsigned long*  pgr,
 
89
        ffi_dblfl*              pfr);
 
90
 
 
91
 
 
92
#if defined(__ppc64__)
 
93
void ffi64_struct_to_ram_form(const ffi_type*, const char*, unsigned int*,
 
94
        const char*, unsigned int*, unsigned int*, char*, unsigned int*);
 
95
void ffi64_struct_to_reg_form(const ffi_type*, const char*, unsigned int*,
 
96
        unsigned int*, char*, unsigned int*, char*, unsigned int*);
 
97
bool ffi64_stret_needs_ptr(const ffi_type* inType,
 
98
        unsigned short*, unsigned short*);
 
99
bool ffi64_struct_contains_fp(const ffi_type* inType);
 
100
unsigned int ffi64_data_size(const ffi_type* inType);
 
101
 
 
102
 
 
103
 
 
104
#endif
 
105
 
 
106
#endif  // !defined(LIBFFI_ASM)