aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/lguest/core.c24
-rw-r--r--drivers/lguest/lg.h2
-rw-r--r--drivers/lguest/page_tables.c12
3 files changed, 19 insertions, 19 deletions
diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c
index 099252301132..211d8267992b 100644
--- a/drivers/lguest/core.c
+++ b/drivers/lguest/core.c
@@ -22,7 +22,7 @@
22 22
23unsigned long switcher_addr; 23unsigned long switcher_addr;
24static struct vm_struct *switcher_vma; 24static struct vm_struct *switcher_vma;
25static struct page **switcher_page; 25static struct page **switcher_pages;
26 26
27/* This One Big lock protects all inter-guest data structures. */ 27/* This One Big lock protects all inter-guest data structures. */
28DEFINE_MUTEX(lguest_lock); 28DEFINE_MUTEX(lguest_lock);
@@ -56,9 +56,9 @@ static __init int map_switcher(void)
56 * We allocate an array of struct page pointers. map_vm_area() wants 56 * We allocate an array of struct page pointers. map_vm_area() wants
57 * this, rather than just an array of pages. 57 * this, rather than just an array of pages.
58 */ 58 */
59 switcher_page = kmalloc(sizeof(switcher_page[0])*TOTAL_SWITCHER_PAGES, 59 switcher_pages = kmalloc(sizeof(switcher_pages[0])*TOTAL_SWITCHER_PAGES,
60 GFP_KERNEL); 60 GFP_KERNEL);
61 if (!switcher_page) { 61 if (!switcher_pages) {
62 err = -ENOMEM; 62 err = -ENOMEM;
63 goto out; 63 goto out;
64 } 64 }
@@ -68,8 +68,8 @@ static __init int map_switcher(void)
68 * so we make sure they're zeroed. 68 * so we make sure they're zeroed.
69 */ 69 */
70 for (i = 0; i < TOTAL_SWITCHER_PAGES; i++) { 70 for (i = 0; i < TOTAL_SWITCHER_PAGES; i++) {
71 switcher_page[i] = alloc_page(GFP_KERNEL|__GFP_ZERO); 71 switcher_pages[i] = alloc_page(GFP_KERNEL|__GFP_ZERO);
72 if (!switcher_page[i]) { 72 if (!switcher_pages[i]) {
73 err = -ENOMEM; 73 err = -ENOMEM;
74 goto free_some_pages; 74 goto free_some_pages;
75 } 75 }
@@ -110,7 +110,7 @@ static __init int map_switcher(void)
110 * array of struct pages. It increments that pointer, but we don't 110 * array of struct pages. It increments that pointer, but we don't
111 * care. 111 * care.
112 */ 112 */
113 pagep = switcher_page; 113 pagep = switcher_pages;
114 err = map_vm_area(switcher_vma, PAGE_KERNEL_EXEC, &pagep); 114 err = map_vm_area(switcher_vma, PAGE_KERNEL_EXEC, &pagep);
115 if (err) { 115 if (err) {
116 printk("lguest: map_vm_area failed: %i\n", err); 116 printk("lguest: map_vm_area failed: %i\n", err);
@@ -135,8 +135,8 @@ free_pages:
135 i = TOTAL_SWITCHER_PAGES; 135 i = TOTAL_SWITCHER_PAGES;
136free_some_pages: 136free_some_pages:
137 for (--i; i >= 0; i--) 137 for (--i; i >= 0; i--)
138 __free_pages(switcher_page[i], 0); 138 __free_pages(switcher_pages[i], 0);
139 kfree(switcher_page); 139 kfree(switcher_pages);
140out: 140out:
141 return err; 141 return err;
142} 142}
@@ -151,8 +151,8 @@ static void unmap_switcher(void)
151 vunmap(switcher_vma->addr); 151 vunmap(switcher_vma->addr);
152 /* Now we just need to free the pages we copied the switcher into */ 152 /* Now we just need to free the pages we copied the switcher into */
153 for (i = 0; i < TOTAL_SWITCHER_PAGES; i++) 153 for (i = 0; i < TOTAL_SWITCHER_PAGES; i++)
154 __free_pages(switcher_page[i], 0); 154 __free_pages(switcher_pages[i], 0);
155 kfree(switcher_page); 155 kfree(switcher_pages);
156} 156}
157 157
158/*H:032 158/*H:032
@@ -326,7 +326,7 @@ static int __init init(void)
326 goto out; 326 goto out;
327 327
328 /* Now we set up the pagetable implementation for the Guests. */ 328 /* Now we set up the pagetable implementation for the Guests. */
329 err = init_pagetables(switcher_page, SHARED_SWITCHER_PAGES); 329 err = init_pagetables(switcher_pages, SHARED_SWITCHER_PAGES);
330 if (err) 330 if (err)
331 goto unmap; 331 goto unmap;
332 332
diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h
index 295df06e6590..8bf68c54ff7f 100644
--- a/drivers/lguest/lg.h
+++ b/drivers/lguest/lg.h
@@ -15,7 +15,7 @@
15#include <asm/lguest.h> 15#include <asm/lguest.h>
16 16
17void free_pagetables(void); 17void free_pagetables(void);
18int init_pagetables(struct page **switcher_page, unsigned int pages); 18int init_pagetables(struct page **switcher_pages, unsigned int pages);
19 19
20struct pgdir { 20struct pgdir {
21 unsigned long gpgdir; 21 unsigned long gpgdir;
diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c
index 27cbb186a911..21685580eb9f 100644
--- a/drivers/lguest/page_tables.c
+++ b/drivers/lguest/page_tables.c
@@ -1084,7 +1084,7 @@ static void free_switcher_pte_pages(void)
1084 * Currently the Switcher is less than a page long, so "pages" is always 1. 1084 * Currently the Switcher is less than a page long, so "pages" is always 1.
1085 */ 1085 */
1086static __init void populate_switcher_pte_page(unsigned int cpu, 1086static __init void populate_switcher_pte_page(unsigned int cpu,
1087 struct page *switcher_page[], 1087 struct page *switcher_pages[],
1088 unsigned int pages) 1088 unsigned int pages)
1089{ 1089{
1090 unsigned int i; 1090 unsigned int i;
@@ -1092,7 +1092,7 @@ static __init void populate_switcher_pte_page(unsigned int cpu,
1092 1092
1093 /* The first entries are easy: they map the Switcher code. */ 1093 /* The first entries are easy: they map the Switcher code. */
1094 for (i = 0; i < pages; i++) { 1094 for (i = 0; i < pages; i++) {
1095 set_pte(&pte[i], mk_pte(switcher_page[i], 1095 set_pte(&pte[i], mk_pte(switcher_pages[i],
1096 __pgprot(_PAGE_PRESENT|_PAGE_ACCESSED))); 1096 __pgprot(_PAGE_PRESENT|_PAGE_ACCESSED)));
1097 } 1097 }
1098 1098
@@ -1100,14 +1100,14 @@ static __init void populate_switcher_pte_page(unsigned int cpu,
1100 i = pages + cpu*2; 1100 i = pages + cpu*2;
1101 1101
1102 /* First page (Guest registers) is writable from the Guest */ 1102 /* First page (Guest registers) is writable from the Guest */
1103 set_pte(&pte[i], pfn_pte(page_to_pfn(switcher_page[i]), 1103 set_pte(&pte[i], pfn_pte(page_to_pfn(switcher_pages[i]),
1104 __pgprot(_PAGE_PRESENT|_PAGE_ACCESSED|_PAGE_RW))); 1104 __pgprot(_PAGE_PRESENT|_PAGE_ACCESSED|_PAGE_RW)));
1105 1105
1106 /* 1106 /*
1107 * The second page contains the "struct lguest_ro_state", and is 1107 * The second page contains the "struct lguest_ro_state", and is
1108 * read-only. 1108 * read-only.
1109 */ 1109 */
1110 set_pte(&pte[i+1], pfn_pte(page_to_pfn(switcher_page[i+1]), 1110 set_pte(&pte[i+1], pfn_pte(page_to_pfn(switcher_pages[i+1]),
1111 __pgprot(_PAGE_PRESENT|_PAGE_ACCESSED))); 1111 __pgprot(_PAGE_PRESENT|_PAGE_ACCESSED)));
1112} 1112}
1113 1113
@@ -1128,7 +1128,7 @@ static __init void populate_switcher_pte_page(unsigned int cpu,
1128 * At boot or module load time, init_pagetables() allocates and populates 1128 * At boot or module load time, init_pagetables() allocates and populates
1129 * the Switcher PTE page for each CPU. 1129 * the Switcher PTE page for each CPU.
1130 */ 1130 */
1131__init int init_pagetables(struct page **switcher_page, unsigned int pages) 1131__init int init_pagetables(struct page **switcher_pages, unsigned int pages)
1132{ 1132{
1133 unsigned int i; 1133 unsigned int i;
1134 1134
@@ -1138,7 +1138,7 @@ __init int init_pagetables(struct page **switcher_page, unsigned int pages)
1138 free_switcher_pte_pages(); 1138 free_switcher_pte_pages();
1139 return -ENOMEM; 1139 return -ENOMEM;
1140 } 1140 }
1141 populate_switcher_pte_page(i, switcher_page, pages); 1141 populate_switcher_pte_page(i, switcher_pages, pages);
1142 } 1142 }
1143 return 0; 1143 return 0;
1144} 1144}