]> git.proxmox.com Git - qemu.git/blob - include/exec/user/abitypes.h
elfload: use abi_int/uint instead of target_int/uint
[qemu.git] / include / exec / user / abitypes.h
1 #ifndef QEMU_TYPES_H
2 #define QEMU_TYPES_H
3 #include "cpu.h"
4
5 #ifdef TARGET_M68K
6 #define ABI_INT_ALIGNMENT 2
7 #endif
8
9 #ifndef ABI_SHORT_ALIGNMENT
10 #define ABI_SHORT_ALIGNMENT 2
11 #endif
12 #ifndef ABI_INT_ALIGNMENT
13 #define ABI_INT_ALIGNMENT 4
14 #endif
15
16 typedef int16_t abi_short __attribute__ ((aligned(ABI_SHORT_ALIGNMENT)));
17 typedef uint16_t abi_ushort __attribute__((aligned(ABI_SHORT_ALIGNMENT)));
18 typedef int32_t abi_int __attribute__((aligned(ABI_INT_ALIGNMENT)));
19 typedef uint32_t abi_uint __attribute__((aligned(ABI_INT_ALIGNMENT)));
20
21 #ifdef TARGET_ABI32
22 typedef uint32_t abi_ulong;
23 typedef int32_t abi_long;
24 #define TARGET_ABI_FMT_lx "%08x"
25 #define TARGET_ABI_FMT_ld "%d"
26 #define TARGET_ABI_FMT_lu "%u"
27 #define TARGET_ABI_BITS 32
28
29 static inline abi_ulong tswapal(abi_ulong v)
30 {
31 return tswap32(v);
32 }
33
34 #else
35 typedef target_ulong abi_ulong;
36 typedef target_long abi_long;
37 #define TARGET_ABI_FMT_lx TARGET_FMT_lx
38 #define TARGET_ABI_FMT_ld TARGET_FMT_ld
39 #define TARGET_ABI_FMT_lu TARGET_FMT_lu
40 #define TARGET_ABI_BITS TARGET_LONG_BITS
41 /* for consistency, define ABI32 too */
42 #if TARGET_ABI_BITS == 32
43 #define TARGET_ABI32 1
44 #endif
45
46 static inline abi_ulong tswapal(abi_ulong v)
47 {
48 return tswapl(v);
49 }
50
51 #endif
52 #endif