win-pvdrivers

view xenpci/hypercall_x86_mingw.h @ 382:ecfd4ddaaf3d

remove dead code
author Andy Grover <andy.grover@oracle.com>
date Wed Jul 09 12:35:41 2008 -0700 (2008-07-09)
parents 5b2a37528899
children e7292fd9e55a
line source
1 /* Code/license from Xen's include/asm/hypercall.h: */
2 /*
3 * Copyright (c) 2002-2004, K A Fraser
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License version 2
7 * as published by the Free Software Foundation; or, when distributed
8 * separately from the Linux kernel or incorporated into other
9 * software packages, subject to the following license:
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this source file (the "Software"), to deal in the Software without
13 * restriction, including without limitation the rights to use, copy, modify,
14 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
15 * and to permit persons to whom the Software is furnished to do so, subject to
16 * the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
20 */
21 /* Also Copyright (C) 2008 Andy Grover */
23 #define __STR(x) #x
24 #define STR(x) __STR(x)
26 #define _hypercall2(type, name, a1, a2) \
27 ({ \
28 long __res, __ign1, __ign2; \
29 asm volatile ( \
30 "mov %3,%%eax; " \
31 "add $("STR(__HYPERVISOR_##name)" * 32),%%eax; " \
32 "call *%%eax" \
33 : "=a" (__res), "=b" (__ign1), "=c" (__ign2) \
34 : "1" ((long)(a1)), "2" ((long)(a2)), "r" (xpdd->hypercall_stubs) \
35 : "memory" ); \
36 (type)__res; \
37 })
39 #define _hypercall3(type, name, a1, a2, a3) \
40 ({ \
41 long __res, __ign1, __ign2, __ign3; \
42 asm volatile ( \
43 "mov %4,%%eax; " \
44 "add $("STR(__HYPERVISOR_##name)" * 32),%%eax; " \
45 "call *%%eax" \
46 : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \
47 "=d" (__ign3) \
48 : "1" ((long)(a1)), "2" ((long)(a2)), \
49 "3" ((long)(a3)), "r" (xpdd->hypercall_stubs) \
50 : "memory" ); \
51 (type)__res; \
52 })
55 static __inline void __cpuid(uint32_t output[4], uint32_t op)
56 {
57 __asm__("cpuid"
58 : "=a" (output[0]),
59 "=b" (output[1]),
60 "=c" (output[2]),
61 "=d" (output[3])
62 : "0" (op));
63 }
65 static __inline void __writemsr(uint32_t msr, uint64_t value)
66 {
67 uint32_t hi, lo;
68 hi = value >> 32;
69 lo = value & 0xFFFFFFFF;
71 __asm__ __volatile__("wrmsr"
72 : /* no outputs */
73 : "c" (msr), "a" (lo), "d" (hi));
74 }
76 static __inline int
77 HYPERVISOR_memory_op(PXENPCI_DEVICE_DATA xpdd, int cmd, void *arg)
78 {
79 return _hypercall2(int, memory_op, cmd, arg);
80 }
82 static __inline int
83 HYPERVISOR_sched_op(PXENPCI_DEVICE_DATA xpdd, int cmd, void *arg)
84 {
85 return _hypercall2(int, sched_op, cmd, arg);
86 }
88 static __inline int
89 HYPERVISOR_hvm_op(PXENPCI_DEVICE_DATA xpdd, int op, struct xen_hvm_param *arg)
90 {
91 return _hypercall2(unsigned long, hvm_op, op, arg);
92 }
94 static __inline int
95 HYPERVISOR_event_channel_op(PXENPCI_DEVICE_DATA xpdd, int cmd, void *arg)
96 {
97 return _hypercall2(int, event_channel_op, cmd, arg);
98 }
100 static inline int
101 HYPERVISOR_grant_table_op(
102 PXENPCI_DEVICE_DATA xpdd,
103 unsigned int cmd,
104 void *uop,
105 unsigned int count)
106 {
107 return _hypercall3(int, grant_table_op, cmd, uop, count);
108 }