aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/lguest/page_tables.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2007-10-21 21:03:34 -0400
committerRusty Russell <rusty@rustcorp.com.au>2007-10-23 01:49:53 -0400
commitee3db0f2b6053b65f3b70253f5f810d9a3d67b28 (patch)
treecc9b037247b8d8afb75c4d6214428fb0a2dc65f2 /drivers/lguest/page_tables.c
parentdf29f43e650df29456804dabdb2611de914e7c0f (diff)
Rename "cr3" to "gpgdir" to avoid x86-specific naming.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/lguest/page_tables.c')
-rw-r--r--drivers/lguest/page_tables.c18
1 files changed, 9 insertions, 9 deletions
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)
96static unsigned long gpgd_addr(struct lguest *lg, unsigned long vaddr) 96static 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
102static unsigned long gpte_addr(struct lguest *lg, 102static 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. */
376static unsigned int new_pgdir(struct lguest *lg, 376static 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. */
498void guest_set_pte(struct lguest *lg, 498void 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 */
531void guest_set_pmd(struct lguest *lg, unsigned long cr3, u32 idx) 531void 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;