1
/******************************************************************************
4
* Copyright (c) 2002-2006, K A Fraser
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License version 2
8
* as published by the Free Software Foundation; or, when distributed
9
* separately from the Linux kernel or incorporated into other
10
* software packages, subject to the following license:
12
* Permission is hereby granted, free of charge, to any person obtaining a copy
13
* of this source file (the "Software"), to deal in the Software without
14
* restriction, including without limitation the rights to use, copy, modify,
15
* merge, publish, distribute, sublicense, and/or sell copies of the Software,
16
* and to permit persons to whom the Software is furnished to do so, subject to
17
* the following conditions:
19
* The above copyright notice and this permission notice shall be included in
20
* all copies or substantial portions of the Software.
22
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
31
#ifndef __HVMLOADER_HYPERCALL_H__
32
#define __HVMLOADER_HYPERCALL_H__
39
* NB. Hypercall address needs to be relative to a linkage symbol for
40
* some version of ld to relocate the relative calls properly.
42
#define hypercall_pa "_start - " STR(HYPERCALL_PHYSICAL_ADDRESS)
44
#define _hypercall0(type, name) \
48
"call "hypercall_pa" + " STR(__HYPERVISOR_##name * 32) \
55
#define _hypercall1(type, name, a1) \
59
"call "hypercall_pa" + " STR(__HYPERVISOR_##name * 32) \
60
: "=a" (__res), "=b" (__ign1) \
66
#define _hypercall2(type, name, a1, a2) \
68
long __res, __ign1, __ign2; \
70
"call "hypercall_pa" + " STR(__HYPERVISOR_##name * 32) \
71
: "=a" (__res), "=b" (__ign1), "=c" (__ign2) \
72
: "1" ((long)(a1)), "2" ((long)(a2)) \
77
#define _hypercall3(type, name, a1, a2, a3) \
79
long __res, __ign1, __ign2, __ign3; \
81
"call "hypercall_pa" + " STR(__HYPERVISOR_##name * 32) \
82
: "=a" (__res), "=b" (__ign1), "=c" (__ign2), \
84
: "1" ((long)(a1)), "2" ((long)(a2)), \
90
#define _hypercall4(type, name, a1, a2, a3, a4) \
92
long __res, __ign1, __ign2, __ign3, __ign4; \
94
"call "hypercall_pa" + " STR(__HYPERVISOR_##name * 32) \
95
: "=a" (__res), "=b" (__ign1), "=c" (__ign2), \
96
"=d" (__ign3), "=S" (__ign4) \
97
: "1" ((long)(a1)), "2" ((long)(a2)), \
98
"3" ((long)(a3)), "4" ((long)(a4)) \
103
#define _hypercall5(type, name, a1, a2, a3, a4, a5) \
105
long __res, __ign1, __ign2, __ign3, __ign4, __ign5; \
107
"call "hypercall_pa" + " STR(__HYPERVISOR_##name * 32) \
108
: "=a" (__res), "=b" (__ign1), "=c" (__ign2), \
109
"=d" (__ign3), "=S" (__ign4), "=D" (__ign5) \
110
: "1" ((long)(a1)), "2" ((long)(a2)), \
111
"3" ((long)(a3)), "4" ((long)(a4)), \
121
return _hypercall2(int, sched_op, cmd, arg);
126
unsigned int cmd, void *arg)
128
return _hypercall2(int, memory_op, cmd, arg);
133
void *call_list, int nr_calls)
135
return _hypercall2(int, multicall, call_list, nr_calls);
139
hypercall_event_channel_op(
142
return _hypercall2(int, event_channel_op, cmd, arg);
146
hypercall_xen_version(
149
return _hypercall2(int, xen_version, cmd, arg);
153
hypercall_console_io(
154
int cmd, int count, char *str)
156
return _hypercall3(int, console_io, cmd, count, str);
161
unsigned int cmd, unsigned int type)
163
return _hypercall2(int, vm_assist, cmd, type);
168
int cmd, int vcpuid, void *extra_args)
170
return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
177
return _hypercall2(int, hvm_op, cmd, arg);
180
#endif /* __HVMLOADER_HYPERCALL_H__ */