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