Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


611e7005053ed6fa2b2ed12f8c83fbb6374919cf
[palacios.git] / palacios / include / interfaces / vmm_host_hypercall.h
1 /* 
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.  
5  *
6  * The V3VEE Project is a joint project between Northwestern University
7  * and the University of New Mexico.  You can find out more at 
8  * http://www.v3vee.org
9  *
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.
14  *
15  * Authors: Kyle C. Hale <kh@u.northwestern.edu>
16  *          Peter Dinda <pdinda@northwestern.edu>
17  *
18  * This is free software.  You are permitted to use,
19  * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
20  */
21
22 #ifndef __VMM_HOST_HYPERCALL_H__
23 #define __VMM_HOST_HYPERCALL_H__
24
25 #include <palacios/vmm.h>
26
27 /* palacios v3_vm_info struct is opaque to the host */
28 typedef void * host_vm_info_t;
29
30 typedef void * palacios_core_t;
31
32
33 // Notice that host implementation is itself
34 // palacios-specific at this point.  It must be
35 // include the palacios-headers needed to understand
36 // a guest_info, etc.
37 //
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
43 // palacios
44 //
45
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); 
49
50
51
52 struct guest_accessors {
53   // You can read/write the GPRs
54   GET_SET_REG_DECL(rax)
55   GET_SET_REG_DECL(rbx)
56   GET_SET_REG_DECL(rcx)
57   GET_SET_REG_DECL(rdx)
58   GET_SET_REG_DECL(rsi)
59   GET_SET_REG_DECL(rdi)
60   GET_SET_REG_DECL(rbp)
61   GET_SET_REG_DECL(rsp)
62   GET_SET_REG_DECL(r8)
63   GET_SET_REG_DECL(r9)
64   GET_SET_REG_DECL(r10)
65   GET_SET_REG_DECL(r11)
66   GET_SET_REG_DECL(r12)
67   GET_SET_REG_DECL(r13)
68   GET_SET_REG_DECL(r14)
69   GET_SET_REG_DECL(r15)
70   
71   GET_SET_REG_DECL(rip);
72   GET_SET_REG_DECL(rflags)
73   GET_SET_REG_DECL(cr0)
74   GET_SET_REG_DECL(cr2)
75   GET_SET_REG_DECL(cr3)
76   GET_SET_REG_DECL(cr4)
77   GET_SET_REG_DECL(cr8)
78   GET_SET_REG_DECL(efer)
79
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);
83
84   int (*read_gva)(palacios_core_t core, uint64_t addr,
85                   int n, void *dest);
86   int (*read_gpa)(palacios_core_t core, uint64_t addr,
87                   int n, void *dest);
88   
89   int (*write_gva)(palacios_core_t core, uint64_t addr,
90                    int n, void *src);
91   int  (*write_gpa)(palacios_core_t core, uint64_t addr,
92                     int n, void *src);
93 };
94
95
96
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,
102                                                 void *priv_data),
103                                void *priv_data);
104
105 int v3_unregister_host_hypercall(host_vm_info_t *vm,
106                                  unsigned int hypercall_id);
107
108 #ifdef __V3VEE__
109
110 #endif /* !__V3VEE__ */
111 #endif
112