0001
0002 #ifndef _ASM_X86_ACRN_H
0003 #define _ASM_X86_ACRN_H
0004
0005
0006
0007
0008
0009 #define ACRN_CPUID_FEATURES 0x40000001
0010
0011 #define ACRN_FEATURE_PRIVILEGED_VM BIT(0)
0012
0013 void acrn_setup_intr_handler(void (*handler)(void));
0014 void acrn_remove_intr_handler(void);
0015
0016 static inline u32 acrn_cpuid_base(void)
0017 {
0018 if (boot_cpu_has(X86_FEATURE_HYPERVISOR))
0019 return hypervisor_cpuid_base("ACRNACRNACRN", 0);
0020
0021 return 0;
0022 }
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 static inline long acrn_hypercall0(unsigned long hcall_id)
0037 {
0038 long result;
0039
0040 asm volatile("movl %1, %%r8d\n\t"
0041 "vmcall\n\t"
0042 : "=a" (result)
0043 : "g" (hcall_id)
0044 : "r8", "memory");
0045
0046 return result;
0047 }
0048
0049 static inline long acrn_hypercall1(unsigned long hcall_id,
0050 unsigned long param1)
0051 {
0052 long result;
0053
0054 asm volatile("movl %1, %%r8d\n\t"
0055 "vmcall\n\t"
0056 : "=a" (result)
0057 : "g" (hcall_id), "D" (param1)
0058 : "r8", "memory");
0059
0060 return result;
0061 }
0062
0063 static inline long acrn_hypercall2(unsigned long hcall_id,
0064 unsigned long param1,
0065 unsigned long param2)
0066 {
0067 long result;
0068
0069 asm volatile("movl %1, %%r8d\n\t"
0070 "vmcall\n\t"
0071 : "=a" (result)
0072 : "g" (hcall_id), "D" (param1), "S" (param2)
0073 : "r8", "memory");
0074
0075 return result;
0076 }
0077
0078 #endif