]> rtime.felk.cvut.cz Git - jailhouse.git/blob - hypervisor/arch/arm/include/asm/jailhouse_hypercall.h
core: Rename arch-specific hypercall headers
[jailhouse.git] / hypervisor / arch / arm / include / asm / jailhouse_hypercall.h
1 /*
2  * Jailhouse, a Linux-based partitioning hypervisor
3  *
4  * Copyright (c) Siemens AG, 2013
5  *
6  * Authors:
7  *  Jan Kiszka <jan.kiszka@siemens.com>
8  *
9  * This work is licensed under the terms of the GNU GPL, version 2.  See
10  * the COPYING file in the top-level directory.
11  */
12
13 #define JAILHOUSE_CALL_INS              ".arch_extension virt\n\t" \
14                                         "hvc #0x4a48"
15 #define JAILHOUSE_CALL_NUM_RESULT       "r0"
16 #define JAILHOUSE_CALL_ARG1             "r1"
17 #define JAILHOUSE_CALL_ARG2             "r2"
18 #define JAILHOUSE_CALL_ARG3             "r3"
19 #define JAILHOUSE_CALL_ARG4             "r4"
20
21 static inline __u32 jailhouse_call0(__u32 num)
22 {
23         register __u32 num_result asm(JAILHOUSE_CALL_NUM_RESULT) = num;
24
25         asm volatile(
26                 __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%0")
27                 __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%1")
28                 JAILHOUSE_CALL_INS
29                 : "=r" (num_result)
30                 : "r" (num_result)
31                 : "memory");
32         return num_result;
33 }
34
35 static inline __u32 jailhouse_call1(__u32 num, __u32 arg1)
36 {
37         register __u32 num_result asm(JAILHOUSE_CALL_NUM_RESULT) = num;
38         register __u32 __arg1 asm(JAILHOUSE_CALL_ARG1) = arg1;
39
40         asm volatile(
41                 __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%0")
42                 __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%1")
43                 __asmeq(JAILHOUSE_CALL_ARG1, "%2")
44                 JAILHOUSE_CALL_INS
45                 : "=r" (num_result)
46                 : "r" (num_result), "r" (__arg1)
47                 : "memory");
48         return num_result;
49 }
50
51 static inline __u32 jailhouse_call2(__u32 num, __u32 arg1, __u32 arg2)
52 {
53         register __u32 num_result asm(JAILHOUSE_CALL_NUM_RESULT) = num;
54         register __u32 __arg1 asm(JAILHOUSE_CALL_ARG1) = arg1;
55         register __u32 __arg2 asm(JAILHOUSE_CALL_ARG2) = arg2;
56
57         asm volatile(
58                 __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%0")
59                 __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%1")
60                 __asmeq(JAILHOUSE_CALL_ARG1, "%2")
61                 __asmeq(JAILHOUSE_CALL_ARG2, "%3")
62                 JAILHOUSE_CALL_INS
63                 : "=r" (num_result)
64                 : "r" (num_result), "r" (__arg1), "r" (__arg2)
65                 : "memory");
66         return num_result;
67 }
68
69 static inline __u32 jailhouse_call3(__u32 num, __u32 arg1, __u32 arg2,
70                                    __u32 arg3)
71 {
72         register __u32 num_result asm(JAILHOUSE_CALL_NUM_RESULT) = num;
73         register __u32 __arg1 asm(JAILHOUSE_CALL_ARG1) = arg1;
74         register __u32 __arg2 asm(JAILHOUSE_CALL_ARG2) = arg2;
75         register __u32 __arg3 asm(JAILHOUSE_CALL_ARG3) = arg3;
76
77         asm volatile(
78                 __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%0")
79                 __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%1")
80                 __asmeq(JAILHOUSE_CALL_ARG1, "%2")
81                 __asmeq(JAILHOUSE_CALL_ARG2, "%3")
82                 __asmeq(JAILHOUSE_CALL_ARG3, "%4")
83                 JAILHOUSE_CALL_INS
84                 : "=r" (num_result)
85                 : "r" (num_result), "r" (__arg1), "r" (__arg2), "r" (__arg3)
86                 : "memory");
87         return num_result;
88 }
89
90 static inline __u32 jailhouse_call4(__u32 num, __u32 arg1, __u32 arg2,
91                                    __u32 arg3, __u32 arg4)
92 {
93         register __u32 num_result asm(JAILHOUSE_CALL_NUM_RESULT) = num;
94         register __u32 __arg1 asm(JAILHOUSE_CALL_ARG1) = arg1;
95         register __u32 __arg2 asm(JAILHOUSE_CALL_ARG2) = arg2;
96         register __u32 __arg3 asm(JAILHOUSE_CALL_ARG3) = arg3;
97         register __u32 __arg4 asm(JAILHOUSE_CALL_ARG4) = arg4;
98
99         asm volatile(
100                 __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%0")
101                 __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%1")
102                 __asmeq(JAILHOUSE_CALL_ARG1, "%2")
103                 __asmeq(JAILHOUSE_CALL_ARG2, "%3")
104                 __asmeq(JAILHOUSE_CALL_ARG3, "%4")
105                 __asmeq(JAILHOUSE_CALL_ARG4, "%5")
106                 JAILHOUSE_CALL_INS
107                 : "=r" (num_result)
108                 : "r" (num_result), "r" (__arg1), "r" (__arg2), "r" (__arg3),
109                   "r" (__arg4)
110                 : "memory");
111         return num_result;
112 }