interface.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /******************************************************************************
  2. * Guest OS interface to ARM Xen.
  3. *
  4. * Stefano Stabellini <stefano.stabellini@eu.citrix.com>, Citrix, 2012
  5. */
  6. #ifndef _ASM_ARM_XEN_INTERFACE_H
  7. #define _ASM_ARM_XEN_INTERFACE_H
  8. #include <linux/types.h>
  9. #define uint64_aligned_t uint64_t __attribute__((aligned(8)))
  10. #define __DEFINE_GUEST_HANDLE(name, type) \
  11. typedef struct { union { type *p; uint64_aligned_t q; }; } \
  12. __guest_handle_ ## name
  13. #define DEFINE_GUEST_HANDLE_STRUCT(name) \
  14. __DEFINE_GUEST_HANDLE(name, struct name)
  15. #define DEFINE_GUEST_HANDLE(name) __DEFINE_GUEST_HANDLE(name, name)
  16. #define GUEST_HANDLE(name) __guest_handle_ ## name
  17. #define set_xen_guest_handle(hnd, val) \
  18. do { \
  19. if (sizeof(hnd) == 8) \
  20. *(uint64_t *)&(hnd) = 0; \
  21. (hnd).p = val; \
  22. } while (0)
  23. #ifndef __ASSEMBLY__
  24. /* Explicitly size integers that represent pfns in the interface with
  25. * Xen so that we can have one ABI that works for 32 and 64 bit guests.
  26. * Note that this means that the xen_pfn_t type may be capable of
  27. * representing pfn's which the guest cannot represent in its own pfn
  28. * type. However since pfn space is controlled by the guest this is
  29. * fine since it simply wouldn't be able to create any sure pfns in
  30. * the first place.
  31. */
  32. typedef uint64_t xen_pfn_t;
  33. #define PRI_xen_pfn "llx"
  34. typedef uint64_t xen_ulong_t;
  35. #define PRI_xen_ulong "llx"
  36. /* Guest handles for primitive C types. */
  37. __DEFINE_GUEST_HANDLE(uchar, unsigned char);
  38. __DEFINE_GUEST_HANDLE(uint, unsigned int);
  39. DEFINE_GUEST_HANDLE(char);
  40. DEFINE_GUEST_HANDLE(int);
  41. DEFINE_GUEST_HANDLE(void);
  42. DEFINE_GUEST_HANDLE(uint64_t);
  43. DEFINE_GUEST_HANDLE(uint32_t);
  44. DEFINE_GUEST_HANDLE(xen_pfn_t);
  45. /* Maximum number of virtual CPUs in multi-processor guests. */
  46. #define MAX_VIRT_CPUS 1
  47. struct arch_vcpu_info { };
  48. struct arch_shared_info { };
  49. /* TODO: Move pvclock definitions some place arch independent */
  50. struct pvclock_vcpu_time_info {
  51. u32 version;
  52. u32 pad0;
  53. u64 tsc_timestamp;
  54. u64 system_time;
  55. u32 tsc_to_system_mul;
  56. s8 tsc_shift;
  57. u8 flags;
  58. u8 pad[2];
  59. } __attribute__((__packed__)); /* 32 bytes */
  60. /* It is OK to have a 12 bytes struct with no padding because it is packed */
  61. struct pvclock_wall_clock {
  62. u32 version;
  63. u32 sec;
  64. u32 nsec;
  65. } __attribute__((__packed__));
  66. #endif
  67. #endif /* _ASM_ARM_XEN_INTERFACE_H */