blob: e69ed408dc659de4142fa0519637d5c49a87e944 [file] [log] [blame]
Andrii Anisov355d1e42020-08-06 12:42:47 +03001/* SPDX-License-Identifier: GPL-2.0
2 *
3 * hypercall.S
4 *
5 * Xen hypercall wrappers
6 *
7 * Stefano Stabellini <stefano.stabellini@eu.citrix.com>, Citrix, 2012
8 *
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:
14 *
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:
21 *
22 * The above copyright notice and this permission notice shall be included in
23 * all copies or substantial portions of the Software.
24 *
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
31 * IN THE SOFTWARE.
32 */
33
34/*
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
38 * the fifth in x4.
39 *
40 * The hypercall number is passed in x16.
41 *
42 * The return value is in x0.
43 *
44 * The hvc ISS is required to be 0xEA1, that is the Xen specific ARM
45 * hypercall tag.
46 *
47 * Parameter structs passed to hypercalls are laid out according to
48 * the ARM 64-bit EABI standard.
49 */
50
51#include <xen/interface/xen.h>
52
53#define XEN_HYPERCALL_TAG 0xEA1
54
55#define HYPERCALL_SIMPLE(hypercall) \
56.globl HYPERVISOR_##hypercall; \
57.align 4,0x90; \
58HYPERVISOR_##hypercall: \
59 mov x16, #__HYPERVISOR_##hypercall; \
60 hvc XEN_HYPERCALL_TAG; \
61 ret; \
62
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
69
70 .text
71
72HYPERCALL2(xen_version);
73HYPERCALL3(console_io);
74HYPERCALL3(grant_table_op);
75HYPERCALL2(sched_op);
76HYPERCALL2(event_channel_op);
77HYPERCALL2(hvm_op);
78HYPERCALL2(memory_op);