diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2013-04-22 00:40:40 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2013-04-22 02:15:00 -0400 |
commit | f1f394b1c33d93416c90f97e201d4d386c04af55 (patch) | |
tree | 344d79f8fcdf66c32bf4032eb05798dc70b6c8c8 /drivers/lguest/core.c | |
parent | 17427e08faae3e63271a9c2d0edb6a22e5fbb54b (diff) |
lguest: expost switcher_pages array (as lg_switcher_pages).
We will need this in page_table.c soon.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/lguest/core.c')
-rw-r--r-- | drivers/lguest/core.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c index 4209065b9b1e..b6c71c32308c 100644 --- a/drivers/lguest/core.c +++ b/drivers/lguest/core.c | |||
@@ -21,8 +21,8 @@ | |||
21 | #include "lg.h" | 21 | #include "lg.h" |
22 | 22 | ||
23 | unsigned long switcher_addr; | 23 | unsigned long switcher_addr; |
24 | struct page **lg_switcher_pages; | ||
24 | static struct vm_struct *switcher_vma; | 25 | static struct vm_struct *switcher_vma; |
25 | static 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. */ |
28 | DEFINE_MUTEX(lguest_lock); | 28 | DEFINE_MUTEX(lguest_lock); |
@@ -63,9 +63,10 @@ static __init int map_switcher(void) | |||
63 | * We allocate an array of struct page pointers. map_vm_area() wants | 63 | * We allocate an array of struct page pointers. map_vm_area() wants |
64 | * this, rather than just an array of pages. | 64 | * this, rather than just an array of pages. |
65 | */ | 65 | */ |
66 | switcher_pages = kmalloc(sizeof(switcher_pages[0])*TOTAL_SWITCHER_PAGES, | 66 | lg_switcher_pages = kmalloc(sizeof(lg_switcher_pages[0]) |
67 | GFP_KERNEL); | 67 | * TOTAL_SWITCHER_PAGES, |
68 | if (!switcher_pages) { | 68 | GFP_KERNEL); |
69 | if (!lg_switcher_pages) { | ||
69 | err = -ENOMEM; | 70 | err = -ENOMEM; |
70 | goto out; | 71 | goto out; |
71 | } | 72 | } |
@@ -75,8 +76,8 @@ static __init int map_switcher(void) | |||
75 | * so we make sure they're zeroed. | 76 | * so we make sure they're zeroed. |
76 | */ | 77 | */ |
77 | for (i = 0; i < TOTAL_SWITCHER_PAGES; i++) { | 78 | for (i = 0; i < TOTAL_SWITCHER_PAGES; i++) { |
78 | switcher_pages[i] = alloc_page(GFP_KERNEL|__GFP_ZERO); | 79 | lg_switcher_pages[i] = alloc_page(GFP_KERNEL|__GFP_ZERO); |
79 | if (!switcher_pages[i]) { | 80 | if (!lg_switcher_pages[i]) { |
80 | err = -ENOMEM; | 81 | err = -ENOMEM; |
81 | goto free_some_pages; | 82 | goto free_some_pages; |
82 | } | 83 | } |
@@ -117,7 +118,7 @@ static __init int map_switcher(void) | |||
117 | * array of struct pages. It increments that pointer, but we don't | 118 | * array of struct pages. It increments that pointer, but we don't |
118 | * care. | 119 | * care. |
119 | */ | 120 | */ |
120 | pagep = switcher_pages; | 121 | pagep = lg_switcher_pages; |
121 | err = map_vm_area(switcher_vma, PAGE_KERNEL_EXEC, &pagep); | 122 | err = map_vm_area(switcher_vma, PAGE_KERNEL_EXEC, &pagep); |
122 | if (err) { | 123 | if (err) { |
123 | printk("lguest: map_vm_area failed: %i\n", err); | 124 | printk("lguest: map_vm_area failed: %i\n", err); |
@@ -142,8 +143,8 @@ free_pages: | |||
142 | i = TOTAL_SWITCHER_PAGES; | 143 | i = TOTAL_SWITCHER_PAGES; |
143 | free_some_pages: | 144 | free_some_pages: |
144 | for (--i; i >= 0; i--) | 145 | for (--i; i >= 0; i--) |
145 | __free_pages(switcher_pages[i], 0); | 146 | __free_pages(lg_switcher_pages[i], 0); |
146 | kfree(switcher_pages); | 147 | kfree(lg_switcher_pages); |
147 | out: | 148 | out: |
148 | return err; | 149 | return err; |
149 | } | 150 | } |
@@ -158,8 +159,8 @@ static void unmap_switcher(void) | |||
158 | vunmap(switcher_vma->addr); | 159 | vunmap(switcher_vma->addr); |
159 | /* Now we just need to free the pages we copied the switcher into */ | 160 | /* Now we just need to free the pages we copied the switcher into */ |
160 | for (i = 0; i < TOTAL_SWITCHER_PAGES; i++) | 161 | for (i = 0; i < TOTAL_SWITCHER_PAGES; i++) |
161 | __free_pages(switcher_pages[i], 0); | 162 | __free_pages(lg_switcher_pages[i], 0); |
162 | kfree(switcher_pages); | 163 | kfree(lg_switcher_pages); |
163 | } | 164 | } |
164 | 165 | ||
165 | /*H:032 | 166 | /*H:032 |
@@ -333,7 +334,7 @@ static int __init init(void) | |||
333 | goto out; | 334 | goto out; |
334 | 335 | ||
335 | /* Now we set up the pagetable implementation for the Guests. */ | 336 | /* Now we set up the pagetable implementation for the Guests. */ |
336 | err = init_pagetables(switcher_pages); | 337 | err = init_pagetables(lg_switcher_pages); |
337 | if (err) | 338 | if (err) |
338 | goto unmap; | 339 | goto unmap; |
339 | 340 | ||