1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#ifndef _VMWGFX_MSG_H
20#define _VMWGFX_MSG_H
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43#define VMW_PORT(cmd, in_ebx, in_si, in_di, \
44 port_num, magic, \
45 eax, ebx, ecx, edx, si, di) \
46({ \
47 asm volatile ("inl %%dx, %%eax;" : \
48 "=a"(eax), \
49 "=b"(ebx), \
50 "=c"(ecx), \
51 "=d"(edx), \
52 "=S"(si), \
53 "=D"(di) : \
54 "a"(magic), \
55 "b"(in_ebx), \
56 "c"(cmd), \
57 "d"(port_num), \
58 "S"(in_si), \
59 "D"(in_di) : \
60 "memory"); \
61})
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85#ifdef __x86_64__
86
87#define VMW_PORT_HB_OUT(cmd, in_ecx, in_si, in_di, \
88 port_num, magic, bp, \
89 eax, ebx, ecx, edx, si, di) \
90({ \
91 asm volatile ("push %%rbp;" \
92 "mov %12, %%rbp;" \
93 "rep outsb;" \
94 "pop %%rbp;" : \
95 "=a"(eax), \
96 "=b"(ebx), \
97 "=c"(ecx), \
98 "=d"(edx), \
99 "=S"(si), \
100 "=D"(di) : \
101 "a"(magic), \
102 "b"(cmd), \
103 "c"(in_ecx), \
104 "d"(port_num), \
105 "S"(in_si), \
106 "D"(in_di), \
107 "r"(bp) : \
108 "memory", "cc"); \
109})
110
111
112#define VMW_PORT_HB_IN(cmd, in_ecx, in_si, in_di, \
113 port_num, magic, bp, \
114 eax, ebx, ecx, edx, si, di) \
115({ \
116 asm volatile ("push %%rbp;" \
117 "mov %12, %%rbp;" \
118 "rep insb;" \
119 "pop %%rbp" : \
120 "=a"(eax), \
121 "=b"(ebx), \
122 "=c"(ecx), \
123 "=d"(edx), \
124 "=S"(si), \
125 "=D"(di) : \
126 "a"(magic), \
127 "b"(cmd), \
128 "c"(in_ecx), \
129 "d"(port_num), \
130 "S"(in_si), \
131 "D"(in_di), \
132 "r"(bp) : \
133 "memory", "cc"); \
134})
135
136#else
137
138
139
140
141#define VMW_PORT_HB_OUT(cmd, in_ecx, in_si, in_di, \
142 port_num, magic, bp, \
143 eax, ebx, ecx, edx, si, di) \
144({ \
145 asm volatile ("push %%ebp;" \
146 "mov %12, %%ebp;" \
147 "rep outsb;" \
148 "pop %%ebp;" : \
149 "=a"(eax), \
150 "=b"(ebx), \
151 "=c"(ecx), \
152 "=d"(edx), \
153 "=S"(si), \
154 "=D"(di) : \
155 "a"(magic), \
156 "b"(cmd), \
157 "c"(in_ecx), \
158 "d"(port_num), \
159 "S"(in_si), \
160 "D"(in_di), \
161 "m"(bp) : \
162 "memory", "cc"); \
163})
164
165
166#define VMW_PORT_HB_IN(cmd, in_ecx, in_si, in_di, \
167 port_num, magic, bp, \
168 eax, ebx, ecx, edx, si, di) \
169({ \
170 asm volatile ("push %%ebp;" \
171 "mov %12, %%ebp;" \
172 "rep insb;" \
173 "pop %%ebp" : \
174 "=a"(eax), \
175 "=b"(ebx), \
176 "=c"(ecx), \
177 "=d"(edx), \
178 "=S"(si), \
179 "=D"(di) : \
180 "a"(magic), \
181 "b"(cmd), \
182 "c"(in_ecx), \
183 "d"(port_num), \
184 "S"(in_si), \
185 "D"(in_di), \
186 "m"(bp) : \
187 "memory", "cc"); \
188})
189#endif
190
191#endif
192