win-pvdrivers

view xenpci/hypercall_amd64.h @ 643:1794a52f415d

Added tag 0.10.0.94 for changeset 51de599aa482
author James Harper <james.harper@bendigoit.com.au>
date Mon Aug 24 21:21:37 2009 +1000 (2009-08-24)
parents 25814a68e426
children 95159ee58473
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 extern int _hypercall2(VOID *address, xen_ulong_t a1, xen_ulong_t a2);
21 extern int _hypercall3(VOID *address, xen_ulong_t a1, xen_ulong_t a2, xen_ulong_t a3);
23 static __inline int
24 HYPERVISOR_memory_op(PXENPCI_DEVICE_DATA xpdd, int cmd, void *arg)
25 {
26 PCHAR memory_op_func = xpdd->hypercall_stubs;
27 memory_op_func += __HYPERVISOR_memory_op * 32;
28 return _hypercall2(memory_op_func, (xen_ulong_t)cmd, (xen_ulong_t)arg);
29 }
31 static __inline int
32 HYPERVISOR_xen_version(PXENPCI_DEVICE_DATA xpdd, int cmd, void *arg)
33 {
34 PCHAR xen_version_func = xpdd->hypercall_stubs;
35 xen_version_func += __HYPERVISOR_xen_version * 32;
36 return _hypercall2(xen_version_func, (xen_ulong_t)cmd, (xen_ulong_t)arg);
37 }
39 static __inline int
40 HYPERVISOR_grant_table_op(PXENPCI_DEVICE_DATA xpdd, int cmd, void *uop, unsigned int count)
41 {
42 PCHAR grant_table_op_func = xpdd->hypercall_stubs;
43 grant_table_op_func += __HYPERVISOR_grant_table_op * 32;
44 return _hypercall3(grant_table_op_func, (xen_ulong_t)cmd, (xen_ulong_t)uop, (xen_ulong_t)count);
45 }
47 #if 0
48 static __inline int
49 HYPERVISOR_mmu_update(PXENPCI_DEVICE_DATA xpdd, mmu_update_t *req, int count, int *success_count, domid_t domid)
50 {
51 ASSERTMSG("mmu_update not yet supported under AMD64", FALSE);
52 /*
53 char *hypercall_stubs = xpdd->hypercall_stubs;
54 long __res;
55 long _domid = (long)domid;
56 __asm {
57 mov ebx, req
58 mov ecx, count
59 mov edx, success_count
60 mov edi, _domid
61 mov eax, hypercall_stubs
62 add eax, (__HYPERVISOR_mmu_update * 32)
63 call eax
64 mov [__res], eax
65 }
66 return __res;
67 */
68 return -1;
69 }
70 #endif
72 static __inline int
73 HYPERVISOR_hvm_op(PXENPCI_DEVICE_DATA xpdd, int op, struct xen_hvm_param *arg)
74 {
75 PCHAR hvm_op_func = xpdd->hypercall_stubs;
76 hvm_op_func += __HYPERVISOR_hvm_op * 32;
77 return _hypercall2(hvm_op_func, (xen_ulong_t)op, (xen_ulong_t)arg);
78 }
80 static __inline int
81 HYPERVISOR_event_channel_op(PXENPCI_DEVICE_DATA xpdd, int cmd, void *op)
82 {
83 PCHAR event_channel_op_func = xpdd->hypercall_stubs;
84 event_channel_op_func += __HYPERVISOR_event_channel_op * 32;
85 return _hypercall2(event_channel_op_func, (xen_ulong_t)cmd, (xen_ulong_t)op);
86 }
88 static __inline int
89 HYPERVISOR_sched_op(PXENPCI_DEVICE_DATA xpdd, int cmd, void *arg)
90 {
91 PCHAR sched_op_func = xpdd->hypercall_stubs;
92 sched_op_func += __HYPERVISOR_sched_op * 32;
93 return _hypercall2(sched_op_func, (xen_ulong_t)cmd, (xen_ulong_t)arg);
94 }
96 static __inline int
97 HYPERVISOR_shutdown(PXENPCI_DEVICE_DATA xpdd, unsigned int reason)
98 {
99 struct sched_shutdown ss;
100 int retval;
102 KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
104 ss.reason = reason;
106 KdPrint((__DRIVER_NAME " A\n"));
108 retval = HYPERVISOR_sched_op(xpdd, SCHEDOP_shutdown, &ss);
110 KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
112 return retval;
113 }
115 #if 0
116 static __inline ULONGLONG
117 hvm_get_parameter(PXENPCI_DEVICE_DATA xpdd, int hvm_param)
118 {
119 struct xen_hvm_param a;
120 int retval;
122 KdPrint((__DRIVER_NAME " --> hvm_get_parameter\n"));
123 a.domid = DOMID_SELF;
124 a.index = hvm_param;
125 retval = HYPERVISOR_hvm_op(xpdd, HVMOP_get_param, &a);
126 KdPrint((__DRIVER_NAME " hvm_get_parameter retval = %d\n", retval));
127 KdPrint((__DRIVER_NAME " hvm_get_parameter value = %ld\n", a.value));
128 KdPrint((__DRIVER_NAME " <-- hvm_get_parameter\n"));
129 return a.value;
130 }
131 #endif