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