2 (C) Copyright IBM Corp. 2007, 2008
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
9 * Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer.
11 * Redistributions in binary form must reproduce the above copyright
12 notice, this list of conditions and the following disclaimer in the
13 documentation and/or other materials provided with the distribution.
14 * Neither the name of IBM nor the names of its contributors may be
15 used to endorse or promote products derived from this software without
16 specific prior written permission.
18 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 POSSIBILITY OF SUCH DAMAGE.
32 #ifndef __EA_INTERNAL_H
33 #define __EA_INTERNAL_H
36 #define JSRE_POSIX1_SIGNALCODE 0x2101
37 #define SPE_POSIX1_FTOK 0x05
38 #define SPE_POSIX1_MMAP 0x0b
39 #define SPE_POSIX1_MUNMAP 0x0e
40 /* implemented to here */
41 #define SPE_POSIX1_MREMAP 0x0c
42 #define SPE_POSIX1_MSYNC 0x0d
43 #define SPE_POSIX1_SHMGET 0x14
44 #define SPE_POSIX1_SHMCTL 0x12
45 #define SPE_POSIX1_SHMAT 0x11
46 #define SPE_POSIX1_SHMDT 0x13
47 #define SPE_POSIX1_SHM_OPEN 0x15
48 #define SPE_POSIX1_SHM_UNLINK 0x16
50 #define JSRE_LIBEA_SIGNALCODE 0x2105
51 #define SPE_LIBEA_CALLOC 0x01
52 #define SPE_LIBEA_FREE 0x02
53 #define SPE_LIBEA_MALLOC 0x03
54 #define SPE_LIBEA_REALLOC 0x04
55 #define SPE_LIBEA_POSIX_MEMALIGN 0x05
64 #define ROUND_UP_NEXT_128(x) (((x) + 128) & (~127))
65 #define ROUND_DOWN_128(x) ((x) & (~127))
67 /* Macro that generates an __ea alias. */
69 #define COMPAT_EA_ALIAS(name) asm (".global\t__" #name "64\n\t.set\t__" #name "64," #name)
71 #define COMPAT_EA_ALIAS(name) asm (".global\t__" #name "32\n\t.set\t__" #name "32," #name)
74 static inline __ea
void* round_down_128_ea(__ea
void* x
)
76 size_ea_t tmp
= (size_ea_t
) x
;
78 return (__ea
void*)tmp
;
82 inline __ea
void* round_up_next_128_ea(__ea
void* x
)
84 size_ea_t tmp
= (size_ea_t
) x
;
87 return (__ea
void*)tmp
;
90 #define __cache_fetch_dirty_all(x) \
91 __cache_fetch_dirty(round_down_128_ea(x), 128)
93 /* please optimize, this hurts my eyes */
95 three_way_min(size_t x
, size_t y
, size_t z
)
110 #define eavoid_to_ul(X) ({ \
112 __asm__ ("# %0 %1" : "=r" (_y) : "0" (X)); \
117 #define eavoid_to_ull(X) ({ \
118 unsigned long long _y; \
119 __asm__ ("# %0 %1" : "=r" (_y) : "0" (X)); \
125 #define ull_to_eavoid(X) ({ \
127 unsigned long long X2; \
129 __asm__ ("# %0 %1" : "=r" (_y) : "0" (X2)); \
133 #define ull_to_eavoid(X) ({ \
135 __asm__ ("# %0 %1" : "=r" (_y) : "0" (X)); \
141 #define ul_to_eavoid(X) ({ \
143 __asm__ ("# %0 %1" : "=r" (_y) : "0" (X)); \
147 #endif /*__EA_INTERNAL_H*/