1*c24c993fSbouyer /* $NetBSD: hypercalls.h,v 1.2 2020/04/25 15:26:16 bouyer Exp $ */
2*c24c993fSbouyer /******************************************************************************
3*c24c993fSbouyer * hypercall.h
4*c24c993fSbouyer *
5*c24c993fSbouyer * Linux-specific hypervisor handling.
6*c24c993fSbouyer *
7*c24c993fSbouyer * Copyright (c) 2002-2004, K A Fraser
8*c24c993fSbouyer *
9*c24c993fSbouyer * 64-bit updates:
10*c24c993fSbouyer * Benjamin Liu <benjamin.liu@intel.com>
11*c24c993fSbouyer * Jun Nakajima <jun.nakajima@intel.com>
12*c24c993fSbouyer *
13*c24c993fSbouyer * This program is free software; you can redistribute it and/or
14*c24c993fSbouyer * modify it under the terms of the GNU General Public License version 2
15*c24c993fSbouyer * as published by the Free Software Foundation; or, when distributed
16*c24c993fSbouyer * separately from the Linux kernel or incorporated into other
17*c24c993fSbouyer * software packages, subject to the following license:
18*c24c993fSbouyer *
19*c24c993fSbouyer * Permission is hereby granted, free of charge, to any person obtaining a copy
20*c24c993fSbouyer * of this source file (the "Software"), to deal in the Software without
21*c24c993fSbouyer * restriction, including without limitation the rights to use, copy, modify,
22*c24c993fSbouyer * merge, publish, distribute, sublicense, and/or sell copies of the Software,
23*c24c993fSbouyer * and to permit persons to whom the Software is furnished to do so, subject to
24*c24c993fSbouyer * the following conditions:
25*c24c993fSbouyer *
26*c24c993fSbouyer * The above copyright notice and this permission notice shall be included in
27*c24c993fSbouyer * all copies or substantial portions of the Software.
28*c24c993fSbouyer *
29*c24c993fSbouyer * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30*c24c993fSbouyer * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31*c24c993fSbouyer * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32*c24c993fSbouyer * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33*c24c993fSbouyer * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
34*c24c993fSbouyer * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
35*c24c993fSbouyer * IN THE SOFTWARE.
36*c24c993fSbouyer */
37*c24c993fSbouyer
38*c24c993fSbouyer #ifndef __HYPERCALL_H__
39*c24c993fSbouyer #define __HYPERCALL_H__
40*c24c993fSbouyer
41*c24c993fSbouyer #define __STR(x) #x
42*c24c993fSbouyer #define STR(x) __STR(x)
43*c24c993fSbouyer
44*c24c993fSbouyer #define HYPERCALL_STR(name) \
45*c24c993fSbouyer "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"
46*c24c993fSbouyer
47*c24c993fSbouyer #define _hypercall0(type, name) \
48*c24c993fSbouyer ({ \
49*c24c993fSbouyer long __res; \
50*c24c993fSbouyer asm volatile ( \
51*c24c993fSbouyer HYPERCALL_STR(name) \
52*c24c993fSbouyer : "=a" (__res) \
53*c24c993fSbouyer : \
54*c24c993fSbouyer : "memory" ); \
55*c24c993fSbouyer (type)__res; \
56*c24c993fSbouyer })
57*c24c993fSbouyer
58*c24c993fSbouyer #define _hypercall1(type, name, a1) \
59*c24c993fSbouyer ({ \
60*c24c993fSbouyer long __res, __ign1; \
61*c24c993fSbouyer asm volatile ( \
62*c24c993fSbouyer HYPERCALL_STR(name) \
63*c24c993fSbouyer : "=a" (__res), "=D" (__ign1) \
64*c24c993fSbouyer : "1" ((long)(a1)) \
65*c24c993fSbouyer : "memory" ); \
66*c24c993fSbouyer (type)__res; \
67*c24c993fSbouyer })
68*c24c993fSbouyer
69*c24c993fSbouyer #define _hypercall2(type, name, a1, a2) \
70*c24c993fSbouyer ({ \
71*c24c993fSbouyer long __res, __ign1, __ign2; \
72*c24c993fSbouyer asm volatile ( \
73*c24c993fSbouyer HYPERCALL_STR(name) \
74*c24c993fSbouyer : "=a" (__res), "=D" (__ign1), "=S" (__ign2) \
75*c24c993fSbouyer : "1" ((long)(a1)), "2" ((long)(a2)) \
76*c24c993fSbouyer : "memory" ); \
77*c24c993fSbouyer (type)__res; \
78*c24c993fSbouyer })
79*c24c993fSbouyer
80*c24c993fSbouyer #define _hypercall3(type, name, a1, a2, a3) \
81*c24c993fSbouyer ({ \
82*c24c993fSbouyer long __res, __ign1, __ign2, __ign3; \
83*c24c993fSbouyer asm volatile ( \
84*c24c993fSbouyer HYPERCALL_STR(name) \
85*c24c993fSbouyer : "=a" (__res), "=D" (__ign1), "=S" (__ign2), \
86*c24c993fSbouyer "=d" (__ign3) \
87*c24c993fSbouyer : "1" ((long)(a1)), "2" ((long)(a2)), \
88*c24c993fSbouyer "3" ((long)(a3)) \
89*c24c993fSbouyer : "memory" ); \
90*c24c993fSbouyer (type)__res; \
91*c24c993fSbouyer })
92*c24c993fSbouyer
93*c24c993fSbouyer #define _hypercall4(type, name, a1, a2, a3, a4) \
94*c24c993fSbouyer ({ \
95*c24c993fSbouyer long __res, __ign1, __ign2, __ign3; \
96*c24c993fSbouyer asm volatile ( \
97*c24c993fSbouyer "movq %7,%%r10; " \
98*c24c993fSbouyer HYPERCALL_STR(name) \
99*c24c993fSbouyer : "=a" (__res), "=D" (__ign1), "=S" (__ign2), \
100*c24c993fSbouyer "=d" (__ign3) \
101*c24c993fSbouyer : "1" ((long)(a1)), "2" ((long)(a2)), \
102*c24c993fSbouyer "3" ((long)(a3)), "g" ((long)(a4)) \
103*c24c993fSbouyer : "memory", "r10" ); \
104*c24c993fSbouyer (type)__res; \
105*c24c993fSbouyer })
106*c24c993fSbouyer
107*c24c993fSbouyer #define _hypercall5(type, name, a1, a2, a3, a4, a5) \
108*c24c993fSbouyer ({ \
109*c24c993fSbouyer long __res, __ign1, __ign2, __ign3; \
110*c24c993fSbouyer asm volatile ( \
111*c24c993fSbouyer "movq %7,%%r10; movq %8,%%r8; " \
112*c24c993fSbouyer HYPERCALL_STR(name) \
113*c24c993fSbouyer : "=a" (__res), "=D" (__ign1), "=S" (__ign2), \
114*c24c993fSbouyer "=d" (__ign3) \
115*c24c993fSbouyer : "1" ((long)(a1)), "2" ((long)(a2)), \
116*c24c993fSbouyer "3" ((long)(a3)), "g" ((long)(a4)), \
117*c24c993fSbouyer "g" ((long)(a5)) \
118*c24c993fSbouyer : "memory", "r10", "r8" ); \
119*c24c993fSbouyer (type)__res; \
120*c24c993fSbouyer })
121*c24c993fSbouyer
122*c24c993fSbouyer static inline int
HYPERVISOR_set_trap_table(trap_info_t * table)123*c24c993fSbouyer HYPERVISOR_set_trap_table(
124*c24c993fSbouyer trap_info_t *table)
125*c24c993fSbouyer {
126*c24c993fSbouyer return _hypercall1(int, set_trap_table, table);
127*c24c993fSbouyer }
128*c24c993fSbouyer
129*c24c993fSbouyer static inline int
HYPERVISOR_mmu_update(mmu_update_t * req,int count,int * success_count,domid_t domid)130*c24c993fSbouyer HYPERVISOR_mmu_update(
131*c24c993fSbouyer mmu_update_t *req, int count, int *success_count, domid_t domid)
132*c24c993fSbouyer {
133*c24c993fSbouyer return _hypercall4(int, mmu_update, req, count, success_count, domid);
134*c24c993fSbouyer }
135*c24c993fSbouyer
136*c24c993fSbouyer static inline int
HYPERVISOR_mmuext_op(struct mmuext_op * op,int count,int * success_count,domid_t domid)137*c24c993fSbouyer HYPERVISOR_mmuext_op(
138*c24c993fSbouyer struct mmuext_op *op, int count, int *success_count, domid_t domid)
139*c24c993fSbouyer {
140*c24c993fSbouyer return _hypercall4(int, mmuext_op, op, count, success_count, domid);
141*c24c993fSbouyer }
142*c24c993fSbouyer
143*c24c993fSbouyer static inline int
HYPERVISOR_set_gdt(unsigned long * frame_list,int entries)144*c24c993fSbouyer HYPERVISOR_set_gdt(
145*c24c993fSbouyer unsigned long *frame_list, int entries)
146*c24c993fSbouyer {
147*c24c993fSbouyer return _hypercall2(int, set_gdt, frame_list, entries);
148*c24c993fSbouyer }
149*c24c993fSbouyer
150*c24c993fSbouyer static inline int
HYPERVISOR_stack_switch(unsigned long ss,unsigned long esp)151*c24c993fSbouyer HYPERVISOR_stack_switch(
152*c24c993fSbouyer unsigned long ss, unsigned long esp)
153*c24c993fSbouyer {
154*c24c993fSbouyer return _hypercall2(int, stack_switch, ss, esp);
155*c24c993fSbouyer }
156*c24c993fSbouyer
157*c24c993fSbouyer static inline int
HYPERVISOR_set_callbacks(unsigned long event_address,unsigned long failsafe_address,unsigned long syscall_address)158*c24c993fSbouyer HYPERVISOR_set_callbacks(
159*c24c993fSbouyer unsigned long event_address, unsigned long failsafe_address,
160*c24c993fSbouyer unsigned long syscall_address)
161*c24c993fSbouyer {
162*c24c993fSbouyer return _hypercall3(int, set_callbacks,
163*c24c993fSbouyer event_address, failsafe_address, syscall_address);
164*c24c993fSbouyer }
165*c24c993fSbouyer
166*c24c993fSbouyer static inline int
HYPERVISOR_fpu_taskswitch(int set)167*c24c993fSbouyer HYPERVISOR_fpu_taskswitch(
168*c24c993fSbouyer int set)
169*c24c993fSbouyer {
170*c24c993fSbouyer return _hypercall1(int, fpu_taskswitch, set);
171*c24c993fSbouyer }
172*c24c993fSbouyer
173*c24c993fSbouyer static inline int
HYPERVISOR_sched_op_compat(int cmd,unsigned long arg)174*c24c993fSbouyer HYPERVISOR_sched_op_compat(
175*c24c993fSbouyer int cmd, unsigned long arg)
176*c24c993fSbouyer {
177*c24c993fSbouyer return _hypercall2(int, sched_op_compat, cmd, arg);
178*c24c993fSbouyer }
179*c24c993fSbouyer
180*c24c993fSbouyer static inline int
HYPERVISOR_sched_op(int cmd,void * arg)181*c24c993fSbouyer HYPERVISOR_sched_op(
182*c24c993fSbouyer int cmd, void *arg)
183*c24c993fSbouyer {
184*c24c993fSbouyer return _hypercall2(int, sched_op, cmd, arg);
185*c24c993fSbouyer }
186*c24c993fSbouyer
187*c24c993fSbouyer static inline long
HYPERVISOR_set_timer_op(u64 timeout)188*c24c993fSbouyer HYPERVISOR_set_timer_op(
189*c24c993fSbouyer u64 timeout)
190*c24c993fSbouyer {
191*c24c993fSbouyer return _hypercall1(long, set_timer_op, timeout);
192*c24c993fSbouyer }
193*c24c993fSbouyer
194*c24c993fSbouyer static inline int
HYPERVISOR_platform_op(struct xen_platform_op * platform_op)195*c24c993fSbouyer HYPERVISOR_platform_op(
196*c24c993fSbouyer struct xen_platform_op *platform_op)
197*c24c993fSbouyer {
198*c24c993fSbouyer platform_op->interface_version = XENPF_INTERFACE_VERSION;
199*c24c993fSbouyer return _hypercall1(int, platform_op, platform_op);
200*c24c993fSbouyer }
201*c24c993fSbouyer
202*c24c993fSbouyer static inline int
HYPERVISOR_set_debugreg(int reg,unsigned long value)203*c24c993fSbouyer HYPERVISOR_set_debugreg(
204*c24c993fSbouyer int reg, unsigned long value)
205*c24c993fSbouyer {
206*c24c993fSbouyer return _hypercall2(int, set_debugreg, reg, value);
207*c24c993fSbouyer }
208*c24c993fSbouyer
209*c24c993fSbouyer static inline unsigned long
HYPERVISOR_get_debugreg(int reg)210*c24c993fSbouyer HYPERVISOR_get_debugreg(
211*c24c993fSbouyer int reg)
212*c24c993fSbouyer {
213*c24c993fSbouyer return _hypercall1(unsigned long, get_debugreg, reg);
214*c24c993fSbouyer }
215*c24c993fSbouyer
216*c24c993fSbouyer static inline int
HYPERVISOR_update_descriptor(unsigned long ma,unsigned long word)217*c24c993fSbouyer HYPERVISOR_update_descriptor(
218*c24c993fSbouyer unsigned long ma, unsigned long word)
219*c24c993fSbouyer {
220*c24c993fSbouyer return _hypercall2(int, update_descriptor, ma, word);
221*c24c993fSbouyer }
222*c24c993fSbouyer
223*c24c993fSbouyer static inline int
HYPERVISOR_memory_op(unsigned int cmd,void * arg)224*c24c993fSbouyer HYPERVISOR_memory_op(
225*c24c993fSbouyer unsigned int cmd, void *arg)
226*c24c993fSbouyer {
227*c24c993fSbouyer return _hypercall2(int, memory_op, cmd, arg);
228*c24c993fSbouyer }
229*c24c993fSbouyer
230*c24c993fSbouyer static inline int
HYPERVISOR_multicall(multicall_entry_t * call_list,int nr_calls)231*c24c993fSbouyer HYPERVISOR_multicall(
232*c24c993fSbouyer multicall_entry_t *call_list, int nr_calls)
233*c24c993fSbouyer {
234*c24c993fSbouyer return _hypercall2(int, multicall, call_list, nr_calls);
235*c24c993fSbouyer }
236*c24c993fSbouyer
237*c24c993fSbouyer static inline int
HYPERVISOR_update_va_mapping(unsigned long va,unsigned long new_val,unsigned long flags)238*c24c993fSbouyer HYPERVISOR_update_va_mapping(
239*c24c993fSbouyer unsigned long va, unsigned long new_val, unsigned long flags)
240*c24c993fSbouyer {
241*c24c993fSbouyer return _hypercall3(int, update_va_mapping, va, new_val, flags);
242*c24c993fSbouyer }
243*c24c993fSbouyer
244*c24c993fSbouyer static inline int
HYPERVISOR_event_channel_op(evtchn_op_t * op)245*c24c993fSbouyer HYPERVISOR_event_channel_op(evtchn_op_t *op)
246*c24c993fSbouyer {
247*c24c993fSbouyer KASSERT(op != NULL);
248*c24c993fSbouyer #if __XEN_INTERFACE_VERSION__ < 0x00030202
249*c24c993fSbouyer return _hypercall1(int, event_channel_op, op);
250*c24c993fSbouyer #else
251*c24c993fSbouyer return _hypercall2(int, event_channel_op, op->cmd, &op->u);
252*c24c993fSbouyer #endif
253*c24c993fSbouyer }
254*c24c993fSbouyer
255*c24c993fSbouyer static inline int
HYPERVISOR_acm_op(int cmd,void * arg)256*c24c993fSbouyer HYPERVISOR_acm_op(
257*c24c993fSbouyer int cmd, void *arg)
258*c24c993fSbouyer {
259*c24c993fSbouyer return _hypercall2(int, acm_op, cmd, arg);
260*c24c993fSbouyer }
261*c24c993fSbouyer
262*c24c993fSbouyer static inline int
HYPERVISOR_xen_version(int cmd,void * arg)263*c24c993fSbouyer HYPERVISOR_xen_version(
264*c24c993fSbouyer int cmd, void *arg)
265*c24c993fSbouyer {
266*c24c993fSbouyer return _hypercall2(int, xen_version, cmd, arg);
267*c24c993fSbouyer }
268*c24c993fSbouyer
269*c24c993fSbouyer static inline int
HYPERVISOR_console_io(int cmd,int count,char * str)270*c24c993fSbouyer HYPERVISOR_console_io(
271*c24c993fSbouyer int cmd, int count, char *str)
272*c24c993fSbouyer {
273*c24c993fSbouyer return _hypercall3(int, console_io, cmd, count, str);
274*c24c993fSbouyer }
275*c24c993fSbouyer
276*c24c993fSbouyer static inline int
HYPERVISOR_physdev_op(int cmd,void * op)277*c24c993fSbouyer HYPERVISOR_physdev_op(int cmd, void *op)
278*c24c993fSbouyer {
279*c24c993fSbouyer return _hypercall2(int, physdev_op, cmd, op);
280*c24c993fSbouyer }
281*c24c993fSbouyer
282*c24c993fSbouyer static inline int
HYPERVISOR_grant_table_op(unsigned int cmd,void * uop,unsigned int count)283*c24c993fSbouyer HYPERVISOR_grant_table_op(
284*c24c993fSbouyer unsigned int cmd, void *uop, unsigned int count)
285*c24c993fSbouyer {
286*c24c993fSbouyer return _hypercall3(int, grant_table_op, cmd, uop, count);
287*c24c993fSbouyer }
288*c24c993fSbouyer
289*c24c993fSbouyer static inline int
HYPERVISOR_update_va_mapping_otherdomain(unsigned long va,unsigned long new_val,unsigned long flags,domid_t domid)290*c24c993fSbouyer HYPERVISOR_update_va_mapping_otherdomain(
291*c24c993fSbouyer unsigned long va, unsigned long new_val, unsigned long flags,
292*c24c993fSbouyer domid_t domid)
293*c24c993fSbouyer {
294*c24c993fSbouyer return _hypercall4(int, update_va_mapping_otherdomain, va,
295*c24c993fSbouyer new_val, flags, domid);
296*c24c993fSbouyer }
297*c24c993fSbouyer
298*c24c993fSbouyer static inline int
HYPERVISOR_vm_assist(unsigned int cmd,unsigned int type)299*c24c993fSbouyer HYPERVISOR_vm_assist(
300*c24c993fSbouyer unsigned int cmd, unsigned int type)
301*c24c993fSbouyer {
302*c24c993fSbouyer return _hypercall2(int, vm_assist, cmd, type);
303*c24c993fSbouyer }
304*c24c993fSbouyer
305*c24c993fSbouyer static inline int
HYPERVISOR_vcpu_op(int cmd,int vcpuid,void * extra_args)306*c24c993fSbouyer HYPERVISOR_vcpu_op(
307*c24c993fSbouyer int cmd, int vcpuid, void *extra_args)
308*c24c993fSbouyer {
309*c24c993fSbouyer return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
310*c24c993fSbouyer }
311*c24c993fSbouyer
312*c24c993fSbouyer static inline int
HYPERVISOR_set_segment_base(int reg,unsigned long value)313*c24c993fSbouyer HYPERVISOR_set_segment_base(
314*c24c993fSbouyer int reg, unsigned long value)
315*c24c993fSbouyer {
316*c24c993fSbouyer return _hypercall2(int, set_segment_base, reg, value);
317*c24c993fSbouyer }
318*c24c993fSbouyer
319*c24c993fSbouyer static inline int
HYPERVISOR_suspend(unsigned long srec)320*c24c993fSbouyer HYPERVISOR_suspend(
321*c24c993fSbouyer unsigned long srec)
322*c24c993fSbouyer {
323*c24c993fSbouyer #if __XEN_INTERFACE_VERSION__ >= 0x00030201
324*c24c993fSbouyer
325*c24c993fSbouyer struct sched_shutdown shutdown_reason = {
326*c24c993fSbouyer .reason = SHUTDOWN_suspend,
327*c24c993fSbouyer };
328*c24c993fSbouyer
329*c24c993fSbouyer return _hypercall3(int, sched_op, SCHEDOP_shutdown,
330*c24c993fSbouyer &shutdown_reason, srec);
331*c24c993fSbouyer #else
332*c24c993fSbouyer return _hypercall3(int, sched_op, SCHEDOP_shutdown,
333*c24c993fSbouyer SHUTDOWN_suspend, srec);
334*c24c993fSbouyer #endif
335*c24c993fSbouyer }
336*c24c993fSbouyer
337*c24c993fSbouyer static inline long
HYPERVISOR_yield(void)338*c24c993fSbouyer HYPERVISOR_yield(
339*c24c993fSbouyer void)
340*c24c993fSbouyer {
341*c24c993fSbouyer return _hypercall2(int, sched_op, SCHEDOP_yield, 0);
342*c24c993fSbouyer }
343*c24c993fSbouyer
344*c24c993fSbouyer static inline long
HYPERVISOR_block(void)345*c24c993fSbouyer HYPERVISOR_block(
346*c24c993fSbouyer void)
347*c24c993fSbouyer {
348*c24c993fSbouyer return _hypercall2(int, sched_op, SCHEDOP_block, 0);
349*c24c993fSbouyer }
350*c24c993fSbouyer
351*c24c993fSbouyer static inline long
HYPERVISOR_shutdown(void)352*c24c993fSbouyer HYPERVISOR_shutdown(
353*c24c993fSbouyer void)
354*c24c993fSbouyer {
355*c24c993fSbouyer #if __XEN_INTERFACE_VERSION__ >= 0x00030201
356*c24c993fSbouyer
357*c24c993fSbouyer struct sched_shutdown shutdown_reason = {
358*c24c993fSbouyer .reason = SHUTDOWN_poweroff,
359*c24c993fSbouyer };
360*c24c993fSbouyer
361*c24c993fSbouyer return _hypercall2(int, sched_op, SCHEDOP_shutdown,
362*c24c993fSbouyer &shutdown_reason);
363*c24c993fSbouyer #else
364*c24c993fSbouyer - return _hypercall2(int, sched_op, SCHEDOP_shutdown, SHUTDOWN_poweroff);
365*c24c993fSbouyer #endif
366*c24c993fSbouyer }
367*c24c993fSbouyer
368*c24c993fSbouyer static inline long
HYPERVISOR_crash(void)369*c24c993fSbouyer HYPERVISOR_crash(
370*c24c993fSbouyer void)
371*c24c993fSbouyer {
372*c24c993fSbouyer #if __XEN_INTERFACE_VERSION__ >= 0x00030201
373*c24c993fSbouyer
374*c24c993fSbouyer struct sched_shutdown shutdown_reason = {
375*c24c993fSbouyer .reason = SHUTDOWN_crash,
376*c24c993fSbouyer };
377*c24c993fSbouyer
378*c24c993fSbouyer return _hypercall2(int, sched_op, SCHEDOP_shutdown,
379*c24c993fSbouyer &shutdown_reason);
380*c24c993fSbouyer #else
381*c24c993fSbouyer return _hypercall2(int, sched_op, SCHEDOP_shutdown, SHUTDOWN_crash);
382*c24c993fSbouyer #endif
383*c24c993fSbouyer }
384*c24c993fSbouyer
385*c24c993fSbouyer static inline long
HYPERVISOR_reboot(void)386*c24c993fSbouyer HYPERVISOR_reboot(
387*c24c993fSbouyer void)
388*c24c993fSbouyer {
389*c24c993fSbouyer #if __XEN_INTERFACE_VERSION__ >= 0x00030201
390*c24c993fSbouyer
391*c24c993fSbouyer struct sched_shutdown shutdown_reason = {
392*c24c993fSbouyer .reason = SHUTDOWN_reboot,
393*c24c993fSbouyer };
394*c24c993fSbouyer
395*c24c993fSbouyer return _hypercall2(int, sched_op, SCHEDOP_shutdown,
396*c24c993fSbouyer &shutdown_reason);
397*c24c993fSbouyer #else
398*c24c993fSbouyer return _hypercall2(int, sched_op, SCHEDOP_shutdown, SHUTDOWN_reboot);
399*c24c993fSbouyer #endif
400*c24c993fSbouyer }
401*c24c993fSbouyer
402*c24c993fSbouyer static inline int
HYPERVISOR_nmi_op(unsigned long op,void * arg)403*c24c993fSbouyer HYPERVISOR_nmi_op(
404*c24c993fSbouyer unsigned long op, void *arg)
405*c24c993fSbouyer {
406*c24c993fSbouyer return _hypercall2(int, nmi_op, op, arg);
407*c24c993fSbouyer }
408*c24c993fSbouyer
409*c24c993fSbouyer static inline long
HYPERVISOR_hvm_op(int op,void * arg)410*c24c993fSbouyer HYPERVISOR_hvm_op(
411*c24c993fSbouyer int op, void *arg)
412*c24c993fSbouyer {
413*c24c993fSbouyer return _hypercall2(long, hvm_op, op, arg);
414*c24c993fSbouyer }
415*c24c993fSbouyer
416*c24c993fSbouyer static inline int
HYPERVISOR_callback_op(int cmd,void * arg)417*c24c993fSbouyer HYPERVISOR_callback_op(
418*c24c993fSbouyer int cmd, void *arg)
419*c24c993fSbouyer {
420*c24c993fSbouyer return _hypercall2(int, callback_op, cmd, arg);
421*c24c993fSbouyer }
422*c24c993fSbouyer
423*c24c993fSbouyer static inline int
HYPERVISOR_xenoprof_op(int op,void * arg)424*c24c993fSbouyer HYPERVISOR_xenoprof_op(
425*c24c993fSbouyer int op, void *arg)
426*c24c993fSbouyer {
427*c24c993fSbouyer return _hypercall2(int, xenoprof_op, op, arg);
428*c24c993fSbouyer }
429*c24c993fSbouyer
430*c24c993fSbouyer static inline int
HYPERVISOR_kexec_op(unsigned long op,void * args)431*c24c993fSbouyer HYPERVISOR_kexec_op(
432*c24c993fSbouyer unsigned long op, void *args)
433*c24c993fSbouyer {
434*c24c993fSbouyer return _hypercall2(int, kexec_op, op, args);
435*c24c993fSbouyer }
436*c24c993fSbouyer
437*c24c993fSbouyer #if __XEN_INTERFACE_VERSION__ < 0x00030204
438*c24c993fSbouyer static inline int
HYPERVISOR_dom0_op(dom0_op_t * dom0_op)439*c24c993fSbouyer HYPERVISOR_dom0_op(
440*c24c993fSbouyer dom0_op_t *dom0_op)
441*c24c993fSbouyer {
442*c24c993fSbouyer dom0_op->interface_version = DOM0_INTERFACE_VERSION;
443*c24c993fSbouyer return _hypercall1(int, dom0_op, dom0_op);
444*c24c993fSbouyer }
445*c24c993fSbouyer #endif /* __XEN_INTERFACE_VERSION__ */
446*c24c993fSbouyer
447*c24c993fSbouyer #include <xen/include/public/arch-x86/xen-mca.h>
448*c24c993fSbouyer
449*c24c993fSbouyer static inline int
HYPERVISOR_machine_check(struct xen_mc * mc)450*c24c993fSbouyer HYPERVISOR_machine_check(struct xen_mc *mc)
451*c24c993fSbouyer {
452*c24c993fSbouyer mc->interface_version = XEN_MCA_INTERFACE_VERSION;
453*c24c993fSbouyer return _hypercall1(int, mca, mc);
454*c24c993fSbouyer }
455*c24c993fSbouyer
456*c24c993fSbouyer static inline int
HYPERVISOR_sysctl(void * sysctl)457*c24c993fSbouyer HYPERVISOR_sysctl(void *sysctl)
458*c24c993fSbouyer {
459*c24c993fSbouyer return _hypercall1(int, sysctl, sysctl);
460*c24c993fSbouyer }
461*c24c993fSbouyer
462*c24c993fSbouyer #endif /* __HYPERCALL_H__ */
463