Xen Test Framework
hypercall-x86_32.h
Go to the documentation of this file.
1#ifndef XTF_X86_32_HYPERCALL_H
2#define XTF_X86_32_HYPERCALL_H
3
4/*
5 * Hypercall primatives for 32bit
6 *
7 * Inputs: %ebx, %ecx, %edx, %esi, %edi, %ebp (arguments 1-6)
8 */
9
10#define _hypercall32_0(type, hcall) \
11 ({ \
12 long res; \
13 asm volatile ( \
14 "call hypercall_page + %c[offset]" \
15 : "=a" (res) \
16 : [offset] "i" (hcall * 32) \
17 : "memory" ); \
18 (type)res; \
19 })
20
21#define _hypercall32_1(type, hcall, a1) \
22 ({ \
23 long res, _a1 = (long)(a1); \
24 asm volatile ( \
25 "call hypercall_page + %c[offset]" \
26 : "=a" (res), "+b" (_a1) \
27 : [offset] "i" (hcall * 32) \
28 : "memory" ); \
29 (type)res; \
30 })
31
32#define _hypercall32_2(type, hcall, a1, a2) \
33 ({ \
34 long res, _a1 = (long)(a1), _a2 = (long)(a2); \
35 asm volatile ( \
36 "call hypercall_page + %c[offset]" \
37 : "=a" (res), "+b" (_a1), "+c" (_a2) \
38 : [offset] "i" (hcall * 32) \
39 : "memory" ); \
40 (type)res; \
41 })
42
43#define _hypercall32_3(type, hcall, a1, a2, a3) \
44 ({ \
45 long res, _a1 = (long)(a1), _a2 = (long)(a2), _a3 = (long)(a3); \
46 asm volatile ( \
47 "call hypercall_page + %c[offset]" \
48 : "=a" (res), "+b" (_a1), "+c" (_a2), "+d" (_a3) \
49 : [offset] "i" (hcall * 32) \
50 : "memory" ); \
51 (type)res; \
52 })
53
54#define _hypercall32_4(type, hcall, a1, a2, a3, a4) \
55 ({ \
56 long res, _a1 = (long)(a1), _a2 = (long)(a2), _a3 = (long)(a3), \
57 _a4 = (long)(a4); \
58 asm volatile ( \
59 "call hypercall_page + %c[offset]" \
60 : "=a" (res), "+b" (_a1), "+c" (_a2), "+d" (_a3), \
61 "+S" (_a4) \
62 : [offset] "i" (hcall * 32) \
63 : "memory" ); \
64 (type)res; \
65 })
66
67#define _hypercall32_5(type, hcall, a1, a2, a3, a4, a5) \
68 ({ \
69 long res, _a1 = (long)(a1), _a2 = (long)(a2), _a3 = (long)(a3), \
70 _a4 = (long)(a4), _a5 = (long)(a5); \
71 asm volatile ( \
72 "call hypercall_page + %c[offset]" \
73 : "=a" (res), "+b" (_a1), "+c" (_a2), "+d" (_a3), \
74 "+S" (_a4), "+D" (_a5) \
75 : [offset] "i" (hcall * 32) \
76 : "memory" ); \
77 (type)res; \
78 })
79
80#endif /* XTF_X86_32_HYPERCALL_H */
81
82/*
83 * Local variables:
84 * mode: C
85 * c-file-style: "BSD"
86 * c-basic-offset: 4
87 * tab-width: 4
88 * indent-tabs-mode: nil
89 * End:
90 */