win-pvdrivers

view common/include/hypercall.h @ 0:435e5753300f

Initial upload of files
author James Harper <james.harper@bendigoit.com.au>
date Sat Nov 10 14:40:56 2007 +1100 (2007-11-10)
parents
children be8c09632f31
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 char *hypercall_stubs;
24 static __inline int
25 HYPERVISOR_memory_op(int cmd, void *arg)
26 {
27 long __res;
28 __asm {
29 mov ebx, cmd
30 mov ecx, arg
31 mov eax, hypercall_stubs
32 add eax, (__HYPERVISOR_memory_op * 32)
33 call eax
34 mov [__res], eax
35 }
36 return __res;
37 }
39 static __inline int
40 HYPERVISOR_xen_version(int cmd, void *arg)
41 {
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(int cmd, void *uop, unsigned int count)
56 {
57 long __res;
58 __asm {
59 mov ebx, cmd
60 mov ecx, uop
61 mov edx, count
62 mov eax, hypercall_stubs
63 add eax, (__HYPERVISOR_grant_table_op * 32)
64 call eax
65 mov [__res], eax
66 }
67 return __res;
68 }
70 static __inline int
71 HYPERVISOR_mmu_update(mmu_update_t *req, int count, int *success_count, domid_t domid)
72 {
73 long __res;
74 long _domid = (long)domid;
75 __asm {
76 mov ebx, req
77 mov ecx, count
78 mov edx, success_count
79 mov edi, _domid
80 mov eax, hypercall_stubs
81 add eax, (__HYPERVISOR_mmu_update * 32)
82 call eax
83 mov [__res], eax
84 }
85 return __res;
86 }
88 static __inline int
89 HYPERVISOR_console_io(int cmd, int count, char *string)
90 {
91 long __res;
92 __asm {
93 mov ebx, cmd
94 mov ecx, count
95 mov edx, string
96 mov eax, hypercall_stubs
97 add eax, (__HYPERVISOR_console_io * 32)
98 call eax
99 mov [__res], eax
100 }
101 return __res;
102 }
104 static __inline int
105 HYPERVISOR_hvm_op(int op, struct xen_hvm_param *arg)
106 {
107 long __res;
108 __asm {
109 mov ebx, op
110 mov ecx, arg
111 mov eax, hypercall_stubs
112 add eax, (__HYPERVISOR_hvm_op * 32)
113 call eax
114 mov [__res], eax
115 }
116 return __res;
117 }
119 static __inline int
120 HYPERVISOR_event_channel_op(int cmd, void *op)
121 {
122 long __res;
123 __asm {
124 mov ebx, cmd
125 mov ecx, op
126 mov eax, hypercall_stubs
127 add eax, (__HYPERVISOR_event_channel_op * 32)
128 call eax
129 mov [__res], eax
130 }
131 return __res;
132 }
134 static __inline ULONGLONG
135 hvm_get_parameter(int hvm_param)
136 {
137 struct xen_hvm_param a;
138 int retval;
140 KdPrint((__DRIVER_NAME " --> hvm_get_parameter\n"));
141 a.domid = DOMID_SELF;
142 a.index = hvm_param;
143 //a.value = via;
144 retval = HYPERVISOR_hvm_op(HVMOP_get_param, &a);
145 KdPrint((__DRIVER_NAME " hvm_get_parameter retval = %d\n", retval));
146 KdPrint((__DRIVER_NAME " <-- hvm_get_parameter\n"));
147 return a.value;
148 }