win-pvdrivers

view xenpci/hypercall.h @ 900:938de6b8623d

fix memory leak on suspend/resume
author James Harper <james.harper@bendigoit.com.au>
date Thu Mar 31 20:20:36 2011 +1100 (2011-03-31)
parents 95159ee58473
children 471c94d04d8a
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 #elif defined(_AMD64_)
27 #include "hypercall_amd64.h"
28 #elif defined(__ia64__)
29 #include "hypercall_ia64.h"
30 #endif
32 static __inline ULONGLONG
33 _hvm_get_parameter(PVOID hypercall_stubs, int hvm_param)
34 {
35 struct xen_hvm_param a;
36 int retval;
38 FUNCTION_ENTER();
39 a.domid = DOMID_SELF;
40 a.index = hvm_param;
41 retval = _HYPERVISOR_hvm_op(hypercall_stubs, HVMOP_get_param, &a);
42 KdPrint((__DRIVER_NAME " HYPERVISOR_hvm_op retval = %d\n", retval));
43 FUNCTION_EXIT();
44 return a.value;
45 }
47 static __inline ULONGLONG
48 _hvm_set_parameter(PVOID hypercall_stubs, int hvm_param, ULONGLONG value)
49 {
50 struct xen_hvm_param a;
51 int retval;
53 FUNCTION_ENTER();
54 a.domid = DOMID_SELF;
55 a.index = hvm_param;
56 a.value = value;
57 retval = _HYPERVISOR_hvm_op(hypercall_stubs, HVMOP_set_param, &a);
58 KdPrint((__DRIVER_NAME " HYPERVISOR_hvm_op retval = %d\n", retval));
59 FUNCTION_EXIT();
60 return retval;
61 }
63 static __inline int
64 _hvm_shutdown(PVOID hypercall_stubs, unsigned int reason)
65 {
66 struct sched_shutdown ss;
67 int retval;
69 FUNCTION_ENTER();
70 ss.reason = reason;
71 retval = _HYPERVISOR_sched_op(hypercall_stubs, SCHEDOP_shutdown, &ss);
72 FUNCTION_EXIT();
73 return retval;
74 }
76 static __inline VOID
77 _HYPERVISOR_yield(PVOID hypercall_stubs)
78 {
79 _HYPERVISOR_sched_op(hypercall_stubs, SCHEDOP_yield, NULL);
80 }