1 /*
2  * vm_event.h: architecture specific vm_event handling routines
3  *
4  * Copyright (c) 2015 Tamas K Lengyel (tamas@tklengyel.com)
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_VM_EVENT_H__
20 #define __ASM_X86_VM_EVENT_H__
21 
22 #include <xen/sched.h>
23 #include <public/vm_event.h>
24 
25 /*
26  * Should we emulate the next matching instruction on VCPU resume
27  * after a vm_event?
28  */
29 struct arch_vm_event {
30     uint32_t emulate_flags;
31     union {
32         struct vm_event_emul_read_data read;
33         struct vm_event_emul_insn_data insn;
34     } emul;
35     struct monitor_write_data write_data;
36     struct vm_event_regs_x86 gprs;
37     bool set_gprs;
38     /* A sync vm_event has been sent and we're not done handling it. */
39     bool sync_event;
40     /* Send mem access events from emulator */
41     bool send_event;
42 };
43 
44 int vm_event_init_domain(struct domain *d);
45 
46 void vm_event_cleanup_domain(struct domain *d);
47 
48 void vm_event_toggle_singlestep(struct domain *d, struct vcpu *v,
49                                 vm_event_response_t *rsp);
50 
51 void vm_event_register_write_resume(struct vcpu *v, vm_event_response_t *rsp);
52 
53 void vm_event_emulate_check(struct vcpu *v, vm_event_response_t *rsp);
54 
55 void vm_event_sync_event(struct vcpu *v, bool value);
56 
57 #endif /* __ASM_X86_VM_EVENT_H__ */
58