1 /*
2  * include/asm-x86/hvm/monitor.h
3  *
4  * Arch-specific hardware virtual machine monitor abstractions.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms and conditions of the GNU General Public License,
8  * version 2, as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along with
16  * this program; If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef __ASM_X86_HVM_MONITOR_H__
20 #define __ASM_X86_HVM_MONITOR_H__
21 
22 #include <public/vm_event.h>
23 
24 enum hvm_monitor_debug_type
25 {
26     HVM_MONITOR_SOFTWARE_BREAKPOINT,
27     HVM_MONITOR_SINGLESTEP_BREAKPOINT,
28     HVM_MONITOR_DEBUG_EXCEPTION,
29 };
30 
31 /*
32  * Called for current VCPU on crX/MSR changes by guest. Bool return signals
33  * whether emulation should be postponed.
34  */
35 bool hvm_monitor_cr(unsigned int index, unsigned long value,
36                     unsigned long old);
37 #define hvm_monitor_crX(cr, new, old) \
38                         hvm_monitor_cr(VM_EVENT_X86_##cr, new, old)
39 bool hvm_monitor_msr(unsigned int msr, uint64_t value, uint64_t old_value);
40 void hvm_monitor_descriptor_access(uint64_t exit_info,
41                                    uint64_t vmx_exit_qualification,
42                                    uint8_t descriptor, bool is_write);
43 int hvm_monitor_debug(unsigned long rip, enum hvm_monitor_debug_type type,
44                       unsigned int trap_type, unsigned int insn_length,
45                       unsigned int pending_dbg);
46 int hvm_monitor_cpuid(unsigned long insn_length, unsigned int leaf,
47                       unsigned int subleaf);
48 void hvm_monitor_interrupt(unsigned int vector, unsigned int type,
49                            unsigned int err, uint64_t cr2);
50 bool hvm_monitor_emul_unimplemented(void);
51 
52 bool hvm_monitor_check_p2m(unsigned long gla, gfn_t gfn, uint32_t pfec,
53                            uint16_t kind);
54 
55 #endif /* __ASM_X86_HVM_MONITOR_H__ */
56 
57 /*
58  * Local variables:
59  * mode: C
60  * c-file-style: "BSD"
61  * c-basic-offset: 4
62  * tab-width: 4
63  * indent-tabs-mode: nil
64  * End:
65  */
66