win-pvdrivers

view xenpci/hypercall.h @ 1054:471c94d04d8a

Refactoring to support xencache (tmem)
author James Harper <james.harper@bendigoit.com.au>
date Sun Jun 02 16:37:21 2013 +1000 (2013-06-02)
parents 95159ee58473
children
line source
1 /*
2 PV Drivers for Windows Xen HVM Domains
3 Copyright (C) 2007 James Harper
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
20 #include "xenpci.h"
22 #if defined(_X86_)
23 #include "hypercall_x86.h"
24 #elif defined(_AMD64_)
25 #include "hypercall_amd64.h"
26 #endif
28 static __inline ULONGLONG
29 hvm_get_parameter(int hvm_param)
30 {
31 struct xen_hvm_param a;
32 int retval;
34 a.domid = DOMID_SELF;
35 a.index = hvm_param;
36 retval = HYPERVISOR_hvm_op(HVMOP_get_param, &a);
37 return a.value;
38 }
40 static __inline ULONGLONG
41 hvm_set_parameter(int hvm_param, ULONGLONG value)
42 {
43 struct xen_hvm_param a;
44 int retval;
46 a.domid = DOMID_SELF;
47 a.index = hvm_param;
48 a.value = value;
49 retval = HYPERVISOR_hvm_op(HVMOP_set_param, &a);
50 return retval;
51 }
53 static __inline int
54 hvm_shutdown(unsigned int reason)
55 {
56 struct sched_shutdown ss;
57 int retval;
59 FUNCTION_ENTER();
60 ss.reason = reason;
61 retval = HYPERVISOR_sched_op(SCHEDOP_shutdown, &ss);
62 FUNCTION_EXIT();
63 return retval;
64 }
66 static __inline VOID
67 HYPERVISOR_yield() {
68 HYPERVISOR_sched_op(SCHEDOP_yield, NULL);
69 }