2 * This file is part of the Palacios Virtual Machine Monitor developed
3 * by the V3VEE Project with funding from the United States National
4 * Science Foundation and the Department of Energy.
6 * The V3VEE Project is a joint project between Northwestern University
7 * and the University of New Mexico. You can find out more at
10 * Copyright (c) 2012, Kyle C. Hale <kh@u.northwestern.edu>
11 * Copyright (c) 2012, Peter Dinda <pdinda@northwestern.edu>
12 * Copyright (c) 2012, The V3VEE Project <http://www.v3vee.org>
13 * All rights reserved.
15 * Authors: Kyle C. Hale <kh@u.northwestern.edu>
16 * Peter Dinda <pdinda@northwestern.edu>
18 * This is free software. You are permitted to use,
19 * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
22 #ifndef __VMM_HOST_HYPERCALL_H__
23 #define __VMM_HOST_HYPERCALL_H__
25 #include <palacios/vmm.h>
27 /* palacios v3_vm_info struct is opaque to the host */
28 typedef void * host_vm_info_t;
30 typedef void * palacios_core_t;
33 // Notice that host implementation is itself
34 // palacios-specific at this point. It must be
35 // include the palacios-headers needed to understand
38 // The idea here is to make it possible to create something
39 // like a linux kernel module, that is compiled against
40 // palacios itself, but inserted after palacios.
41 // The module then make full use of palacios functions
42 // to manipulate guest state, as if it were a part of
46 #define GET_SET_REG_DECL(R) \
47 uint64_t (*get_##R)(palacios_core_t core); \
48 void (*set_##R)(palacios_core_t core, uint64_t val);
52 struct guest_accessors {
53 // You can read/write the GPRs
71 GET_SET_REG_DECL(rip);
72 GET_SET_REG_DECL(rflags)
77 GET_SET_REG_DECL(apic_tpr)
78 GET_SET_REG_DECL(efer)
80 int (*gva_to_hva)(palacios_core_t core, uint64_t gva, uint64_t *hva);
81 int (*gva_to_gpa)(palacios_core_t core, uint64_t gva, uint64_t *gpa);
82 int (*gpa_to_hva)(palacios_core_t core, uint64_t gpa, uint64_t *hva);
84 int (*read_gva)(palacios_core_t core, uint64_t addr,
86 int (*read_gpa)(palacios_core_t core, uint64_t addr,
89 int (*write_gva)(palacios_core_t core, uint64_t addr,
91 int (*write_gpa)(palacios_core_t core, uint64_t addr,
97 int v3_register_host_hypercall(host_vm_info_t * vm,
98 unsigned int hypercall_id,
99 int (*hypercall)(palacios_core_t core,
100 unsigned int hcall_id,
101 struct guest_accessors *accessors,
105 int v3_unregister_host_hypercall(host_vm_info_t *vm,
106 unsigned int hypercall_id);
110 #endif /* !__V3VEE__ */