diff options
-rw-r--r-- | drivers/lguest/page_tables.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c index c4b8eafda308..c9acafcab2aa 100644 --- a/drivers/lguest/page_tables.c +++ b/drivers/lguest/page_tables.c | |||
@@ -100,8 +100,7 @@ static unsigned long gpgd_addr(struct lg_cpu *cpu, unsigned long vaddr) | |||
100 | return cpu->lg->pgdirs[cpu->cpu_pgd].gpgdir + index * sizeof(pgd_t); | 100 | return cpu->lg->pgdirs[cpu->cpu_pgd].gpgdir + index * sizeof(pgd_t); |
101 | } | 101 | } |
102 | 102 | ||
103 | static unsigned long gpte_addr(struct lguest *lg, | 103 | static unsigned long gpte_addr(pgd_t gpgd, unsigned long vaddr) |
104 | pgd_t gpgd, unsigned long vaddr) | ||
105 | { | 104 | { |
106 | unsigned long gpage = pgd_pfn(gpgd) << PAGE_SHIFT; | 105 | unsigned long gpage = pgd_pfn(gpgd) << PAGE_SHIFT; |
107 | BUG_ON(!(pgd_flags(gpgd) & _PAGE_PRESENT)); | 106 | BUG_ON(!(pgd_flags(gpgd) & _PAGE_PRESENT)); |
@@ -235,7 +234,7 @@ int demand_page(struct lg_cpu *cpu, unsigned long vaddr, int errcode) | |||
235 | 234 | ||
236 | /* OK, now we look at the lower level in the Guest page table: keep its | 235 | /* OK, now we look at the lower level in the Guest page table: keep its |
237 | * address, because we might update it later. */ | 236 | * address, because we might update it later. */ |
238 | gpte_ptr = gpte_addr(lg, gpgd, vaddr); | 237 | gpte_ptr = gpte_addr(gpgd, vaddr); |
239 | gpte = lgread(lg, gpte_ptr, pte_t); | 238 | gpte = lgread(lg, gpte_ptr, pte_t); |
240 | 239 | ||
241 | /* If this page isn't in the Guest page tables, we can't page it in. */ | 240 | /* If this page isn't in the Guest page tables, we can't page it in. */ |
@@ -378,7 +377,7 @@ unsigned long guest_pa(struct lg_cpu *cpu, unsigned long vaddr) | |||
378 | if (!(pgd_flags(gpgd) & _PAGE_PRESENT)) | 377 | if (!(pgd_flags(gpgd) & _PAGE_PRESENT)) |
379 | kill_guest(cpu->lg, "Bad address %#lx", vaddr); | 378 | kill_guest(cpu->lg, "Bad address %#lx", vaddr); |
380 | 379 | ||
381 | gpte = lgread(cpu->lg, gpte_addr(cpu->lg, gpgd, vaddr), pte_t); | 380 | gpte = lgread(cpu->lg, gpte_addr(gpgd, vaddr), pte_t); |
382 | if (!(pte_flags(gpte) & _PAGE_PRESENT)) | 381 | if (!(pte_flags(gpte) & _PAGE_PRESENT)) |
383 | kill_guest(cpu->lg, "Bad address %#lx", vaddr); | 382 | kill_guest(cpu->lg, "Bad address %#lx", vaddr); |
384 | 383 | ||