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) 2008, Jack Lange <jarusl@cs.northwestern.edu>
11 * Copyright (c) 2008, The V3VEE Project <http://www.v3vee.org>
12 * All rights reserved.
14 * Author: Jack Lange <jarusl@cs.northwestern.edu>
16 * This is free software. You are permitted to use,
17 * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
20 #ifndef __VM_GUEST_MEM_H
21 #define __VM_GUEST_MEM_H
26 #include <palacios/vm_guest.h>
27 #include <palacios/vmm_mem.h>
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 */
33 /**********************************/
35 /**********************************/
37 /* Fundamental converters */
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);
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);
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);
50 /**********************************/
52 /**********************************/
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);
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);
64 // Look up the address in the guests page tables.. This can cause multiple calls that translate
65 // ------------------------------------------------
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);
72 /* !! Currently not implemented !! */
73 // A page table walker in the guest's address space
74 // ------------------------------------------------
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);
81 /**********************************/
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);
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);
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);
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);
108 int v3_read_gva_memory(struct guest_info * guest_info, addr_t guest_va, int count, uchar_t * dest);
109 int v3_read_gpa_memory(struct guest_info * guest_info, addr_t guest_pa, int count, uchar_t * dest);
110 int v3_write_gpa_memory(struct guest_info * guest_info, addr_t guest_pa, int count, uchar_t * src);
111 // TODO int write_guest_va_memory(struct guest_info * guest_info, addr_t guest_va, int count, char * src);
114 #endif // ! __V3VEE__