1 /* SPDX-License-Identifier: GPL-2.0
5 * Xen hypercall wrappers
7 * Stefano Stabellini <stefano.stabellini@eu.citrix.com>, Citrix, 2012
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version 2
11 * as published by the Free Software Foundation; or, when distributed
12 * separately from the Linux kernel or incorporated into other
13 * software packages, subject to the following license:
15 * Permission is hereby granted, free of charge, to any person obtaining a copy
16 * of this source file (the "Software"), to deal in the Software without
17 * restriction, including without limitation the rights to use, copy, modify,
18 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
19 * and to permit persons to whom the Software is furnished to do so, subject to
20 * the following conditions:
22 * The above copyright notice and this permission notice shall be included in
23 * all copies or substantial portions of the Software.
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
30 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
35 * The Xen hypercall calling convention is very similar to the procedure
36 * call standard for the ARM 64-bit architecture: the first parameter is
37 * passed in x0, the second in x1, the third in x2, the fourth in x3 and
40 * The hypercall number is passed in x16.
42 * The return value is in x0.
44 * The hvc ISS is required to be 0xEA1, that is the Xen specific ARM
47 * Parameter structs passed to hypercalls are laid out according to
48 * the ARM 64-bit EABI standard.
51 #include <xen/interface/xen.h>
53 #define XEN_HYPERCALL_TAG 0xEA1
55 #define HYPERCALL_SIMPLE(hypercall) \
56 .globl HYPERVISOR_##hypercall; \
58 HYPERVISOR_##hypercall: \
59 mov x16, #__HYPERVISOR_##hypercall; \
60 hvc XEN_HYPERCALL_TAG; \
63 #define HYPERCALL0 HYPERCALL_SIMPLE
64 #define HYPERCALL1 HYPERCALL_SIMPLE
65 #define HYPERCALL2 HYPERCALL_SIMPLE
66 #define HYPERCALL3 HYPERCALL_SIMPLE
67 #define HYPERCALL4 HYPERCALL_SIMPLE
68 #define HYPERCALL5 HYPERCALL_SIMPLE
72 HYPERCALL2(xen_version);
73 HYPERCALL3(console_io);
74 HYPERCALL3(grant_table_op);
76 HYPERCALL2(event_channel_op);
78 HYPERCALL2(memory_op);