elfload: only give abi_long/ulong the alignment specified by the target
[qemu/ar7.git] / include / exec / user / abitypes.h
blob4b04f6d27bf62bea97b0f807fe2852904bac8581
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 #endif
16 #ifndef ABI_SHORT_ALIGNMENT
17 #define ABI_SHORT_ALIGNMENT 2
18 #endif
19 #ifndef ABI_INT_ALIGNMENT
20 #define ABI_INT_ALIGNMENT 4
21 #endif
22 #ifndef ABI_LONG_ALIGNMENT
23 #define ABI_LONG_ALIGNMENT (TARGET_ABI_BITS / 8)
24 #endif
26 typedef int16_t abi_short __attribute__ ((aligned(ABI_SHORT_ALIGNMENT)));
27 typedef uint16_t abi_ushort __attribute__((aligned(ABI_SHORT_ALIGNMENT)));
28 typedef int32_t abi_int __attribute__((aligned(ABI_INT_ALIGNMENT)));
29 typedef uint32_t abi_uint __attribute__((aligned(ABI_INT_ALIGNMENT)));
31 #ifdef TARGET_ABI32
32 typedef uint32_t abi_ulong __attribute__((aligned(ABI_LONG_ALIGNMENT)));
33 typedef int32_t abi_long __attribute__((aligned(ABI_LONG_ALIGNMENT)));
34 #define TARGET_ABI_FMT_lx "%08x"
35 #define TARGET_ABI_FMT_ld "%d"
36 #define TARGET_ABI_FMT_lu "%u"
38 static inline abi_ulong tswapal(abi_ulong v)
40 return tswap32(v);
43 #else
44 typedef target_ulong abi_ulong __attribute__((aligned(ABI_LONG_ALIGNMENT)));
45 typedef target_long abi_long __attribute__((aligned(ABI_LONG_ALIGNMENT)));
46 #define TARGET_ABI_FMT_lx TARGET_FMT_lx
47 #define TARGET_ABI_FMT_ld TARGET_FMT_ld
48 #define TARGET_ABI_FMT_lu TARGET_FMT_lu
49 /* for consistency, define ABI32 too */
50 #if TARGET_ABI_BITS == 32
51 #define TARGET_ABI32 1
52 #endif
54 static inline abi_ulong tswapal(abi_ulong v)
56 return tswapl(v);
59 #endif
60 #endif