win-pvdrivers

view xenpci/hypercall.h @ 353:a7c4b65e754a

Bugfixes for save/restore
author James Harper <james.harper@bendigoit.com.au>
date Wed Jul 02 09:54:40 2008 +1000 (2008-07-02)
parents daa0a9b0fef0
children e7292fd9e55a
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 #if defined(_X86_)
21 #if defined(__MINGW32__)
22 #include "hypercall_x86_mingw.h"
23 #else
24 #include "hypercall_x86.h"
25 #endif
26 #else
27 #if defined(_AMD64_)
28 #include "hypercall_amd64.h"
29 #endif
30 #endif
32 static __inline ULONGLONG
33 hvm_get_parameter(PXENPCI_DEVICE_DATA xpdd, int hvm_param)
34 {
35 struct xen_hvm_param a;
36 int retval;
38 KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
39 a.domid = DOMID_SELF;
40 a.index = hvm_param;
41 //a.value = via;
42 retval = HYPERVISOR_hvm_op(xpdd, HVMOP_get_param, &a);
43 KdPrint((__DRIVER_NAME " HYPERVISOR_hvm_op retval = %d\n", retval));
44 KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
45 return a.value;
46 }
48 static __inline ULONGLONG
49 hvm_set_parameter(PXENPCI_DEVICE_DATA xpdd, int hvm_param, ULONGLONG value)
50 {
51 struct xen_hvm_param a;
52 int retval;
54 KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
55 a.domid = DOMID_SELF;
56 a.index = hvm_param;
57 a.value = value;
58 //a.value = via;
59 retval = HYPERVISOR_hvm_op(xpdd, HVMOP_set_param, &a);
60 KdPrint((__DRIVER_NAME " HYPERVISOR_hvm_op retval = %d\n", retval));
61 KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
62 return retval;
63 }
65 static __inline int
66 hvm_shutdown(PXENPCI_DEVICE_DATA xpdd, unsigned int reason)
67 {
68 struct sched_shutdown ss;
69 int retval;
71 KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
72 ss.reason = reason;
73 retval = HYPERVISOR_sched_op(xpdd, SCHEDOP_shutdown, &ss);
74 KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
75 return retval;
76 }
78 static __inline VOID
79 HYPERVISOR_yield(PXENPCI_DEVICE_DATA xpdd)
80 {
81 HYPERVISOR_sched_op(xpdd, SCHEDOP_yield, NULL);
82 }