win-pvdrivers

annotate 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
rev   line source
james@0 1 /*
james@0 2 PV Drivers for Windows Xen HVM Domains
james@0 3 Copyright (C) 2007 James Harper
james@0 4
james@0 5 This program is free software; you can redistribute it and/or
james@0 6 modify it under the terms of the GNU General Public License
james@0 7 as published by the Free Software Foundation; either version 2
james@0 8 of the License, or (at your option) any later version.
james@0 9
james@0 10 This program is distributed in the hope that it will be useful,
james@0 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
james@0 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
james@0 13 GNU General Public License for more details.
james@0 14
james@0 15 You should have received a copy of the GNU General Public License
james@0 16 along with this program; if not, write to the Free Software
james@0 17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
james@0 18 */
james@0 19
james@0 20 #include "xenpci.h"
james@0 21
james@0 22 static __inline int
andy@13 23 HYPERVISOR_memory_op(WDFDEVICE Device, int cmd, void *arg)
james@0 24 {
andy@13 25 char *hypercall_stubs = GetDeviceData(Device)->hypercall_stubs;
james@0 26 long __res;
james@0 27 __asm {
james@0 28 mov ebx, cmd
james@0 29 mov ecx, arg
james@0 30 mov eax, hypercall_stubs
james@0 31 add eax, (__HYPERVISOR_memory_op * 32)
james@0 32 call eax
james@0 33 mov [__res], eax
james@0 34 }
james@0 35 return __res;
james@0 36 }
james@0 37
james@0 38 static __inline int
andy@13 39 HYPERVISOR_xen_version(WDFDEVICE Device, int cmd, void *arg)
james@0 40 {
andy@13 41 char *hypercall_stubs = GetDeviceData(Device)->hypercall_stubs;
james@0 42 long __res;
james@0 43 __asm {
james@0 44 mov ebx, cmd
james@0 45 mov ecx, arg
james@0 46 mov eax, hypercall_stubs
james@0 47 add eax, (__HYPERVISOR_xen_version * 32)
james@0 48 call eax
james@0 49 mov [__res], eax
james@0 50 }
james@0 51 return __res;
james@0 52 }
james@0 53
james@0 54 static __inline int
andy@13 55 HYPERVISOR_grant_table_op(WDFDEVICE Device, int cmd, void *uop, unsigned int count)
james@0 56 {
andy@13 57 char *hypercall_stubs = GetDeviceData(Device)->hypercall_stubs;
james@0 58 long __res;
james@0 59 __asm {
james@0 60 mov ebx, cmd
james@0 61 mov ecx, uop
james@0 62 mov edx, count
james@0 63 mov eax, hypercall_stubs
james@0 64 add eax, (__HYPERVISOR_grant_table_op * 32)
james@0 65 call eax
james@0 66 mov [__res], eax
james@0 67 }
james@0 68 return __res;
james@0 69 }
james@0 70
james@0 71 static __inline int
andy@13 72 HYPERVISOR_mmu_update(WDFDEVICE Device, mmu_update_t *req, int count, int *success_count, domid_t domid)
james@0 73 {
andy@13 74 char *hypercall_stubs = GetDeviceData(Device)->hypercall_stubs;
james@0 75 long __res;
james@0 76 long _domid = (long)domid;
james@0 77 __asm {
james@0 78 mov ebx, req
james@0 79 mov ecx, count
james@0 80 mov edx, success_count
james@0 81 mov edi, _domid
james@0 82 mov eax, hypercall_stubs
james@0 83 add eax, (__HYPERVISOR_mmu_update * 32)
james@0 84 call eax
james@0 85 mov [__res], eax
james@0 86 }
james@0 87 return __res;
james@0 88 }
james@0 89
james@0 90 static __inline int
andy@13 91 HYPERVISOR_console_io(WDFDEVICE Device, int cmd, int count, char *string)
james@0 92 {
andy@13 93 char *hypercall_stubs = GetDeviceData(Device)->hypercall_stubs;
james@0 94 long __res;
james@0 95 __asm {
james@0 96 mov ebx, cmd
james@0 97 mov ecx, count
james@0 98 mov edx, string
james@0 99 mov eax, hypercall_stubs
james@0 100 add eax, (__HYPERVISOR_console_io * 32)
james@0 101 call eax
james@0 102 mov [__res], eax
james@0 103 }
james@0 104 return __res;
james@0 105 }
james@0 106
james@0 107 static __inline int
andy@13 108 HYPERVISOR_hvm_op(WDFDEVICE Device, int op, struct xen_hvm_param *arg)
james@0 109 {
andy@13 110 char *hypercall_stubs = GetDeviceData(Device)->hypercall_stubs;
james@0 111 long __res;
james@0 112 __asm {
james@0 113 mov ebx, op
james@0 114 mov ecx, arg
james@0 115 mov eax, hypercall_stubs
james@0 116 add eax, (__HYPERVISOR_hvm_op * 32)
james@0 117 call eax
james@0 118 mov [__res], eax
james@0 119 }
james@0 120 return __res;
james@0 121 }
james@0 122
james@0 123 static __inline int
andy@13 124 HYPERVISOR_event_channel_op(WDFDEVICE Device, int cmd, void *op)
james@0 125 {
andy@13 126 char *hypercall_stubs = GetDeviceData(Device)->hypercall_stubs;
james@0 127 long __res;
james@0 128 __asm {
james@0 129 mov ebx, cmd
james@0 130 mov ecx, op
james@0 131 mov eax, hypercall_stubs
james@0 132 add eax, (__HYPERVISOR_event_channel_op * 32)
james@0 133 call eax
james@0 134 mov [__res], eax
james@0 135 }
james@0 136 return __res;
james@0 137 }
james@0 138
james@0 139 static __inline ULONGLONG
andy@13 140 hvm_get_parameter(WDFDEVICE Device, int hvm_param)
james@0 141 {
james@0 142 struct xen_hvm_param a;
james@0 143 int retval;
james@0 144
james@0 145 KdPrint((__DRIVER_NAME " --> hvm_get_parameter\n"));
james@0 146 a.domid = DOMID_SELF;
james@0 147 a.index = hvm_param;
james@0 148 //a.value = via;
andy@13 149 retval = HYPERVISOR_hvm_op(Device, HVMOP_get_param, &a);
james@0 150 KdPrint((__DRIVER_NAME " hvm_get_parameter retval = %d\n", retval));
james@0 151 KdPrint((__DRIVER_NAME " <-- hvm_get_parameter\n"));
james@0 152 return a.value;
james@0 153 }