diff options
author | Glauber de Oliveira Costa <gcosta@redhat.com> | 2008-01-07 08:05:30 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2008-01-30 06:50:09 -0500 |
commit | 0c78441cf4dd66f66e23dc085f0cc1e3e8669b96 (patch) | |
tree | 33216420c6300df9a345247dc6e0b669ce5b2198 | |
parent | 177e449dc5bd4cf8dc48d66abee61ddf34b126b9 (diff) |
lguest: map_switcher_in_guest() per-vcpu
The switcher needs to be mapped per-vcpu, because different vcpus
will potentially have different page tables (they don't have to,
because threads will share the same).
So our first step is the make the function receive a vcpu struct
Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r-- | drivers/lguest/lg.h | 2 | ||||
-rw-r--r-- | drivers/lguest/page_tables.c | 3 | ||||
-rw-r--r-- | drivers/lguest/x86/core.c | 2 |
3 files changed, 4 insertions, 3 deletions
diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h index 29e03d588a8d..072d0d4fd0b9 100644 --- a/drivers/lguest/lg.h +++ b/drivers/lguest/lg.h | |||
@@ -168,7 +168,7 @@ void guest_pagetable_clear_all(struct lguest *lg); | |||
168 | void guest_pagetable_flush_user(struct lguest *lg); | 168 | void guest_pagetable_flush_user(struct lguest *lg); |
169 | void guest_set_pte(struct lguest *lg, unsigned long gpgdir, | 169 | void guest_set_pte(struct lguest *lg, unsigned long gpgdir, |
170 | unsigned long vaddr, pte_t val); | 170 | unsigned long vaddr, pte_t val); |
171 | void map_switcher_in_guest(struct lguest *lg, struct lguest_pages *pages); | 171 | void map_switcher_in_guest(struct lg_cpu *cpu, struct lguest_pages *pages); |
172 | int demand_page(struct lguest *info, unsigned long cr2, int errcode); | 172 | int demand_page(struct lguest *info, unsigned long cr2, int errcode); |
173 | void pin_page(struct lguest *lg, unsigned long vaddr); | 173 | void pin_page(struct lguest *lg, unsigned long vaddr); |
174 | unsigned long guest_pa(struct lguest *lg, unsigned long vaddr); | 174 | unsigned long guest_pa(struct lguest *lg, unsigned long vaddr); |
diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c index fffabb327157..17d3329e34c2 100644 --- a/drivers/lguest/page_tables.c +++ b/drivers/lguest/page_tables.c | |||
@@ -634,8 +634,9 @@ void free_guest_pagetable(struct lguest *lg) | |||
634 | * Guest (and not the pages for other CPUs). We have the appropriate PTE pages | 634 | * Guest (and not the pages for other CPUs). We have the appropriate PTE pages |
635 | * for each CPU already set up, we just need to hook them in now we know which | 635 | * for each CPU already set up, we just need to hook them in now we know which |
636 | * Guest is about to run on this CPU. */ | 636 | * Guest is about to run on this CPU. */ |
637 | void map_switcher_in_guest(struct lguest *lg, struct lguest_pages *pages) | 637 | void map_switcher_in_guest(struct lg_cpu *cpu, struct lguest_pages *pages) |
638 | { | 638 | { |
639 | struct lguest *lg = cpu->lg; | ||
639 | pte_t *switcher_pte_page = __get_cpu_var(switcher_pte_pages); | 640 | pte_t *switcher_pte_page = __get_cpu_var(switcher_pte_pages); |
640 | pgd_t switcher_pgd; | 641 | pgd_t switcher_pgd; |
641 | pte_t regs_pte; | 642 | pte_t regs_pte; |
diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c index 66f48fcc1196..d35f6299c92f 100644 --- a/drivers/lguest/x86/core.c +++ b/drivers/lguest/x86/core.c | |||
@@ -91,7 +91,7 @@ static void copy_in_guest_info(struct lg_cpu *cpu, struct lguest_pages *pages) | |||
91 | pages->state.host_cr3 = __pa(current->mm->pgd); | 91 | pages->state.host_cr3 = __pa(current->mm->pgd); |
92 | /* Set up the Guest's page tables to see this CPU's pages (and no | 92 | /* Set up the Guest's page tables to see this CPU's pages (and no |
93 | * other CPU's pages). */ | 93 | * other CPU's pages). */ |
94 | map_switcher_in_guest(lg, pages); | 94 | map_switcher_in_guest(cpu, pages); |
95 | /* Set up the two "TSS" members which tell the CPU what stack to use | 95 | /* Set up the two "TSS" members which tell the CPU what stack to use |
96 | * for traps which do directly into the Guest (ie. traps at privilege | 96 | * for traps which do directly into the Guest (ie. traps at privilege |
97 | * level 1). */ | 97 | * level 1). */ |