interface.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 __DEFINE_GUEST_HANDLE(name, type) \
  10. typedef type * __guest_handle_ ## name
  11. #define DEFINE_GUEST_HANDLE_STRUCT(name) \
  12. __DEFINE_GUEST_HANDLE(name, struct name)
  13. #define DEFINE_GUEST_HANDLE(name) __DEFINE_GUEST_HANDLE(name, name)
  14. #define GUEST_HANDLE(name) __guest_handle_ ## name
  15. #define set_xen_guest_handle(hnd, val) \
  16. do { \
  17. if (sizeof(hnd) == 8) \
  18. *(uint64_t *)&(hnd) = 0; \
  19. (hnd) = val; \
  20. } while (0)
  21. #ifndef __ASSEMBLY__
  22. /* Explicitly size integers that represent pfns in the interface with
  23. * Xen so that we can have one ABI that works for 32 and 64 bit guests. */
  24. typedef uint64_t xen_pfn_t;
  25. /* Guest handles for primitive C types. */
  26. __DEFINE_GUEST_HANDLE(uchar, unsigned char);
  27. __DEFINE_GUEST_HANDLE(uint, unsigned int);
  28. __DEFINE_GUEST_HANDLE(ulong, unsigned long);
  29. DEFINE_GUEST_HANDLE(char);
  30. DEFINE_GUEST_HANDLE(int);
  31. DEFINE_GUEST_HANDLE(long);
  32. DEFINE_GUEST_HANDLE(void);
  33. DEFINE_GUEST_HANDLE(uint64_t);
  34. DEFINE_GUEST_HANDLE(uint32_t);
  35. DEFINE_GUEST_HANDLE(xen_pfn_t);
  36. /* Maximum number of virtual CPUs in multi-processor guests. */
  37. #define MAX_VIRT_CPUS 1
  38. struct arch_vcpu_info { };
  39. struct arch_shared_info { };
  40. /* TODO: Move pvclock definitions some place arch independent */
  41. struct pvclock_vcpu_time_info {
  42. u32 version;
  43. u32 pad0;
  44. u64 tsc_timestamp;
  45. u64 system_time;
  46. u32 tsc_to_system_mul;
  47. s8 tsc_shift;
  48. u8 flags;
  49. u8 pad[2];
  50. } __attribute__((__packed__)); /* 32 bytes */
  51. /* It is OK to have a 12 bytes struct with no padding because it is packed */
  52. struct pvclock_wall_clock {
  53. u32 version;
  54. u32 sec;
  55. u32 nsec;
  56. } __attribute__((__packed__));
  57. #endif
  58. #endif /* _ASM_ARM_XEN_INTERFACE_H */