Changeset View
Changeset View
Standalone View
Standalone View
head/sys/amd64/include/vmm_instruction_emul.h
Show First 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | int vm_gla2gpa(struct vm *vm, int vcpuid, struct vm_guest_paging *paging, | ||||
uint64_t gla, int prot, uint64_t *gpa, int *is_fault); | uint64_t gla, int prot, uint64_t *gpa, int *is_fault); | ||||
/* | /* | ||||
* Like vm_gla2gpa, but no exceptions are injected into the guest and | * Like vm_gla2gpa, but no exceptions are injected into the guest and | ||||
* PTEs are not changed. | * PTEs are not changed. | ||||
*/ | */ | ||||
int vm_gla2gpa_nofault(struct vm *vm, int vcpuid, struct vm_guest_paging *paging, | int vm_gla2gpa_nofault(struct vm *vm, int vcpuid, struct vm_guest_paging *paging, | ||||
uint64_t gla, int prot, uint64_t *gpa, int *is_fault); | uint64_t gla, int prot, uint64_t *gpa, int *is_fault); | ||||
#endif /* _KERNEL */ | |||||
void vie_init(struct vie *vie, const char *inst_bytes, int inst_length); | void vie_init(struct vie *vie, const char *inst_bytes, int inst_length); | ||||
/* | /* | ||||
* Decode the instruction fetched into 'vie' so it can be emulated. | * Decode the instruction fetched into 'vie' so it can be emulated. | ||||
* | * | ||||
* 'gla' is the guest linear address provided by the hardware assist | * 'gla' is the guest linear address provided by the hardware assist | ||||
* that caused the nested page table fault. It is used to verify that | * that caused the nested page table fault. It is used to verify that | ||||
* the software instruction decoding is in agreement with the hardware. | * the software instruction decoding is in agreement with the hardware. | ||||
* | * | ||||
* Some hardware assists do not provide the 'gla' to the hypervisor. | * Some hardware assists do not provide the 'gla' to the hypervisor. | ||||
* To skip the 'gla' verification for this or any other reason pass | * To skip the 'gla' verification for this or any other reason pass | ||||
* in VIE_INVALID_GLA instead. | * in VIE_INVALID_GLA instead. | ||||
*/ | */ | ||||
#ifdef _KERNEL | |||||
#define VIE_INVALID_GLA (1UL << 63) /* a non-canonical address */ | #define VIE_INVALID_GLA (1UL << 63) /* a non-canonical address */ | ||||
int vmm_decode_instruction(struct vm *vm, int cpuid, uint64_t gla, | int vmm_decode_instruction(struct vm *vm, int cpuid, uint64_t gla, | ||||
enum vm_cpu_mode cpu_mode, int csd, struct vie *vie); | enum vm_cpu_mode cpu_mode, int csd, struct vie *vie); | ||||
#else /* !_KERNEL */ | |||||
/* | |||||
* Permit instruction decoding logic to be compiled outside of the kernel for | |||||
* rapid iteration and validation. No GLA validation is performed, obviously. | |||||
*/ | |||||
int vmm_decode_instruction(enum vm_cpu_mode cpu_mode, int csd, | |||||
struct vie *vie); | |||||
#endif /* _KERNEL */ | #endif /* _KERNEL */ | ||||
#endif /* _VMM_INSTRUCTION_EMUL_H_ */ | #endif /* _VMM_INSTRUCTION_EMUL_H_ */ |