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
23 #include <palacios/vm_guest.h>
24 #include <palacios/vmm_mem.h>
27 /* These functions are ordered such that they can only call the functions defined in a lower order group */
28 /* This is to avoid infinite lookup loops */
30 /**********************************/
32 /**********************************/
34 /* Fundamental converters */
36 int host_va_to_host_pa(addr_t host_va, addr_t * host_pa);
37 int host_pa_to_host_va(addr_t host_pa, addr_t * host_va);
39 // guest_pa -> (shadow map) -> host_pa
40 int guest_pa_to_host_pa(struct guest_info * guest_info, addr_t guest_pa, addr_t * host_pa);
42 /* !! Currently not implemented !! */
43 // host_pa -> (shadow_map) -> guest_pa
44 int host_pa_to_guest_pa(struct guest_info * guest_info, addr_t host_pa, addr_t * guest_pa);
47 /**********************************/
49 /**********************************/
52 /* !! Currently not implemented !! */
53 // host_va -> host_pa -> guest_pa
54 int host_va_to_guest_pa(struct guest_info * guest_info, addr_t host_va, addr_t * guest_pa);
57 // guest_pa -> host_pa -> host_va
58 int guest_pa_to_host_va(struct guest_info * guest_info, addr_t guest_pa, addr_t * host_va);
61 // Look up the address in the guests page tables.. This can cause multiple calls that translate
62 // ------------------------------------------------
64 // --> guest_pa -> host_pa -> host_va -> (read table) --> guest_pa
65 int guest_va_to_guest_pa(struct guest_info * guest_info, addr_t guest_va, addr_t * guest_pa);
69 /* !! Currently not implemented !! */
70 // A page table walker in the guest's address space
71 // ------------------------------------------------
73 // --> guest_pa -> host_pa -> host_va -> (read table) --> guest_va
74 int guest_pa_to_guest_va(struct guest_info * guest_info, addr_t guest_pa, addr_t * guest_va);
78 /**********************************/
80 /**********************************/
81 // guest_va -> guest_pa -> host_pa
82 int guest_va_to_host_pa(struct guest_info * guest_info, addr_t guest_va, addr_t * host_pa);
85 /* !! Currently not implemented !! */
86 // host_pa -> guest_pa -> guest_va
87 int host_pa_to_guest_va(struct guest_info * guest_info, addr_t host_pa, addr_t * guest_va);
89 // guest_va -> guest_pa -> host_pa -> host_va
90 int guest_va_to_host_va(struct guest_info * guest_info, addr_t guest_va, addr_t * host_va);
93 /* !! Currently not implemented !! */
94 // host_va -> host_pa -> guest_pa -> guest_va
95 int host_va_to_guest_va(struct guest_info * guest_info, addr_t host_va, addr_t * guest_va);
105 int read_guest_va_memory(struct guest_info * guest_info, addr_t guest_va, int count, char * dest);
106 int read_guest_pa_memory(struct guest_info * guest_info, addr_t guest_pa, int count, char * dest);
107 int write_guest_pa_memory(struct guest_info * guest_info, addr_t guest_pa, int count, char * src);
108 // TODO int write_guest_va_memory(struct guest_info * guest_info, addr_t guest_va, int count, char * src);