win-pvdrivers

changeset 348:6c1d86fffcd2

remove unused stuff from mingw assembly file; implement getting stub_addr from device extension (gcc extended asm ftw!)
author Andy Grover <andy.grover@oracle.com>
date Tue Jul 01 15:22:55 2008 -0700 (2008-07-01)
parents f31625adca93
children 5c7eb92ed13c
files xenpci/hypercall_x86_mingw.h
line diff
     1.1 --- a/xenpci/hypercall_x86_mingw.h	Tue Jul 01 15:21:35 2008 -0700
     1.2 +++ b/xenpci/hypercall_x86_mingw.h	Tue Jul 01 15:22:55 2008 -0700
     1.3 @@ -22,67 +22,40 @@
     1.4  
     1.5  #define __STR(x) #x
     1.6  #define STR(x) __STR(x)
     1.7 +
     1.8 +#if 0
     1.9 +#define HYPERCALL_STR(name)                                     \
    1.10 +	"mov $stub_addr,%%eax; "                                      \
    1.11 +	"add $("STR(__HYPERVISOR_##name)" * 32),%%eax; "              \
    1.12 +	"call *%%eax"
    1.13 +#endif
    1.14  
    1.15 -#define HYPERCALL_STR(name)					\
    1.16 -	"mov $stub_addr,%%eax; "			    \
    1.17 -	"add $("STR(__HYPERVISOR_##name)" * 32),%%eax; "	\
    1.18 +#define HYPERCALL_STR(name)                                     \
    1.19 +	"mov %3,%%eax; "                                      \
    1.20 +	"add $("STR(__HYPERVISOR_##name)" * 32),%%eax; "              \
    1.21  	"call *%%eax"
    1.22  
    1.23  #define _hypercall2(type, name, a1, a2)                         \
    1.24  ({                                                              \
    1.25 -        long __res, __ign1, __ign2;                             \
    1.26 -        char *stub_addr;                                        \
    1.27 -        stub_addr = xpdd->hypercall_stubs;                      \
    1.28 -        asm volatile (                                          \
    1.29 -                HYPERCALL_STR(name)                             \
    1.30 -                : "=a" (__res), "=b" (__ign1), "=c" (__ign2)    \
    1.31 -                : "1" ((long)(a1)), "2" ((long)(a2))            \
    1.32 -                : "memory" );                                   \
    1.33 -        (type)__res;                                            \
    1.34 +  long __res, __ign1, __ign2;                                   \
    1.35 +  asm volatile (                                                \
    1.36 +    HYPERCALL_STR(name)                                         \
    1.37 +    : "=a" (__res), "=b" (__ign1), "=c" (__ign2)                \
    1.38 +    : "1" ((long)(a1)), "2" ((long)(a2)), "r" (xpdd->hypercall_stubs) \
    1.39 +    : "memory" );                                               \
    1.40 +  (type)__res;                                                  \
    1.41  })
    1.42 -
    1.43 -#define _hypercall3(type, name, a1, a2, a3)			\
    1.44 -({								\
    1.45 -	long __res, __ign1, __ign2, __ign3;			\
    1.46 -	asm volatile (						\
    1.47 -		HYPERCALL_STR(name)				\
    1.48 -		: "=a" (__res), "=b" (__ign1), "=c" (__ign2), 	\
    1.49 -		"=d" (__ign3)					\
    1.50 -		: "1" ((long)(a1)), "2" ((long)(a2)),		\
    1.51 -		"3" ((long)(a3))				\
    1.52 -		: "memory" );					\
    1.53 -	(type)__res;						\
    1.54 -})
    1.55 -
    1.56 -#define _hypercall4(type, name, a1, a2, a3, a4)			\
    1.57 -({								\
    1.58 -	long __res, __ign1, __ign2, __ign3, __ign4;		\
    1.59 -	asm volatile (						\
    1.60 -		HYPERCALL_STR(name)				\
    1.61 -		: "=a" (__res), "=b" (__ign1), "=c" (__ign2),	\
    1.62 -		"=d" (__ign3), "=S" (__ign4)			\
    1.63 -		: "1" ((long)(a1)), "2" ((long)(a2)),		\
    1.64 -		"3" ((long)(a3)), "4" ((long)(a4))		\
    1.65 -		: "memory" );					\
    1.66 -	(type)__res;						\
    1.67 -})
    1.68 -
    1.69 -static inline void cpuid(int op, unsigned int *eax, unsigned int *ebx,
    1.70 -                         unsigned int *ecx, unsigned int *edx)
    1.71 +
    1.72 +static __inline void __cpuid(uint32_t output[4], uint32_t op)
    1.73  {
    1.74    __asm__("cpuid"
    1.75 -          : "=a" (*eax),
    1.76 -            "=b" (*ebx),
    1.77 -            "=c" (*ecx),
    1.78 -            "=d" (*edx)
    1.79 +          : "=a" (output[0]),
    1.80 +            "=b" (output[1]),
    1.81 +            "=c" (output[2]),
    1.82 +            "=d" (output[3])
    1.83            : "0" (op));
    1.84  }
    1.85  
    1.86 -static __inline void __cpuid(uint32_t output[4], uint32_t op)
    1.87 -{
    1.88 -  cpuid(op, &output[0], &output[1], &output[2], &output[3]);
    1.89 -}
    1.90 -
    1.91  static __inline void __writemsr(uint32_t msr, uint64_t value)
    1.92  {
    1.93    uint32_t hi, lo;
    1.94 @@ -104,32 +77,8 @@ static __inline int
    1.95  HYPERVISOR_sched_op(PXENPCI_DEVICE_DATA xpdd, int cmd, void *arg)
    1.96  {
    1.97    return _hypercall2(int, sched_op, cmd, arg);
    1.98 -}
    1.99 -
   1.100 -static __inline int
   1.101 -HYPERVISOR_xen_version(PXENPCI_DEVICE_DATA xpdd, int cmd, void *arg)
   1.102 -{
   1.103 -  return _hypercall2(int, xen_version, cmd, arg);
   1.104 -}
   1.105 -
   1.106 -static __inline int
   1.107 -HYPERVISOR_grant_table_op(PXENPCI_DEVICE_DATA xpdd, int cmd, void *uop, unsigned int count)
   1.108 -{
   1.109 -	return _hypercall3(int, grant_table_op, cmd, uop, count);
   1.110 -}
   1.111 -
   1.112 -static __inline int
   1.113 -HYPERVISOR_mmu_update(PXENPCI_DEVICE_DATA xpdd, mmu_update_t *req, int count, int *success_count, domid_t domid)
   1.114 -{
   1.115 -	return _hypercall4(int, mmu_update, req, count, success_count, domid);
   1.116 -}
   1.117 -
   1.118 -static __inline int
   1.119 -HYPERVISOR_console_io(PXENPCI_DEVICE_DATA xpdd, int cmd, int count, char *string)
   1.120 -{
   1.121 -	return _hypercall3(int, console_io, cmd, count, string);
   1.122 -}
   1.123 -
   1.124 +}
   1.125 +
   1.126  static __inline int
   1.127  HYPERVISOR_hvm_op(PXENPCI_DEVICE_DATA xpdd, int op, struct xen_hvm_param *arg)
   1.128  {
   1.129 @@ -141,4 +90,4 @@ HYPERVISOR_event_channel_op(PXENPCI_DEVI
   1.130  {
   1.131  	return _hypercall2(int, event_channel_op, cmd, arg);
   1.132  }
   1.133 -
   1.134 +