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