interface.h 2.1 KB

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