blob: f00f8407db2e20fbdc10e9cf9e6788eedcfabad4 [file] [log] [blame]
Ian Campbell74c78782011-06-01 11:00:29 +01001#ifndef __XEN_H
2#define __XEN_H
3
Kevin O'Connord83c87b2013-01-21 01:14:12 -05004void xen_preinit(void);
5void xen_ramsize_preinit(void);
6void xen_hypercall_setup(void);
7void xen_biostable_setup(void);
Ian Campbell74c78782011-06-01 11:00:29 +01008
Kevin O'Connorb7d9abf2012-06-21 20:54:22 -04009extern unsigned long xen_hypercall_page;
Ian Campbell74c78782011-06-01 11:00:29 +010010
11#define _hypercall0(type, name) \
12({ \
13 unsigned long __hentry = xen_hypercall_page+__HYPERVISOR_##name*32; \
14 long __res; \
15 asm volatile ( \
16 "call *%%eax" \
17 : "=a" (__res) \
18 : "0" (__hentry) \
19 : "memory" ); \
20 (type)__res; \
21})
22
23#define _hypercall1(type, name, a1) \
24({ \
25 unsigned long __hentry = xen_hypercall_page+__HYPERVISOR_##name*32; \
26 long __res, __ign1; \
27 asm volatile ( \
28 "call *%%eax" \
29 : "=a" (__res), "=b" (__ign1) \
30 : "0" (__hentry), "1" ((long)(a1)) \
31 : "memory" ); \
32 (type)__res; \
33})
34
35#define _hypercall2(type, name, a1, a2) \
36({ \
37 unsigned long __hentry = xen_hypercall_page+__HYPERVISOR_##name*32; \
38 long __res, __ign1, __ign2; \
39 asm volatile ( \
40 "call *%%eax" \
41 : "=a" (__res), "=b" (__ign1), "=c" (__ign2) \
42 : "0" (__hentry), "1" ((long)(a1)), "2" ((long)(a2)) \
43 : "memory" ); \
44 (type)__res; \
45})
46
47#define _hypercall3(type, name, a1, a2, a3) \
48({ \
49 unsigned long __hentry = xen_hypercall_page+__HYPERVISOR_##name*32; \
50 long __res, __ign1, __ign2, __ign3; \
51 asm volatile ( \
52 "call *%%eax" \
53 : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \
54 "=d" (__ign3) \
55 : "0" (__hentry), "1" ((long)(a1)), "2" ((long)(a2)), \
56 "3" ((long)(a3)) \
57 : "memory" ); \
58 (type)__res; \
59})
60
61#define _hypercall4(type, name, a1, a2, a3, a4) \
62({ \
63 unsigned long __hentry = xen_hypercall_page+__HYPERVISOR_##name*32; \
64 long __res, __ign1, __ign2, __ign3, __ign4; \
65 asm volatile ( \
66 "call *%%eax" \
67 : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \
68 "=d" (__ign3), "=S" (__ign4) \
69 : "0" (__hentry), "1" ((long)(a1)), "2" ((long)(a2)), \
70 "3" ((long)(a3)), "4" ((long)(a4)) \
71 : "memory" ); \
72 (type)__res; \
73})
74
75#define _hypercall5(type, name, a1, a2, a3, a4, a5) \
76({ \
77 unsigned long __hentry = xen_hypercall_page+__HYPERVISOR_##name*32; \
78 long __res, __ign1, __ign2, __ign3, __ign4, __ign5; \
79 asm volatile ( \
80 "call *%%eax" \
81 : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \
82 "=d" (__ign3), "=S" (__ign4), "=D" (__ign5) \
83 : "0" (__hentry), "1" ((long)(a1)), "2" ((long)(a2)), \
84 "3" ((long)(a3)), "4" ((long)(a4)), \
85 "5" ((long)(a5)) \
86 : "memory" ); \
87 (type)__res; \
88})
89
90/******************************************************************************
91 *
92 * The following interface definitions are taken from Xen and have the
93 * following license:
94 *
95 * Permission is hereby granted, free of charge, to any person obtaining a copy
96 * of this software and associated documentation files (the "Software"), to
97 * deal in the Software without restriction, including without limitation the
98 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
99 * sell copies of the Software, and to permit persons to whom the Software is
100 * furnished to do so, subject to the following conditions:
101 *
102 * The above copyright notice and this permission notice shall be included in
103 * all copies or substantial portions of the Software.
104 *
105 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
106 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
107 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
108 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
109 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
110 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
111 * DEALINGS IN THE SOFTWARE.
112 */
113
114/* xen.h */
115
116#define __HYPERVISOR_xen_version 17
117
118/* version.h */
119
120/* arg == xen_extraversion_t. */
121#define XENVER_extraversion 1
122typedef char xen_extraversion_t[16];
123#define XEN_EXTRAVERSION_LEN (sizeof(xen_extraversion_t))
124
125#endif