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.
33  * The event might not fire if the client has subscribed to it in onchangeonly
34  * mode, hence the bool return type for control register write events.
35  */
36 bool hvm_monitor_cr(unsigned int index, unsigned long value,
37                     unsigned long old);
38 #define hvm_monitor_crX(cr, new, old) \
39                         hvm_monitor_cr(VM_EVENT_X86_##cr, new, old)
40 void hvm_monitor_msr(unsigned int msr, uint64_t value);
41 void hvm_monitor_descriptor_access(uint64_t exit_info,
42                                    uint64_t vmx_exit_qualification,
43                                    uint8_t descriptor, bool is_write);
44 int hvm_monitor_debug(unsigned long rip, enum hvm_monitor_debug_type type,
45                       unsigned long trap_type, unsigned long insn_length);
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 #endif /* __ASM_X86_HVM_MONITOR_H__ */
53 
54 /*
55  * Local variables:
56  * mode: C
57  * c-file-style: "BSD"
58  * c-basic-offset: 4
59  * tab-width: 4
60  * indent-tabs-mode: nil
61  * End:
62  */
63