aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/lguest/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/lguest/core.c')
-rw-r--r--drivers/lguest/core.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c
index a5ebc0083d87..099252301132 100644
--- a/drivers/lguest/core.c
+++ b/drivers/lguest/core.c
@@ -20,7 +20,7 @@
20#include <asm/asm-offsets.h> 20#include <asm/asm-offsets.h>
21#include "lg.h" 21#include "lg.h"
22 22
23 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_page;
26 26
@@ -75,25 +75,27 @@ static __init int map_switcher(void)
75 } 75 }
76 } 76 }
77 77
78 switcher_addr = SWITCHER_ADDR;
79
78 /* 80 /*
79 * First we check that the Switcher won't overlap the fixmap area at 81 * First we check that the Switcher won't overlap the fixmap area at
80 * the top of memory. It's currently nowhere near, but it could have 82 * the top of memory. It's currently nowhere near, but it could have
81 * very strange effects if it ever happened. 83 * very strange effects if it ever happened.
82 */ 84 */
83 if (SWITCHER_ADDR + (TOTAL_SWITCHER_PAGES+1)*PAGE_SIZE > FIXADDR_START){ 85 if (switcher_addr + (TOTAL_SWITCHER_PAGES+1)*PAGE_SIZE > FIXADDR_START){
84 err = -ENOMEM; 86 err = -ENOMEM;
85 printk("lguest: mapping switcher would thwack fixmap\n"); 87 printk("lguest: mapping switcher would thwack fixmap\n");
86 goto free_pages; 88 goto free_pages;
87 } 89 }
88 90
89 /* 91 /*
90 * Now we reserve the "virtual memory area" we want: 0xFFC00000 92 * Now we reserve the "virtual memory area" we want. We might
91 * (SWITCHER_ADDR). We might not get it in theory, but in practice 93 * not get it in theory, but in practice it's worked so far.
92 * it's worked so far. The end address needs +1 because __get_vm_area 94 * The end address needs +1 because __get_vm_area allocates an
93 * allocates an extra guard page, so we need space for that. 95 * extra guard page, so we need space for that.
94 */ 96 */
95 switcher_vma = __get_vm_area(TOTAL_SWITCHER_PAGES * PAGE_SIZE, 97 switcher_vma = __get_vm_area(TOTAL_SWITCHER_PAGES * PAGE_SIZE,
96 VM_ALLOC, SWITCHER_ADDR, SWITCHER_ADDR 98 VM_ALLOC, switcher_addr, switcher_addr
97 + (TOTAL_SWITCHER_PAGES+1) * PAGE_SIZE); 99 + (TOTAL_SWITCHER_PAGES+1) * PAGE_SIZE);
98 if (!switcher_vma) { 100 if (!switcher_vma) {
99 err = -ENOMEM; 101 err = -ENOMEM;
@@ -103,7 +105,7 @@ static __init int map_switcher(void)
103 105
104 /* 106 /*
105 * This code actually sets up the pages we've allocated to appear at 107 * This code actually sets up the pages we've allocated to appear at
106 * SWITCHER_ADDR. map_vm_area() takes the vma we allocated above, the 108 * switcher_addr. map_vm_area() takes the vma we allocated above, the
107 * kind of pages we're mapping (kernel pages), and a pointer to our 109 * kind of pages we're mapping (kernel pages), and a pointer to our
108 * 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
109 * care. 111 * care.