PPC: Fix rldcl
[qemu/agraf.git] / include / exec / user / abitypes.h
blob008501b8d8f7d5e627e4455b2ccb3f234a9cd369
1 #ifndef QEMU_TYPES_H
2 #define QEMU_TYPES_H
3 #include "cpu.h"
5 #ifdef TARGET_ABI32
6 #define TARGET_ABI_BITS 32
7 #else
8 #define TARGET_ABI_BITS TARGET_LONG_BITS
9 #endif
11 #ifdef TARGET_M68K
12 #define ABI_INT_ALIGNMENT 2
13 #define ABI_LONG_ALIGNMENT 2
14 #define ABI_LLONG_ALIGNMENT 2
15 #endif
17 #ifdef TARGET_ARM
18 #define ABI_LLONG_ALIGNMENT 4
19 #endif
21 #ifndef ABI_SHORT_ALIGNMENT
22 #define ABI_SHORT_ALIGNMENT 2
23 #endif
24 #ifndef ABI_INT_ALIGNMENT
25 #define ABI_INT_ALIGNMENT 4
26 #endif
27 #ifndef ABI_LONG_ALIGNMENT
28 #define ABI_LONG_ALIGNMENT (TARGET_ABI_BITS / 8)
29 #endif
30 #ifndef ABI_LLONG_ALIGNMENT
31 #define ABI_LLONG_ALIGNMENT 8
32 #endif
34 typedef int16_t abi_short __attribute__ ((aligned(ABI_SHORT_ALIGNMENT)));
35 typedef uint16_t abi_ushort __attribute__((aligned(ABI_SHORT_ALIGNMENT)));
36 typedef int32_t abi_int __attribute__((aligned(ABI_INT_ALIGNMENT)));
37 typedef uint32_t abi_uint __attribute__((aligned(ABI_INT_ALIGNMENT)));
38 typedef int64_t abi_llong __attribute__((aligned(ABI_LLONG_ALIGNMENT)));
39 typedef uint64_t abi_ullong __attribute__((aligned(ABI_LLONG_ALIGNMENT)));
41 #ifdef TARGET_ABI32
42 typedef uint32_t abi_ulong __attribute__((aligned(ABI_LONG_ALIGNMENT)));
43 typedef int32_t abi_long __attribute__((aligned(ABI_LONG_ALIGNMENT)));
44 #define TARGET_ABI_FMT_lx "%08x"
45 #define TARGET_ABI_FMT_ld "%d"
46 #define TARGET_ABI_FMT_lu "%u"
48 static inline abi_ulong tswapal(abi_ulong v)
50 return tswap32(v);
53 #else
54 typedef target_ulong abi_ulong __attribute__((aligned(ABI_LONG_ALIGNMENT)));
55 typedef target_long abi_long __attribute__((aligned(ABI_LONG_ALIGNMENT)));
56 #define TARGET_ABI_FMT_lx TARGET_FMT_lx
57 #define TARGET_ABI_FMT_ld TARGET_FMT_ld
58 #define TARGET_ABI_FMT_lu TARGET_FMT_lu
59 /* for consistency, define ABI32 too */
60 #if TARGET_ABI_BITS == 32
61 #define TARGET_ABI32 1
62 #endif
64 static inline abi_ulong tswapal(abi_ulong v)
66 return tswapl(v);
69 #endif
70 #endif