diff options
Diffstat (limited to 'drivers/lguest')
-rw-r--r-- | drivers/lguest/lg.h | 6 | ||||
-rw-r--r-- | drivers/lguest/page_tables.c | 18 |
2 files changed, 12 insertions, 12 deletions
diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h index dc15b88208ff..f921684dbe5c 100644 --- a/drivers/lguest/lg.h +++ b/drivers/lguest/lg.h | |||
@@ -30,7 +30,7 @@ struct lguest_dma_info | |||
30 | 30 | ||
31 | struct pgdir | 31 | struct pgdir |
32 | { | 32 | { |
33 | unsigned long cr3; | 33 | unsigned long gpgdir; |
34 | pgd_t *pgdir; | 34 | pgd_t *pgdir; |
35 | }; | 35 | }; |
36 | 36 | ||
@@ -154,10 +154,10 @@ void copy_gdt_tls(const struct lguest *lg, struct desc_struct *gdt); | |||
154 | int init_guest_pagetable(struct lguest *lg, unsigned long pgtable); | 154 | int init_guest_pagetable(struct lguest *lg, unsigned long pgtable); |
155 | void free_guest_pagetable(struct lguest *lg); | 155 | void free_guest_pagetable(struct lguest *lg); |
156 | void guest_new_pagetable(struct lguest *lg, unsigned long pgtable); | 156 | void guest_new_pagetable(struct lguest *lg, unsigned long pgtable); |
157 | void guest_set_pmd(struct lguest *lg, unsigned long cr3, u32 i); | 157 | void guest_set_pmd(struct lguest *lg, unsigned long gpgdir, u32 i); |
158 | void guest_pagetable_clear_all(struct lguest *lg); | 158 | void guest_pagetable_clear_all(struct lguest *lg); |
159 | void guest_pagetable_flush_user(struct lguest *lg); | 159 | void guest_pagetable_flush_user(struct lguest *lg); |
160 | void guest_set_pte(struct lguest *lg, unsigned long cr3, | 160 | void guest_set_pte(struct lguest *lg, unsigned long gpgdir, |
161 | unsigned long vaddr, pte_t val); | 161 | unsigned long vaddr, pte_t val); |
162 | void map_switcher_in_guest(struct lguest *lg, struct lguest_pages *pages); | 162 | void map_switcher_in_guest(struct lguest *lg, struct lguest_pages *pages); |
163 | int demand_page(struct lguest *info, unsigned long cr2, int errcode); | 163 | int demand_page(struct lguest *info, unsigned long cr2, int errcode); |
diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c index 5c4c53f38cf4..bfe3650b28d6 100644 --- a/drivers/lguest/page_tables.c +++ b/drivers/lguest/page_tables.c | |||
@@ -96,7 +96,7 @@ static pte_t *spte_addr(struct lguest *lg, pgd_t spgd, unsigned long vaddr) | |||
96 | static unsigned long gpgd_addr(struct lguest *lg, unsigned long vaddr) | 96 | static unsigned long gpgd_addr(struct lguest *lg, unsigned long vaddr) |
97 | { | 97 | { |
98 | unsigned int index = vaddr >> (PGDIR_SHIFT); | 98 | unsigned int index = vaddr >> (PGDIR_SHIFT); |
99 | return lg->pgdirs[lg->pgdidx].cr3 + index * sizeof(pgd_t); | 99 | return lg->pgdirs[lg->pgdidx].gpgdir + index * sizeof(pgd_t); |
100 | } | 100 | } |
101 | 101 | ||
102 | static unsigned long gpte_addr(struct lguest *lg, | 102 | static unsigned long gpte_addr(struct lguest *lg, |
@@ -365,7 +365,7 @@ static unsigned int find_pgdir(struct lguest *lg, unsigned long pgtable) | |||
365 | { | 365 | { |
366 | unsigned int i; | 366 | unsigned int i; |
367 | for (i = 0; i < ARRAY_SIZE(lg->pgdirs); i++) | 367 | for (i = 0; i < ARRAY_SIZE(lg->pgdirs); i++) |
368 | if (lg->pgdirs[i].cr3 == pgtable) | 368 | if (lg->pgdirs[i].gpgdir == pgtable) |
369 | break; | 369 | break; |
370 | return i; | 370 | return i; |
371 | } | 371 | } |
@@ -374,7 +374,7 @@ static unsigned int find_pgdir(struct lguest *lg, unsigned long pgtable) | |||
374 | * allocate a new one (and so the kernel parts are not there), we set | 374 | * allocate a new one (and so the kernel parts are not there), we set |
375 | * blank_pgdir. */ | 375 | * blank_pgdir. */ |
376 | static unsigned int new_pgdir(struct lguest *lg, | 376 | static unsigned int new_pgdir(struct lguest *lg, |
377 | unsigned long cr3, | 377 | unsigned long gpgdir, |
378 | int *blank_pgdir) | 378 | int *blank_pgdir) |
379 | { | 379 | { |
380 | unsigned int next; | 380 | unsigned int next; |
@@ -394,7 +394,7 @@ static unsigned int new_pgdir(struct lguest *lg, | |||
394 | *blank_pgdir = 1; | 394 | *blank_pgdir = 1; |
395 | } | 395 | } |
396 | /* Record which Guest toplevel this shadows. */ | 396 | /* Record which Guest toplevel this shadows. */ |
397 | lg->pgdirs[next].cr3 = cr3; | 397 | lg->pgdirs[next].gpgdir = gpgdir; |
398 | /* Release all the non-kernel mappings. */ | 398 | /* Release all the non-kernel mappings. */ |
399 | flush_user_mappings(lg, next); | 399 | flush_user_mappings(lg, next); |
400 | 400 | ||
@@ -496,7 +496,7 @@ static void do_set_pte(struct lguest *lg, int idx, | |||
496 | * The benefit is that when we have to track a new page table, we can copy keep | 496 | * The benefit is that when we have to track a new page table, we can copy keep |
497 | * all the kernel mappings. This speeds up context switch immensely. */ | 497 | * all the kernel mappings. This speeds up context switch immensely. */ |
498 | void guest_set_pte(struct lguest *lg, | 498 | void guest_set_pte(struct lguest *lg, |
499 | unsigned long cr3, unsigned long vaddr, pte_t gpte) | 499 | unsigned long gpgdir, unsigned long vaddr, pte_t gpte) |
500 | { | 500 | { |
501 | /* Kernel mappings must be changed on all top levels. Slow, but | 501 | /* Kernel mappings must be changed on all top levels. Slow, but |
502 | * doesn't happen often. */ | 502 | * doesn't happen often. */ |
@@ -507,7 +507,7 @@ void guest_set_pte(struct lguest *lg, | |||
507 | do_set_pte(lg, i, vaddr, gpte); | 507 | do_set_pte(lg, i, vaddr, gpte); |
508 | } else { | 508 | } else { |
509 | /* Is this page table one we have a shadow for? */ | 509 | /* Is this page table one we have a shadow for? */ |
510 | int pgdir = find_pgdir(lg, cr3); | 510 | int pgdir = find_pgdir(lg, gpgdir); |
511 | if (pgdir != ARRAY_SIZE(lg->pgdirs)) | 511 | if (pgdir != ARRAY_SIZE(lg->pgdirs)) |
512 | /* If so, do the update. */ | 512 | /* If so, do the update. */ |
513 | do_set_pte(lg, pgdir, vaddr, gpte); | 513 | do_set_pte(lg, pgdir, vaddr, gpte); |
@@ -528,7 +528,7 @@ void guest_set_pte(struct lguest *lg, | |||
528 | * | 528 | * |
529 | * So with that in mind here's our code to to update a (top-level) PGD entry: | 529 | * So with that in mind here's our code to to update a (top-level) PGD entry: |
530 | */ | 530 | */ |
531 | void guest_set_pmd(struct lguest *lg, unsigned long cr3, u32 idx) | 531 | void guest_set_pmd(struct lguest *lg, unsigned long gpgdir, u32 idx) |
532 | { | 532 | { |
533 | int pgdir; | 533 | int pgdir; |
534 | 534 | ||
@@ -538,7 +538,7 @@ void guest_set_pmd(struct lguest *lg, unsigned long cr3, u32 idx) | |||
538 | return; | 538 | return; |
539 | 539 | ||
540 | /* If they're talking about a page table we have a shadow for... */ | 540 | /* If they're talking about a page table we have a shadow for... */ |
541 | pgdir = find_pgdir(lg, cr3); | 541 | pgdir = find_pgdir(lg, gpgdir); |
542 | if (pgdir < ARRAY_SIZE(lg->pgdirs)) | 542 | if (pgdir < ARRAY_SIZE(lg->pgdirs)) |
543 | /* ... throw it away. */ | 543 | /* ... throw it away. */ |
544 | release_pgd(lg, lg->pgdirs[pgdir].pgdir + idx); | 544 | release_pgd(lg, lg->pgdirs[pgdir].pgdir + idx); |
@@ -558,7 +558,7 @@ int init_guest_pagetable(struct lguest *lg, unsigned long pgtable) | |||
558 | /* We start on the first shadow page table, and give it a blank PGD | 558 | /* We start on the first shadow page table, and give it a blank PGD |
559 | * page. */ | 559 | * page. */ |
560 | lg->pgdidx = 0; | 560 | lg->pgdidx = 0; |
561 | lg->pgdirs[lg->pgdidx].cr3 = pgtable; | 561 | lg->pgdirs[lg->pgdidx].gpgdir = pgtable; |
562 | lg->pgdirs[lg->pgdidx].pgdir = (pgd_t*)get_zeroed_page(GFP_KERNEL); | 562 | lg->pgdirs[lg->pgdidx].pgdir = (pgd_t*)get_zeroed_page(GFP_KERNEL); |
563 | if (!lg->pgdirs[lg->pgdidx].pgdir) | 563 | if (!lg->pgdirs[lg->pgdidx].pgdir) |
564 | return -ENOMEM; | 564 | return -ENOMEM; |