1
2#ifndef _ASM_X86_ACRN_H
3#define _ASM_X86_ACRN_H
4
5
6
7
8
9#define ACRN_CPUID_FEATURES 0x40000001
10
11#define ACRN_FEATURE_PRIVILEGED_VM BIT(0)
12
13void acrn_setup_intr_handler(void (*handler)(void));
14void acrn_remove_intr_handler(void);
15
16static inline u32 acrn_cpuid_base(void)
17{
18 if (boot_cpu_has(X86_FEATURE_HYPERVISOR))
19 return hypervisor_cpuid_base("ACRNACRNACRN", 0);
20
21 return 0;
22}
23
24
25
26
27
28
29
30
31
32
33
34
35
36static inline long acrn_hypercall0(unsigned long hcall_id)
37{
38 long result;
39
40 asm volatile("movl %1, %%r8d\n\t"
41 "vmcall\n\t"
42 : "=a" (result)
43 : "g" (hcall_id)
44 : "r8", "memory");
45
46 return result;
47}
48
49static inline long acrn_hypercall1(unsigned long hcall_id,
50 unsigned long param1)
51{
52 long result;
53
54 asm volatile("movl %1, %%r8d\n\t"
55 "vmcall\n\t"
56 : "=a" (result)
57 : "g" (hcall_id), "D" (param1)
58 : "r8", "memory");
59
60 return result;
61}
62
63static inline long acrn_hypercall2(unsigned long hcall_id,
64 unsigned long param1,
65 unsigned long param2)
66{
67 long result;
68
69 asm volatile("movl %1, %%r8d\n\t"
70 "vmcall\n\t"
71 : "=a" (result)
72 : "g" (hcall_id), "D" (param1), "S" (param2)
73 : "r8", "memory");
74
75 return result;
76}
77
78#endif
79