source: mainline/kernel/arch/xen32/include/hypercall.h@ 0fbfa0d

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 0fbfa0d was e12ccc5, checked in by Martin Decky <martin@…>, 19 years ago

xen32: use writable page tables, cleanup mm

  • Property mode set to 100644
File size: 5.0 KB
Line 
1/*
2 * Copyright (C) 2006 Martin Decky
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#ifndef __xen32_HYPERCALL_H__
30#define __xen32_HYPERCALL_H__
31
32#include <arch/types.h>
33#include <macros.h>
34
35
36typedef uint16_t domid_t;
37
38
39#define XEN_MMU_UPDATE 1
40#define XEN_UPDATE_VA_MAPPING 14
41#define XEN_CONSOLE_IO 18
42#define XEN_VM_ASSIST 21
43#define XEN_MMUEXT_OP 26
44
45
46/*
47 * Commands for XEN_CONSOLE_IO
48 */
49#define CONSOLE_IO_WRITE 0
50#define CONSOLE_IO_READ 1
51
52
53#define MMUEXT_PIN_L1_TABLE 0
54#define MMUEXT_PIN_L2_TABLE 1
55#define MMUEXT_PIN_L3_TABLE 2
56#define MMUEXT_PIN_L4_TABLE 3
57#define MMUEXT_UNPIN_TABLE 4
58#define MMUEXT_NEW_BASEPTR 5
59#define MMUEXT_TLB_FLUSH_LOCAL 6
60#define MMUEXT_INVLPG_LOCAL 7
61#define MMUEXT_TLB_FLUSH_MULTI 8
62#define MMUEXT_INVLPG_MULTI 9
63#define MMUEXT_TLB_FLUSH_ALL 10
64#define MMUEXT_INVLPG_ALL 11
65#define MMUEXT_FLUSH_CACHE 12
66#define MMUEXT_SET_LDT 13
67#define MMUEXT_NEW_USER_BASEPTR 15
68
69
70#define UVMF_NONE 0 /**< No flushing at all */
71#define UVMF_TLB_FLUSH 1 /**< Flush entire TLB(s) */
72#define UVMF_INVLPG 2 /**< Flush only one entry */
73#define UVMF_FLUSHTYPE_MASK 3
74#define UVMF_MULTI 0 /**< Flush subset of TLBs */
75#define UVMF_LOCAL 0 /**< Flush local TLB */
76#define UVMF_ALL (1 << 2) /**< Flush all TLBs */
77
78
79/*
80 * Commands to XEN_VM_ASSIST
81 */
82#define VMASST_CMD_ENABLE 0
83#define VMASST_CMD_DISABLE 1
84#define VMASST_TYPE_4GB_SEGMENTS 0
85#define VMASST_TYPE_4GB_SEGMENTS_NOTIFY 1
86#define VMASST_TYPE_WRITABLE_PAGETABLES 2
87
88
89#define DOMID_SELF (0x7FF0U)
90#define DOMID_IO (0x7FF1U)
91
92
93#define hypercall0(id) \
94 ({ \
95 unative_t ret; \
96 asm volatile ( \
97 "call hypercall_page + (" STRING(id) " * 32)\n" \
98 : "=a" (ret) \
99 : \
100 : "memory" \
101 ); \
102 ret; \
103 })
104
105#define hypercall1(id, p1) \
106 ({ \
107 unative_t ret, __ign1; \
108 asm volatile ( \
109 "call hypercall_page + (" STRING(id) " * 32)\n" \
110 : "=a" (ret), \
111 "=b" (__ign1) \
112 : "1" (p1) \
113 : "memory" \
114 ); \
115 ret; \
116 })
117
118#define hypercall2(id, p1, p2) \
119 ({ \
120 unative_t ret, __ign1, __ign2; \
121 asm volatile ( \
122 "call hypercall_page + (" STRING(id) " * 32)\n" \
123 : "=a" (ret), \
124 "=b" (__ign1), \
125 "=c" (__ign2) \
126 : "1" (p1), \
127 "2" (p2) \
128 : "memory" \
129 ); \
130 ret; \
131 })
132
133#define hypercall3(id, p1, p2, p3) \
134 ({ \
135 unative_t ret, __ign1, __ign2, __ign3; \
136 asm volatile ( \
137 "call hypercall_page + (" STRING(id) " * 32)\n" \
138 : "=a" (ret), \
139 "=b" (__ign1), \
140 "=c" (__ign2), \
141 "=d" (__ign3) \
142 : "1" (p1), \
143 "2" (p2), \
144 "3" (p3) \
145 : "memory" \
146 ); \
147 ret; \
148 })
149
150#define hypercall4(id, p1, p2, p3, p4) \
151 ({ \
152 unative_t ret, __ign1, __ign2, __ign3, __ign4; \
153 asm volatile ( \
154 "call hypercall_page + (" STRING(id) " * 32)\n" \
155 : "=a" (ret), \
156 "=b" (__ign1), \
157 "=c" (__ign2), \
158 "=d" (__ign3), \
159 "=S" (__ign4) \
160 : "1" (p1), \
161 "2" (p2), \
162 "3" (p3), \
163 "4" (p4) \
164 : "memory" \
165 ); \
166 ret; \
167 })
168
169#define hypercall5(id, p1, p2, p3, p4, p5) \
170 ({ \
171 unative_t ret, __ign1, __ign2, __ign3, __ign4, __ign5; \
172 asm volatile ( \
173 "call hypercall_page + (" STRING(id) " * 32)\n" \
174 : "=a" (ret), \
175 "=b" (__ign1), \
176 "=c" (__ign2), \
177 "=d" (__ign3), \
178 "=S" (__ign4), \
179 "=D" (__ign5) \
180 : "1" (p1), \
181 "2" (p2), \
182 "3" (p3), \
183 "4" (p4), \
184 "5" (p5) \
185 : "memory" \
186 ); \
187 ret; \
188 })
189
190
191static inline int xen_console_io(const unsigned int cmd, const unsigned int count, const char *str)
192{
193 return hypercall3(XEN_CONSOLE_IO, cmd, count, str);
194}
195
196static inline int xen_vm_assist(const unsigned int cmd, const unsigned int type)
197{
198 return hypercall2(XEN_VM_ASSIST, cmd, type);
199}
200
201#endif
Note: See TracBrowser for help on using the repository browser.