search for: pgdir

Displaying 20 results from an estimated 95 matches for "pgdir".

2009 Apr 16
1
NULL pointer dereference at __switch_to() ( __unlazy_fpu ) with lguest PAE patch
...t_set_pte_atomic(pte_t *ptep, pte_t pte) +{ + native_set_pte_atomic(ptep, pte); if (cr3_changed) lazy_hcall1(LHCALL_FLUSH_TLB, 1); } +void lguest_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) +{ + native_pte_clear(mm, addr, ptep); + lazy_hcall3(LHCALL_SET_PTE, lguest_data.pgdir, addr, 0); +} + +void lguest_pmd_clear(pmd_t *pmdp) +{ + lguest_set_pmd(pmdp, __pmd(0)); +} +#endif + /* Unfortunately for Lguest, the pv_mmu_ops for page tables were based on * native page table operations. On native hardware you can set a new page * table entry whenever you want, but if you...
2009 Apr 16
1
NULL pointer dereference at __switch_to() ( __unlazy_fpu ) with lguest PAE patch
...t_set_pte_atomic(pte_t *ptep, pte_t pte) +{ + native_set_pte_atomic(ptep, pte); if (cr3_changed) lazy_hcall1(LHCALL_FLUSH_TLB, 1); } +void lguest_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) +{ + native_pte_clear(mm, addr, ptep); + lazy_hcall3(LHCALL_SET_PTE, lguest_data.pgdir, addr, 0); +} + +void lguest_pmd_clear(pmd_t *pmdp) +{ + lguest_set_pmd(pmdp, __pmd(0)); +} +#endif + /* Unfortunately for Lguest, the pv_mmu_ops for page tables were based on * native page table operations. On native hardware you can set a new page * table entry whenever you want, but if you...
2009 Mar 26
1
[PATCH 3/5] lguest: avoid accidental recycling of pgdir pages
Impact: potential bugfix In theory, the kernel could reuse the same page as pgdir for a new process while the hypervisor keeps it cached. This would have undesirable results. Signed-off-by: Rusty Russell <rusty at rustcorp.com.au> --- arch/x86/include/asm/lguest_hcall.h | 1 + arch/x86/lguest/boot.c | 8 ++++++++ drivers/lguest/hypercalls.c |...
2009 Mar 26
1
[PATCH 3/5] lguest: avoid accidental recycling of pgdir pages
Impact: potential bugfix In theory, the kernel could reuse the same page as pgdir for a new process while the hypervisor keeps it cached. This would have undesirable results. Signed-off-by: Rusty Russell <rusty at rustcorp.com.au> --- arch/x86/include/asm/lguest_hcall.h | 1 + arch/x86/lguest/boot.c | 8 ++++++++ drivers/lguest/hypercalls.c |...
2009 Jun 05
1
[PATCH] lguest: PAE support
...s_and_traps.c: */ void maybe_do_interrupt(struct lg_cpu *cpu); @@ -169,6 +171,9 @@ int init_guest_pagetable(struct lguest *lg); void free_guest_pagetable(struct lguest *lg); void guest_new_pagetable(struct lg_cpu *cpu, unsigned long pgtable); void guest_set_pgd(struct lguest *lg, unsigned long gpgdir, u32 i); +#ifdef CONFIG_X86_PAE +void guest_set_pmd(struct lguest *lg, unsigned long gpgdir, u32 i); +#endif void guest_pagetable_clear_all(struct lg_cpu *cpu); void guest_pagetable_flush_user(struct lg_cpu *cpu); void guest_set_pte(struct lg_cpu *cpu, unsigned long gpgdir, diff --git a/drivers/...
2009 Jun 05
1
[PATCH] lguest: PAE support
...s_and_traps.c: */ void maybe_do_interrupt(struct lg_cpu *cpu); @@ -169,6 +171,9 @@ int init_guest_pagetable(struct lguest *lg); void free_guest_pagetable(struct lguest *lg); void guest_new_pagetable(struct lg_cpu *cpu, unsigned long pgtable); void guest_set_pgd(struct lguest *lg, unsigned long gpgdir, u32 i); +#ifdef CONFIG_X86_PAE +void guest_set_pmd(struct lguest *lg, unsigned long gpgdir, u32 i); +#endif void guest_pagetable_clear_all(struct lg_cpu *cpu); void guest_pagetable_flush_user(struct lg_cpu *cpu); void guest_set_pte(struct lg_cpu *cpu, unsigned long gpgdir, diff --git a/drivers/...
2007 Apr 18
1
[RFC/PATCH LGUEST X86_64 03/13] lguest64 core
...+#define SAVE_CR2(cr2) asm volatile ("movq %%cr2, %0" : "=r" (cr2)) + +static void run_guest_once(struct lguest_vcpu *vcpu) +{ + void (*sw_guest)(struct lguest_vcpu *) = HV_OFFSET(&switch_to_guest); + unsigned long foo, bar; + + BUG_ON(!vcpu->regs.cr3); + BUG_ON(!vcpu->pgdir); + BUG_ON(!vcpu->pgdir->pgdir); + asm volatile ("pushq %2; pushq %%rsp; pushfq; pushq %3; call *%6;" + /* The stack we pushed is off by 8, due to the previous pushq */ + "addq $8, %%rsp" + : "=D"(foo), "=a"(bar) + : "i&...
2007 Apr 18
1
[RFC/PATCH LGUEST X86_64 03/13] lguest64 core
...+#define SAVE_CR2(cr2) asm volatile ("movq %%cr2, %0" : "=r" (cr2)) + +static void run_guest_once(struct lguest_vcpu *vcpu) +{ + void (*sw_guest)(struct lguest_vcpu *) = HV_OFFSET(&switch_to_guest); + unsigned long foo, bar; + + BUG_ON(!vcpu->regs.cr3); + BUG_ON(!vcpu->pgdir); + BUG_ON(!vcpu->pgdir->pgdir); + asm volatile ("pushq %2; pushq %%rsp; pushfq; pushq %3; call *%6;" + /* The stack we pushed is off by 8, due to the previous pushq */ + "addq $8, %%rsp" + : "=D"(foo), "=a"(bar) + : "i&...
2008 Dec 29
0
[PULL] virtio and lguest tree
...which will get the Guest far enough - * into the boot to create its own. - * - * We lay them out of the way, just below the initrd (which is why we need to - * know its size here). */ -static unsigned long setup_pagetables(unsigned long mem, - unsigned long initrd_size) -{ - unsigned long *pgdir, *linear; - unsigned int mapped_pages, i, linear_pages; - unsigned int ptes_per_page = getpagesize()/sizeof(void *); - - mapped_pages = mem/getpagesize(); - - /* Each PTE page can map ptes_per_page pages: how many do we need? */ - linear_pages = (mapped_pages + ptes_per_page-1)/ptes_per_page; - - /...
2008 Dec 29
0
[PULL] virtio and lguest tree
...which will get the Guest far enough - * into the boot to create its own. - * - * We lay them out of the way, just below the initrd (which is why we need to - * know its size here). */ -static unsigned long setup_pagetables(unsigned long mem, - unsigned long initrd_size) -{ - unsigned long *pgdir, *linear; - unsigned int mapped_pages, i, linear_pages; - unsigned int ptes_per_page = getpagesize()/sizeof(void *); - - mapped_pages = mem/getpagesize(); - - /* Each PTE page can map ptes_per_page pages: how many do we need? */ - linear_pages = (mapped_pages + ptes_per_page-1)/ptes_per_page; - - /...
2007 May 09
1
[patch 3/9] lguest: the host code
...signed int clobber; + + copy_in_guest_info(lg, pages); + + /* Put eflags on stack, lcall does rest: suitable for iret return. */ + asm volatile("pushf; lcall *lguest_entry" + : "=a"(clobber), "=b"(clobber) + : "0"(pages), "1"(__pa(lg->pgdirs[lg->pgdidx].pgdir)) + : "memory", "%edx", "%ecx", "%edi", "%esi"); +} + +int run_guest(struct lguest *lg, char *__user user) +{ + while (!lg->dead) { + unsigned int cr2 = 0; /* Damn gcc */ + + /* Hypercalls first: we might have been o...
2007 May 09
1
[patch 3/9] lguest: the host code
...signed int clobber; + + copy_in_guest_info(lg, pages); + + /* Put eflags on stack, lcall does rest: suitable for iret return. */ + asm volatile("pushf; lcall *lguest_entry" + : "=a"(clobber), "=b"(clobber) + : "0"(pages), "1"(__pa(lg->pgdirs[lg->pgdidx].pgdir)) + : "memory", "%edx", "%ecx", "%edi", "%esi"); +} + +int run_guest(struct lguest *lg, char *__user user) +{ + while (!lg->dead) { + unsigned int cr2 = 0; /* Damn gcc */ + + /* Hypercalls first: we might have been o...
2007 Jul 20
2
[PATCH] Remove -static from Documentation/lguest/Makefile
...e verbose(args...) \ do { if (verbose) printf(args); } while(0) static int waker_fd; +static u32 top; struct device_list { fd_set infds; int max_infd; + struct lguest_device_desc *descs; struct device *dev; struct device **lastdev; }; @@ -324,8 +326,7 @@ static int tell_kernel(u32 pgdir, u32 st static int tell_kernel(u32 pgdir, u32 start, u32 page_offset) { u32 args[] = { LHREQ_INITIALIZE, - LGUEST_GUEST_TOP/getpagesize(), /* Just below us */ - pgdir, start, page_offset }; + top/getpagesize(), pgdir, start, page_offset }; int fd; fd = open_or_die(...
2007 Jul 20
2
[PATCH] Remove -static from Documentation/lguest/Makefile
...e verbose(args...) \ do { if (verbose) printf(args); } while(0) static int waker_fd; +static u32 top; struct device_list { fd_set infds; int max_infd; + struct lguest_device_desc *descs; struct device *dev; struct device **lastdev; }; @@ -324,8 +326,7 @@ static int tell_kernel(u32 pgdir, u32 st static int tell_kernel(u32 pgdir, u32 start, u32 page_offset) { u32 args[] = { LHREQ_INITIALIZE, - LGUEST_GUEST_TOP/getpagesize(), /* Just below us */ - pgdir, start, page_offset }; + top/getpagesize(), pgdir, start, page_offset }; int fd; fd = open_or_die(...
2007 Apr 18
1
[PATCH 0/2] Use a single loader for i386 and x86_64
...ng /dev/zero for %li bytes", mem); } -static u32 finish(unsigned long mem, unsigned long *page_offset, - const char *initrd, unsigned long *ird_size) +static unsigned long finish32(unsigned long mem, unsigned long *page_offset, + const char *initrd, unsigned long *ird_size) { u32 *pgdir = NULL, *linear = NULL; int i, pte_pages; @@ -169,7 +180,7 @@ static u32 finish(unsigned long mem, uns /* Now set up pgd so that this memory is at page_offset */ for (i = 0; i < mem / getpagesize(); i += getpagesize()/sizeof(u32)) { pgdir[(i + *page_offset/getpagesize())/1024] - = (((...
2007 Apr 18
1
[PATCH 0/2] Use a single loader for i386 and x86_64
...ng /dev/zero for %li bytes", mem); } -static u32 finish(unsigned long mem, unsigned long *page_offset, - const char *initrd, unsigned long *ird_size) +static unsigned long finish32(unsigned long mem, unsigned long *page_offset, + const char *initrd, unsigned long *ird_size) { u32 *pgdir = NULL, *linear = NULL; int i, pte_pages; @@ -169,7 +180,7 @@ static u32 finish(unsigned long mem, uns /* Now set up pgd so that this memory is at page_offset */ for (i = 0; i < mem / getpagesize(); i += getpagesize()/sizeof(u32)) { pgdir[(i + *page_offset/getpagesize())/1024] - = (((...
2009 Sep 24
0
[Lguest] [PATCH 3/5] lguest: use PGDIR_SHIFT for PAE code to allow different PAGE_OFFSET
...hanged, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c > --- a/drivers/lguest/page_tables.c > +++ b/drivers/lguest/page_tables.c > @@ -996,11 +996,9 @@ static unsigned long setup_pagetables(st > if (copy_to_user(&pgdir[0], &pgd, sizeof(pgd)) != 0) > return -EFAULT; > /* > - * And the third PGD entry (ie. addresses 3G-4G). > - * > - * FIXME: This assumes that PAGE_OFFSET for the Guest is 0xC0000000. > + * And the other PGD entry to make the linear mapping at PAGE_OFFSET > */ &g...
2009 Sep 24
0
[Lguest] [PATCH 3/5] lguest: use PGDIR_SHIFT for PAE code to allow different PAGE_OFFSET
...hanged, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c > --- a/drivers/lguest/page_tables.c > +++ b/drivers/lguest/page_tables.c > @@ -996,11 +996,9 @@ static unsigned long setup_pagetables(st > if (copy_to_user(&pgdir[0], &pgd, sizeof(pgd)) != 0) > return -EFAULT; > /* > - * And the third PGD entry (ie. addresses 3G-4G). > - * > - * FIXME: This assumes that PAGE_OFFSET for the Guest is 0xC0000000. > + * And the other PGD entry to make the linear mapping at PAGE_OFFSET > */ &g...
2007 Apr 18
0
[RFC/PATCH LGUEST X86_64 07/13] lguest64 loader
...+ if (mmap(0, mem, + PROT_READ|PROT_WRITE|PROT_EXEC, + MAP_FIXED|MAP_PRIVATE, zero_fd, 0) != (void *)0) + err(1, "Mmaping /dev/zero for %li bytes", mem); +} + +static u32 finish(unsigned long mem, unsigned long *page_offset, + const char *initrd, unsigned long *ird_size) +{ + u32 *pgdir = NULL, *linear = NULL; + int i, pte_pages; + + /* This is a top of mem. */ + *ird_size = load_initrd(initrd, mem); + + /* Below initrd is used as top level of pagetable. */ + pte_pages = 1 + (mem/getpagesize() + 1023)/1024; + + pgdir = (u32 *)page_align(mem - *ird_size - pte_pages*getpagesize());...
2007 Apr 18
0
[RFC/PATCH LGUEST X86_64 07/13] lguest64 loader
...+ if (mmap(0, mem, + PROT_READ|PROT_WRITE|PROT_EXEC, + MAP_FIXED|MAP_PRIVATE, zero_fd, 0) != (void *)0) + err(1, "Mmaping /dev/zero for %li bytes", mem); +} + +static u32 finish(unsigned long mem, unsigned long *page_offset, + const char *initrd, unsigned long *ird_size) +{ + u32 *pgdir = NULL, *linear = NULL; + int i, pte_pages; + + /* This is a top of mem. */ + *ird_size = load_initrd(initrd, mem); + + /* Below initrd is used as top level of pagetable. */ + pte_pages = 1 + (mem/getpagesize() + 1023)/1024; + + pgdir = (u32 *)page_align(mem - *ird_size - pte_pages*getpagesize());...