abitypes.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #ifndef EXEC_USER_ABITYPES_H
  2. #define EXEC_USER_ABITYPES_H
  3. #include "cpu.h"
  4. #ifdef TARGET_ABI32
  5. #define TARGET_ABI_BITS 32
  6. #else
  7. #define TARGET_ABI_BITS TARGET_LONG_BITS
  8. #endif
  9. #ifdef TARGET_M68K
  10. #define ABI_INT_ALIGNMENT 2
  11. #define ABI_LONG_ALIGNMENT 2
  12. #define ABI_LLONG_ALIGNMENT 2
  13. #endif
  14. #ifndef ABI_SHORT_ALIGNMENT
  15. #define ABI_SHORT_ALIGNMENT 2
  16. #endif
  17. #ifndef ABI_INT_ALIGNMENT
  18. #define ABI_INT_ALIGNMENT 4
  19. #endif
  20. #ifndef ABI_LONG_ALIGNMENT
  21. #define ABI_LONG_ALIGNMENT (TARGET_ABI_BITS / 8)
  22. #endif
  23. #ifndef ABI_LLONG_ALIGNMENT
  24. #define ABI_LLONG_ALIGNMENT 8
  25. #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)));
  30. typedef int64_t abi_llong __attribute__((aligned(ABI_LLONG_ALIGNMENT)));
  31. typedef uint64_t abi_ullong __attribute__((aligned(ABI_LLONG_ALIGNMENT)));
  32. #ifdef TARGET_ABI32
  33. typedef uint32_t abi_ulong __attribute__((aligned(ABI_LONG_ALIGNMENT)));
  34. typedef int32_t abi_long __attribute__((aligned(ABI_LONG_ALIGNMENT)));
  35. #define TARGET_ABI_FMT_lx "%08x"
  36. #define TARGET_ABI_FMT_ld "%d"
  37. #define TARGET_ABI_FMT_lu "%u"
  38. static inline abi_ulong tswapal(abi_ulong v)
  39. {
  40. return tswap32(v);
  41. }
  42. #else
  43. typedef target_ulong abi_ulong __attribute__((aligned(ABI_LONG_ALIGNMENT)));
  44. typedef target_long abi_long __attribute__((aligned(ABI_LONG_ALIGNMENT)));
  45. #define TARGET_ABI_FMT_lx TARGET_FMT_lx
  46. #define TARGET_ABI_FMT_ld TARGET_FMT_ld
  47. #define TARGET_ABI_FMT_lu TARGET_FMT_lu
  48. /* for consistency, define ABI32 too */
  49. #if TARGET_ABI_BITS == 32
  50. #define TARGET_ABI32 1
  51. #endif
  52. static inline abi_ulong tswapal(abi_ulong v)
  53. {
  54. return tswapl(v);
  55. }
  56. #endif
  57. #endif