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.


Guest mem gpa/gva memset functions
[palacios.git] / palacios / include / palacios / vm_guest_mem.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) 2008, Jack Lange <jarusl@cs.northwestern.edu> 
11  * Copyright (c) 2008, The V3VEE Project <http://www.v3vee.org> 
12  * All rights reserved.
13  *
14  * Author: Jack Lange <jarusl@cs.northwestern.edu>
15  *
16  * This is free software.  You are permitted to use,
17  * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
18  */
19
20 #ifndef __VM_GUEST_MEM_H
21 #define __VM_GUEST_MEM_H
22
23
24 #ifdef __V3VEE__
25
26 #include <palacios/vm_guest.h>
27 #include <palacios/vmm_mem.h>
28
29
30 /* These functions are ordered such that they can only call the functions defined in a lower order group */
31 /* This is to avoid infinite lookup loops */
32
33 /**********************************/
34 /* GROUP 0                        */
35 /**********************************/
36
37 /* Fundamental converters */
38 // Call out to OS
39 int v3_hva_to_hpa(addr_t host_va, addr_t * host_pa);
40 int v3_hpa_to_hva(addr_t host_pa, addr_t * host_va);
41
42 // guest_pa -> (shadow map) -> host_pa
43 int v3_gpa_to_hpa(struct guest_info * guest_info, addr_t guest_pa, addr_t * host_pa);
44
45 /* !! Currently not implemented !! */
46 // host_pa -> (shadow_map) -> guest_pa
47 int v3_hpa_to_gpa(struct guest_info * guest_info, addr_t host_pa, addr_t * guest_pa);
48
49
50 /**********************************/
51 /* GROUP 1                        */
52 /**********************************/
53
54
55 /* !! Currently not implemented !! */
56 // host_va -> host_pa -> guest_pa
57 int v3_hva_to_gpa(struct guest_info * guest_info, addr_t host_va, addr_t * guest_pa);
58
59
60 // guest_pa -> host_pa -> host_va
61 int v3_gpa_to_hva(struct guest_info * guest_info, addr_t guest_pa, addr_t * host_va);
62
63
64 // Look up the address in the guests page tables.. This can cause multiple calls that translate
65 //     ------------------------------------------------
66 //     |                                              |
67 //     -->   guest_pa -> host_pa -> host_va ->   (read table) --> guest_pa
68 int v3_gva_to_gpa(struct guest_info * guest_info, addr_t guest_va, addr_t * guest_pa);
69
70
71
72 /* !! Currently not implemented !! */
73 //   A page table walker in the guest's address space
74 //     ------------------------------------------------
75 //     |                                              |
76 //     -->   guest_pa -> host_pa -> host_va ->   (read table) --> guest_va
77 int v3_gpa_to_gva(struct guest_info * guest_info, addr_t guest_pa, addr_t * guest_va);
78
79
80
81 /**********************************/
82 /* GROUP 2                        */
83 /**********************************/
84 // guest_va -> guest_pa -> host_pa
85 int v3_gva_to_hpa(struct guest_info * guest_info, addr_t guest_va, addr_t * host_pa);
86
87
88 /* !! Currently not implemented !! */
89 // host_pa -> guest_pa -> guest_va
90 int v3_hpa_to_gva(struct guest_info * guest_info, addr_t host_pa, addr_t * guest_va);
91
92 // guest_va -> guest_pa -> host_pa -> host_va
93 int v3_gva_to_hva(struct guest_info * guest_info, addr_t guest_va, addr_t * host_va);
94
95
96 /* !! Currently not implemented !! */
97 // host_va -> host_pa -> guest_pa -> guest_va
98 int v3_hva_to_gva(struct guest_info * guest_info, addr_t host_va, addr_t  * guest_va);
99
100
101
102
103
104
105
106
107
108 int v3_read_gva_memory(struct guest_info * guest_info, addr_t guest_va, int count, uint8_t * dest);
109 int v3_read_gpa_memory(struct guest_info * guest_info, addr_t guest_pa, int count, uint8_t * dest);
110 int v3_write_gpa_memory(struct guest_info * guest_info, addr_t guest_pa, int count, uint8_t * src);
111 int v3_write_gva_memory(struct guest_info * guest_info, addr_t guest_va, int count, uint8_t * src);
112 int v3_set_gpa_memory(struct guest_info * guest_info, addr_t guest_pa, int count, uint8_t src);
113 int v3_set_gva_memory(struct guest_info * guest_info, addr_t guest_va, int count, uint8_t src);
114
115
116 #endif // ! __V3VEE__
117
118
119 #endif