From ee3db0f2b6053b65f3b70253f5f810d9a3d67b28 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 22 Oct 2007 11:03:34 +1000 Subject: Rename "cr3" to "gpgdir" to avoid x86-specific naming. Signed-off-by: Rusty Russell --- drivers/lguest/lg.h | 6 +++--- drivers/lguest/page_tables.c | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'drivers/lguest') diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h index dc15b88208f..f921684dbe5 100644 --- a/drivers/lguest/lg.h +++ b/drivers/lguest/lg.h @@ -30,7 +30,7 @@ struct lguest_dma_info struct pgdir { - unsigned long cr3; + unsigned long gpgdir; pgd_t *pgdir; }; @@ -154,10 +154,10 @@ void copy_gdt_tls(const struct lguest *lg, struct desc_struct *gdt); int init_guest_pagetable(struct lguest *lg, unsigned long pgtable); void free_guest_pagetable(struct lguest *lg); void guest_new_pagetable(struct lguest *lg, unsigned long pgtable); -void guest_set_pmd(struct lguest *lg, unsigned long cr3, u32 i); +void guest_set_pmd(struct lguest *lg, unsigned long gpgdir, u32 i); void guest_pagetable_clear_all(struct lguest *lg); void guest_pagetable_flush_user(struct lguest *lg); -void guest_set_pte(struct lguest *lg, unsigned long cr3, +void guest_set_pte(struct lguest *lg, unsigned long gpgdir, unsigned long vaddr, pte_t val); void map_switcher_in_guest(struct lguest *lg, struct lguest_pages *pages); 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 5c4c53f38cf..bfe3650b28d 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) static unsigned long gpgd_addr(struct lguest *lg, unsigned long vaddr) { unsigned int index = vaddr >> (PGDIR_SHIFT); - return lg->pgdirs[lg->pgdidx].cr3 + index * sizeof(pgd_t); + return lg->pgdirs[lg->pgdidx].gpgdir + index * sizeof(pgd_t); } static unsigned long gpte_addr(struct lguest *lg, @@ -365,7 +365,7 @@ static unsigned int find_pgdir(struct lguest *lg, unsigned long pgtable) { unsigned int i; for (i = 0; i < ARRAY_SIZE(lg->pgdirs); i++) - if (lg->pgdirs[i].cr3 == pgtable) + if (lg->pgdirs[i].gpgdir == pgtable) break; return i; } @@ -374,7 +374,7 @@ static unsigned int find_pgdir(struct lguest *lg, unsigned long pgtable) * allocate a new one (and so the kernel parts are not there), we set * blank_pgdir. */ static unsigned int new_pgdir(struct lguest *lg, - unsigned long cr3, + unsigned long gpgdir, int *blank_pgdir) { unsigned int next; @@ -394,7 +394,7 @@ static unsigned int new_pgdir(struct lguest *lg, *blank_pgdir = 1; } /* Record which Guest toplevel this shadows. */ - lg->pgdirs[next].cr3 = cr3; + lg->pgdirs[next].gpgdir = gpgdir; /* Release all the non-kernel mappings. */ flush_user_mappings(lg, next); @@ -496,7 +496,7 @@ static void do_set_pte(struct lguest *lg, int idx, * The benefit is that when we have to track a new page table, we can copy keep * all the kernel mappings. This speeds up context switch immensely. */ void guest_set_pte(struct lguest *lg, - unsigned long cr3, unsigned long vaddr, pte_t gpte) + unsigned long gpgdir, unsigned long vaddr, pte_t gpte) { /* Kernel mappings must be changed on all top levels. Slow, but * doesn't happen often. */ @@ -507,7 +507,7 @@ void guest_set_pte(struct lguest *lg, do_set_pte(lg, i, vaddr, gpte); } else { /* Is this page table one we have a shadow for? */ - int pgdir = find_pgdir(lg, cr3); + int pgdir = find_pgdir(lg, gpgdir); if (pgdir != ARRAY_SIZE(lg->pgdirs)) /* If so, do the update. */ do_set_pte(lg, pgdir, vaddr, gpte); @@ -528,7 +528,7 @@ void guest_set_pte(struct lguest *lg, * * So with that in mind here's our code to to update a (top-level) PGD entry: */ -void guest_set_pmd(struct lguest *lg, unsigned long cr3, u32 idx) +void guest_set_pmd(struct lguest *lg, unsigned long gpgdir, u32 idx) { int pgdir; @@ -538,7 +538,7 @@ void guest_set_pmd(struct lguest *lg, unsigned long cr3, u32 idx) return; /* If they're talking about a page table we have a shadow for... */ - pgdir = find_pgdir(lg, cr3); + pgdir = find_pgdir(lg, gpgdir); if (pgdir < ARRAY_SIZE(lg->pgdirs)) /* ... throw it away. */ release_pgd(lg, lg->pgdirs[pgdir].pgdir + idx); @@ -558,7 +558,7 @@ int init_guest_pagetable(struct lguest *lg, unsigned long pgtable) /* We start on the first shadow page table, and give it a blank PGD * page. */ lg->pgdidx = 0; - lg->pgdirs[lg->pgdidx].cr3 = pgtable; + lg->pgdirs[lg->pgdidx].gpgdir = pgtable; lg->pgdirs[lg->pgdidx].pgdir = (pgd_t*)get_zeroed_page(GFP_KERNEL); if (!lg->pgdirs[lg->pgdidx].pgdir) return -ENOMEM; -- cgit v1.2.3-70-g09d2