interface.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. typedef uint64_t xen_pfn_t;
  27. #define PRI_xen_pfn "llx"
  28. typedef uint64_t xen_ulong_t;
  29. #define PRI_xen_ulong "llx"
  30. /* Guest handles for primitive C types. */
  31. __DEFINE_GUEST_HANDLE(uchar, unsigned char);
  32. __DEFINE_GUEST_HANDLE(uint, unsigned int);
  33. __DEFINE_GUEST_HANDLE(ulong, unsigned long);
  34. DEFINE_GUEST_HANDLE(char);
  35. DEFINE_GUEST_HANDLE(int);
  36. DEFINE_GUEST_HANDLE(long);
  37. DEFINE_GUEST_HANDLE(void);
  38. DEFINE_GUEST_HANDLE(uint64_t);
  39. DEFINE_GUEST_HANDLE(uint32_t);
  40. DEFINE_GUEST_HANDLE(xen_pfn_t);
  41. /* Maximum number of virtual CPUs in multi-processor guests. */
  42. #define MAX_VIRT_CPUS 1
  43. struct arch_vcpu_info { };
  44. struct arch_shared_info { };
  45. /* TODO: Move pvclock definitions some place arch independent */
  46. struct pvclock_vcpu_time_info {
  47. u32 version;
  48. u32 pad0;
  49. u64 tsc_timestamp;
  50. u64 system_time;
  51. u32 tsc_to_system_mul;
  52. s8 tsc_shift;
  53. u8 flags;
  54. u8 pad[2];
  55. } __attribute__((__packed__)); /* 32 bytes */
  56. /* It is OK to have a 12 bytes struct with no padding because it is packed */
  57. struct pvclock_wall_clock {
  58. u32 version;
  59. u32 sec;
  60. u32 nsec;
  61. } __attribute__((__packed__));
  62. #endif
  63. #endif /* _ASM_ARM_XEN_INTERFACE_H */