summaryrefslogtreecommitdiff
path: root/drivers/lguest/page_tables.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2013-04-22 08:40:38 +0400
committerRusty Russell <rusty@rustcorp.com.au>2013-04-22 10:01:36 +0400
commit93a2cdff98243df06bafd3c4f3b31b38f0d0fe3e (patch)
treecfda9a918a92ac0308e1c888489c83c0b243138a /drivers/lguest/page_tables.c
parent856c608827928d29f80605e85fc3f8f0ab3af4fb (diff)
downloadlinux-93a2cdff98243df06bafd3c4f3b31b38f0d0fe3e.tar.xz
lguest: assume Switcher text is a single page.
ie. SHARED_SWITCHER_PAGES == 1. It is well under a page, and it's a minor simplification: it's nice to have *one* simplification in a patch series! Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/lguest/page_tables.c')
-rw-r--r--drivers/lguest/page_tables.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c
index 21685580eb9f..758466299b0d 100644
--- a/drivers/lguest/page_tables.c
+++ b/drivers/lguest/page_tables.c
@@ -1079,25 +1079,20 @@ static void free_switcher_pte_pages(void)
/*H:520
* Setting up the Switcher PTE page for given CPU is fairly easy, given
- * the CPU number and the "struct page"s for the Switcher code itself.
- *
- * Currently the Switcher is less than a page long, so "pages" is always 1.
+ * the CPU number and the "struct page"s for the Switcher and per-cpu pages.
*/
static __init void populate_switcher_pte_page(unsigned int cpu,
- struct page *switcher_pages[],
- unsigned int pages)
+ struct page *switcher_pages[])
{
- unsigned int i;
pte_t *pte = switcher_pte_page(cpu);
+ int i;
- /* The first entries are easy: they map the Switcher code. */
- for (i = 0; i < pages; i++) {
- set_pte(&pte[i], mk_pte(switcher_pages[i],
+ /* The first entries maps the Switcher code. */
+ set_pte(&pte[0], mk_pte(switcher_pages[0],
__pgprot(_PAGE_PRESENT|_PAGE_ACCESSED)));
- }
/* The only other thing we map is this CPU's pair of pages. */
- i = pages + cpu*2;
+ i = 1 + cpu*2;
/* First page (Guest registers) is writable from the Guest */
set_pte(&pte[i], pfn_pte(page_to_pfn(switcher_pages[i]),
@@ -1128,7 +1123,7 @@ static __init void populate_switcher_pte_page(unsigned int cpu,
* At boot or module load time, init_pagetables() allocates and populates
* the Switcher PTE page for each CPU.
*/
-__init int init_pagetables(struct page **switcher_pages, unsigned int pages)
+__init int init_pagetables(struct page **switcher_pages)
{
unsigned int i;
@@ -1138,7 +1133,7 @@ __init int init_pagetables(struct page **switcher_pages, unsigned int pages)
free_switcher_pte_pages();
return -ENOMEM;
}
- populate_switcher_pte_page(i, switcher_pages, pages);
+ populate_switcher_pte_page(i, switcher_pages);
}
return 0;
}