diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2013-04-22 14:10:40 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2013-04-22 15:45:00 +0930 |
commit | f1f394b1c33d93416c90f97e201d4d386c04af55 (patch) | |
tree | 344d79f8fcdf66c32bf4032eb05798dc70b6c8c8 /drivers/lguest/core.c | |
parent | 17427e08faae3e63271a9c2d0edb6a22e5fbb54b (diff) | |
download | linux-f1f394b1c33d93416c90f97e201d4d386c04af55.tar.bz2 |
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 @@ #include "lg.h" unsigned long switcher_addr; +struct page **lg_switcher_pages; static struct vm_struct *switcher_vma; -static struct page **switcher_pages; /* This One Big lock protects all inter-guest data structures. */ DEFINE_MUTEX(lguest_lock); @@ -63,9 +63,10 @@ static __init int map_switcher(void) * We allocate an array of struct page pointers. map_vm_area() wants * this, rather than just an array of pages. */ - switcher_pages = kmalloc(sizeof(switcher_pages[0])*TOTAL_SWITCHER_PAGES, - GFP_KERNEL); - if (!switcher_pages) { + lg_switcher_pages = kmalloc(sizeof(lg_switcher_pages[0]) + * TOTAL_SWITCHER_PAGES, + GFP_KERNEL); + if (!lg_switcher_pages) { err = -ENOMEM; goto out; } @@ -75,8 +76,8 @@ static __init int map_switcher(void) * so we make sure they're zeroed. */ for (i = 0; i < TOTAL_SWITCHER_PAGES; i++) { - switcher_pages[i] = alloc_page(GFP_KERNEL|__GFP_ZERO); - if (!switcher_pages[i]) { + lg_switcher_pages[i] = alloc_page(GFP_KERNEL|__GFP_ZERO); + if (!lg_switcher_pages[i]) { err = -ENOMEM; goto free_some_pages; } @@ -117,7 +118,7 @@ static __init int map_switcher(void) * array of struct pages. It increments that pointer, but we don't * care. */ - pagep = switcher_pages; + pagep = lg_switcher_pages; err = map_vm_area(switcher_vma, PAGE_KERNEL_EXEC, &pagep); if (err) { printk("lguest: map_vm_area failed: %i\n", err); @@ -142,8 +143,8 @@ free_pages: i = TOTAL_SWITCHER_PAGES; free_some_pages: for (--i; i >= 0; i--) - __free_pages(switcher_pages[i], 0); - kfree(switcher_pages); + __free_pages(lg_switcher_pages[i], 0); + kfree(lg_switcher_pages); out: return err; } @@ -158,8 +159,8 @@ static void unmap_switcher(void) vunmap(switcher_vma->addr); /* Now we just need to free the pages we copied the switcher into */ for (i = 0; i < TOTAL_SWITCHER_PAGES; i++) - __free_pages(switcher_pages[i], 0); - kfree(switcher_pages); + __free_pages(lg_switcher_pages[i], 0); + kfree(lg_switcher_pages); } /*H:032 @@ -333,7 +334,7 @@ static int __init init(void) goto out; /* Now we set up the pagetable implementation for the Guests. */ - err = init_pagetables(switcher_pages); + err = init_pagetables(lg_switcher_pages); if (err) goto unmap; |