1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * include/asm-x86/hvm/monitor.h 4 * 5 * Arch-specific hardware virtual machine monitor abstractions. 6 */ 7 8 #ifndef __ASM_X86_HVM_MONITOR_H__ 9 #define __ASM_X86_HVM_MONITOR_H__ 10 11 #include <public/vm_event.h> 12 13 enum hvm_monitor_debug_type 14 { 15 HVM_MONITOR_SOFTWARE_BREAKPOINT, 16 HVM_MONITOR_SINGLESTEP_BREAKPOINT, 17 HVM_MONITOR_DEBUG_EXCEPTION, 18 }; 19 20 /* 21 * Called for current VCPU on crX/MSR changes by guest. Bool return signals 22 * whether emulation should be postponed. 23 */ 24 bool hvm_monitor_cr(unsigned int index, unsigned long value, 25 unsigned long old); 26 #define hvm_monitor_crX(cr, new, old) \ 27 hvm_monitor_cr(VM_EVENT_X86_##cr, new, old) 28 bool hvm_monitor_msr(unsigned int msr, uint64_t new_value, uint64_t old_value); 29 void hvm_monitor_descriptor_access(uint64_t exit_info, 30 uint64_t vmx_exit_qualification, 31 uint8_t descriptor, bool is_write); 32 int hvm_monitor_debug(unsigned long rip, enum hvm_monitor_debug_type type, 33 unsigned int trap_type, unsigned int insn_length, 34 unsigned int pending_dbg); 35 int hvm_monitor_cpuid(unsigned long insn_length, unsigned int leaf, 36 unsigned int subleaf); 37 void hvm_monitor_interrupt(unsigned int vector, unsigned int type, 38 unsigned int err, uint64_t cr2); 39 bool hvm_monitor_emul_unimplemented(void); 40 41 bool hvm_monitor_check_p2m(unsigned long gla, gfn_t gfn, uint32_t pfec, 42 uint16_t kind); 43 int hvm_monitor_vmexit(unsigned long exit_reason, 44 unsigned long exit_qualification); 45 46 int hvm_monitor_io(unsigned int port, unsigned int bytes, 47 bool in, bool str); 48 49 #endif /* __ASM_X86_HVM_MONITOR_H__ */ 50 51 /* 52 * Local variables: 53 * mode: C 54 * c-file-style: "BSD" 55 * c-basic-offset: 4 56 * tab-width: 4 57 * indent-tabs-mode: nil 58 * End: 59 */ 60