]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
core: Introduce and apply guest_paging_structures
authorJan Kiszka <jan.kiszka@siemens.com>
Thu, 6 Feb 2014 17:30:07 +0000 (18:30 +0100)
committerJan Kiszka <jan.kiszka@siemens.com>
Fri, 7 Feb 2014 10:06:47 +0000 (11:06 +0100)
Just like paging_structures describes a host-side page table hierarchy
via its paging mode and the root table pointer, guest_paging_structures
shall now provide information about the guest-side page table. The only
but important difference is that the reference to the root table is a
guest-physical address. Therefore, to avoid mixing up with host-side
table, we use different types.

This abstraction will help passing a guest page table reference around.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
hypervisor/arch/x86/mmio.c
hypervisor/include/jailhouse/paging.h
hypervisor/paging.c

index bdeb22ddbe3b52d39b29cc5348d1f2aa5ca94c62..77b7db8de995659551c33bf27435edb36fd1315d 100644 (file)
@@ -31,12 +31,14 @@ struct sib {
 static u8 *map_code_page(struct per_cpu *cpu_data, unsigned long pc,
                         unsigned long page_table_addr, u8 *current_page)
 {
+       struct guest_paging_structures pg_structs = {
+               x86_64_paging, page_table_addr
+       };
        /* If page offset is 0, previous pc was pointing to a different page,
         * and we have to map a new one now. */
        if (current_page && ((pc & ~PAGE_MASK) != 0))
                return current_page;
-       return page_map_get_guest_page(cpu_data, x86_64_paging,
-                                      page_table_addr, pc,
+       return page_map_get_guest_page(cpu_data, &pg_structs, pc,
                                       PAGE_READONLY_FLAGS);
 }
 
index e8ec2fc34574f7ffe472a772cb8bffc4ce2f008c..e3e62fd50620879522bbba578ebf365d3d9b5343 100644 (file)
@@ -78,6 +78,11 @@ struct paging_structures {
        page_table_t root_table;
 };
 
+struct guest_paging_structures {
+       const struct paging *root_paging;
+       unsigned long root_table_gphys;
+};
+
 #include <asm/paging_modes.h>
 
 extern struct page_pool mem_pool;
@@ -114,8 +119,7 @@ int page_map_destroy(const struct paging_structures *pg_structs,
                     enum page_map_coherent coherent);
 
 void *page_map_get_guest_page(struct per_cpu *cpu_data,
-                             const struct paging *paging,
-                             unsigned long page_table_gphys,
+                             const struct guest_paging_structures *pg_structs,
                              unsigned long virt, unsigned long flags);
 
 int paging_init(void);
index d9e18225919b476ca6eff8621e7587441447c954..779395954a6c85ed27b113716a3ec1cac891d4e0 100644 (file)
@@ -276,10 +276,11 @@ int page_map_destroy(const struct paging_structures *pg_structs,
 }
 
 void *page_map_get_guest_page(struct per_cpu *cpu_data,
-                             const struct paging *paging,
-                             unsigned long page_table_gphys,
+                             const struct guest_paging_structures *pg_structs,
                              unsigned long virt, unsigned long flags)
 {
+       unsigned long page_table_gphys = pg_structs->root_table_gphys;
+       const struct paging *paging = pg_structs->root_paging;
        unsigned long page_virt, phys, gphys;
        pt_entry_t pte;
        int err;