diff options
Diffstat (limited to 'drivers/lguest/page_tables.c')
-rw-r--r-- | drivers/lguest/page_tables.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c index b7a924ace684..9cd2faceb87c 100644 --- a/drivers/lguest/page_tables.c +++ b/drivers/lguest/page_tables.c | |||
@@ -152,7 +152,7 @@ static unsigned long get_pfn(unsigned long virtpfn, int write) | |||
152 | static spte_t gpte_to_spte(struct lguest *lg, gpte_t gpte, int write) | 152 | static spte_t gpte_to_spte(struct lguest *lg, gpte_t gpte, int write) |
153 | { | 153 | { |
154 | spte_t spte; | 154 | spte_t spte; |
155 | unsigned long pfn; | 155 | unsigned long pfn, base; |
156 | 156 | ||
157 | /* The Guest sets the global flag, because it thinks that it is using | 157 | /* The Guest sets the global flag, because it thinks that it is using |
158 | * PGE. We only told it to use PGE so it would tell us whether it was | 158 | * PGE. We only told it to use PGE so it would tell us whether it was |
@@ -160,11 +160,14 @@ static spte_t gpte_to_spte(struct lguest *lg, gpte_t gpte, int write) | |||
160 | * use the global bit, so throw it away. */ | 160 | * use the global bit, so throw it away. */ |
161 | spte.flags = (gpte.flags & ~_PAGE_GLOBAL); | 161 | spte.flags = (gpte.flags & ~_PAGE_GLOBAL); |
162 | 162 | ||
163 | /* The Guest's pages are offset inside the Launcher. */ | ||
164 | base = (unsigned long)lg->mem_base / PAGE_SIZE; | ||
165 | |||
163 | /* We need a temporary "unsigned long" variable to hold the answer from | 166 | /* We need a temporary "unsigned long" variable to hold the answer from |
164 | * get_pfn(), because it returns 0xFFFFFFFF on failure, which wouldn't | 167 | * get_pfn(), because it returns 0xFFFFFFFF on failure, which wouldn't |
165 | * fit in spte.pfn. get_pfn() finds the real physical number of the | 168 | * fit in spte.pfn. get_pfn() finds the real physical number of the |
166 | * page, given the virtual number. */ | 169 | * page, given the virtual number. */ |
167 | pfn = get_pfn(gpte.pfn, write); | 170 | pfn = get_pfn(base + gpte.pfn, write); |
168 | if (pfn == -1UL) { | 171 | if (pfn == -1UL) { |
169 | kill_guest(lg, "failed to get page %u", gpte.pfn); | 172 | kill_guest(lg, "failed to get page %u", gpte.pfn); |
170 | /* When we destroy the Guest, we'll go through the shadow page | 173 | /* When we destroy the Guest, we'll go through the shadow page |