win-pvdrivers

view common/include/hypercall.h @ 62:edd4a2ad5b44

Removed old inf files
author James Harper <james.harper@bendigoit.com.au>
date Wed Dec 19 10:22:50 2007 +1100 (2007-12-19)
parents be8c09632f31
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 static __inline int
23 HYPERVISOR_memory_op(WDFDEVICE Device, int cmd, void *arg)
24 {
25 char *hypercall_stubs = GetDeviceData(Device)->hypercall_stubs;
26 long __res;
27 __asm {
28 mov ebx, cmd
29 mov ecx, arg
30 mov eax, hypercall_stubs
31 add eax, (__HYPERVISOR_memory_op * 32)
32 call eax
33 mov [__res], eax
34 }
35 return __res;
36 }
38 static __inline int
39 HYPERVISOR_xen_version(WDFDEVICE Device, int cmd, void *arg)
40 {
41 char *hypercall_stubs = GetDeviceData(Device)->hypercall_stubs;
42 long __res;
43 __asm {
44 mov ebx, cmd
45 mov ecx, arg
46 mov eax, hypercall_stubs
47 add eax, (__HYPERVISOR_xen_version * 32)
48 call eax
49 mov [__res], eax
50 }
51 return __res;
52 }
54 static __inline int
55 HYPERVISOR_grant_table_op(WDFDEVICE Device, int cmd, void *uop, unsigned int count)
56 {
57 char *hypercall_stubs = GetDeviceData(Device)->hypercall_stubs;
58 long __res;
59 __asm {
60 mov ebx, cmd
61 mov ecx, uop
62 mov edx, count
63 mov eax, hypercall_stubs
64 add eax, (__HYPERVISOR_grant_table_op * 32)
65 call eax
66 mov [__res], eax
67 }
68 return __res;
69 }
71 static __inline int
72 HYPERVISOR_mmu_update(WDFDEVICE Device, mmu_update_t *req, int count, int *success_count, domid_t domid)
73 {
74 char *hypercall_stubs = GetDeviceData(Device)->hypercall_stubs;
75 long __res;
76 long _domid = (long)domid;
77 __asm {
78 mov ebx, req
79 mov ecx, count
80 mov edx, success_count
81 mov edi, _domid
82 mov eax, hypercall_stubs
83 add eax, (__HYPERVISOR_mmu_update * 32)
84 call eax
85 mov [__res], eax
86 }
87 return __res;
88 }
90 static __inline int
91 HYPERVISOR_console_io(WDFDEVICE Device, int cmd, int count, char *string)
92 {
93 char *hypercall_stubs = GetDeviceData(Device)->hypercall_stubs;
94 long __res;
95 __asm {
96 mov ebx, cmd
97 mov ecx, count
98 mov edx, string
99 mov eax, hypercall_stubs
100 add eax, (__HYPERVISOR_console_io * 32)
101 call eax
102 mov [__res], eax
103 }
104 return __res;
105 }
107 static __inline int
108 HYPERVISOR_hvm_op(WDFDEVICE Device, int op, struct xen_hvm_param *arg)
109 {
110 char *hypercall_stubs = GetDeviceData(Device)->hypercall_stubs;
111 long __res;
112 __asm {
113 mov ebx, op
114 mov ecx, arg
115 mov eax, hypercall_stubs
116 add eax, (__HYPERVISOR_hvm_op * 32)
117 call eax
118 mov [__res], eax
119 }
120 return __res;
121 }
123 static __inline int
124 HYPERVISOR_event_channel_op(WDFDEVICE Device, int cmd, void *op)
125 {
126 char *hypercall_stubs = GetDeviceData(Device)->hypercall_stubs;
127 long __res;
128 __asm {
129 mov ebx, cmd
130 mov ecx, op
131 mov eax, hypercall_stubs
132 add eax, (__HYPERVISOR_event_channel_op * 32)
133 call eax
134 mov [__res], eax
135 }
136 return __res;
137 }
139 static __inline ULONGLONG
140 hvm_get_parameter(WDFDEVICE Device, int hvm_param)
141 {
142 struct xen_hvm_param a;
143 int retval;
145 KdPrint((__DRIVER_NAME " --> hvm_get_parameter\n"));
146 a.domid = DOMID_SELF;
147 a.index = hvm_param;
148 //a.value = via;
149 retval = HYPERVISOR_hvm_op(Device, HVMOP_get_param, &a);
150 KdPrint((__DRIVER_NAME " hvm_get_parameter retval = %d\n", retval));
151 KdPrint((__DRIVER_NAME " <-- hvm_get_parameter\n"));
152 return a.value;
153 }