From: Glauber de Oliveira Costa Date: Mon, 7 Jan 2008 13:05:30 +0000 (-0200) Subject: lguest: map_switcher_in_guest() per-vcpu X-Git-Tag: v2.6.25-rc1~1135^2~15 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=0c78441cf4dd66f66e23dc085f0cc1e3e8669b96;p=karo-tx-linux.git 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 Signed-off-by: Rusty Russell --- 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); void guest_pagetable_flush_user(struct lguest *lg); void guest_set_pte(struct lguest *lg, unsigned long gpgdir, unsigned long vaddr, pte_t val); -void map_switcher_in_guest(struct lguest *lg, struct lguest_pages *pages); +void map_switcher_in_guest(struct lg_cpu *cpu, struct lguest_pages *pages); int demand_page(struct lguest *info, unsigned long cr2, int errcode); void pin_page(struct lguest *lg, unsigned long vaddr); 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) * Guest (and not the pages for other CPUs). We have the appropriate PTE pages * for each CPU already set up, we just need to hook them in now we know which * Guest is about to run on this CPU. */ -void map_switcher_in_guest(struct lguest *lg, struct lguest_pages *pages) +void map_switcher_in_guest(struct lg_cpu *cpu, struct lguest_pages *pages) { + struct lguest *lg = cpu->lg; pte_t *switcher_pte_page = __get_cpu_var(switcher_pte_pages); pgd_t switcher_pgd; 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) pages->state.host_cr3 = __pa(current->mm->pgd); /* Set up the Guest's page tables to see this CPU's pages (and no * other CPU's pages). */ - map_switcher_in_guest(lg, pages); + map_switcher_in_guest(cpu, pages); /* Set up the two "TSS" members which tell the CPU what stack to use * for traps which do directly into the Guest (ie. traps at privilege * level 1). */