Displaying 10 results from an estimated 10 matches for "destroy_ldt".
2007 Apr 18
2
[PATCH 21/21] i386 Ldt context inline
...============================
--- linux-2.6.14-zach-work.orig/include/asm-i386/desc.h 2005-11-05 02:30:35.000000000 -0800
+++ linux-2.6.14-zach-work/include/asm-i386/desc.h 2005-11-05 02:32:51.000000000 -0800
@@ -271,6 +271,9 @@ static inline void restore_bios_segments
put_cpu();
}
+extern void destroy_ldt(mm_context_t *pc);
+extern int copy_ldt(mm_context_t *new, mm_context_t *old);
+
#endif /* !__ASSEMBLY__ */
#endif
Index: linux-2.6.14-zach-work/include/asm-i386/mmu_context.h
===================================================================
--- linux-2.6.14-zach-work.orig/include/asm-i386/mm...
2007 Apr 18
2
[PATCH 21/21] i386 Ldt context inline
...============================
--- linux-2.6.14-zach-work.orig/include/asm-i386/desc.h 2005-11-05 02:30:35.000000000 -0800
+++ linux-2.6.14-zach-work/include/asm-i386/desc.h 2005-11-05 02:32:51.000000000 -0800
@@ -271,6 +271,9 @@ static inline void restore_bios_segments
put_cpu();
}
+extern void destroy_ldt(mm_context_t *pc);
+extern int copy_ldt(mm_context_t *new, mm_context_t *old);
+
#endif /* !__ASSEMBLY__ */
#endif
Index: linux-2.6.14-zach-work/include/asm-i386/mmu_context.h
===================================================================
--- linux-2.6.14-zach-work.orig/include/asm-i386/mm...
2007 Apr 18
0
[PATCH 12/14] i386 / Move context switch inline
...;
+ if (!err)
+ memcpy(new->ldt, old->ldt, old->size*LDT_ENTRY_SIZE);
+ up(&old->sem);
+ return err;
}
-/*
- * we do not have to muck with descriptors here, that is
- * done in switch_mm() as needed.
- */
-int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
+void destroy_ldt(struct mm_struct *mm)
{
- struct mm_struct * old_mm;
- int retval = 0;
-
- init_MUTEX(&mm->context.sem);
+ if (mm == current->active_mm)
+ clear_LDT();
+ if (mm->context.size*LDT_ENTRY_SIZE > PAGE_SIZE)
+ vfree(mm->context.ldt);
+ else
+ kfree(mm->context.ldt);
mm->co...
2007 Apr 18
0
[PATCH 12/14] i386 / Move context switch inline
...;
+ if (!err)
+ memcpy(new->ldt, old->ldt, old->size*LDT_ENTRY_SIZE);
+ up(&old->sem);
+ return err;
}
-/*
- * we do not have to muck with descriptors here, that is
- * done in switch_mm() as needed.
- */
-int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
+void destroy_ldt(struct mm_struct *mm)
{
- struct mm_struct * old_mm;
- int retval = 0;
-
- init_MUTEX(&mm->context.sem);
+ if (mm == current->active_mm)
+ clear_LDT();
+ if (mm->context.size*LDT_ENTRY_SIZE > PAGE_SIZE)
+ vfree(mm->context.ldt);
+ else
+ kfree(mm->context.ldt);
mm->co...
2007 Apr 18
2
[PATCH 3/6] i386 virtualization - Make ldt a desc struct
...gt; retval = copy_ldt(&mm->context, &old_mm->context);
> }
> if (retval == 0)
> @@ -32,7 +32,7 @@
> */
> static inline void destroy_context(struct mm_struct *mm)
> {
> - if (unlikely(mm->context.size))
> + if (unlikely(mm->context.ldt))
> destroy_ldt(mm);
> del_lazy_mm(mm);
> }
> Index: linux-2.6.13/include/asm-i386/mach-default/mach_desc.h
> ===================================================================
> --- linux-2.6.13.orig/include/asm-i386/mach-default/mach_desc.h 2005-08-15 11:16:59.000000000 -0700
> +++ linux-2....
2007 Apr 18
2
[PATCH 3/6] i386 virtualization - Make ldt a desc struct
...gt; retval = copy_ldt(&mm->context, &old_mm->context);
> }
> if (retval == 0)
> @@ -32,7 +32,7 @@
> */
> static inline void destroy_context(struct mm_struct *mm)
> {
> - if (unlikely(mm->context.size))
> + if (unlikely(mm->context.ldt))
> destroy_ldt(mm);
> del_lazy_mm(mm);
> }
> Index: linux-2.6.13/include/asm-i386/mach-default/mach_desc.h
> ===================================================================
> --- linux-2.6.13.orig/include/asm-i386/mach-default/mach_desc.h 2005-08-15 11:16:59.000000000 -0700
> +++ linux-2....
2007 Apr 18
0
[PATCH 20/21] i386 Ldt cleanups 3
...rn err;
- memcpy(new->ldt, old->ldt, old->size*LDT_ENTRY_SIZE);
- return 0;
+ int err;
+
+ down(&old->sem);
+ err = alloc_ldt(new, 0, old->ldt_pages, 0);
+ if (!err)
+ memcpy(new->ldt, old->ldt, old->ldt_pages*PAGE_SIZE);
+ up(&old->sem);
+ return err;
+}
+
+void destroy_ldt(mm_context_t *pc)
+{
+ int pages = pc->ldt_pages;
+ struct desc_struct *ldt = pc->ldt;
+
+ if (pc == ¤t->active_mm->context)
+ clear_LDT();
+ if (pages > 1)
+ vfree(ldt);
+ else
+ kfree(ldt);
+ pc->ldt_pages = 0;
+ pc->ldt = NULL;
}
-/*
- * we do not have to muc...
2007 Apr 18
0
[PATCH 20/21] i386 Ldt cleanups 3
...rn err;
- memcpy(new->ldt, old->ldt, old->size*LDT_ENTRY_SIZE);
- return 0;
+ int err;
+
+ down(&old->sem);
+ err = alloc_ldt(new, 0, old->ldt_pages, 0);
+ if (!err)
+ memcpy(new->ldt, old->ldt, old->ldt_pages*PAGE_SIZE);
+ up(&old->sem);
+ return err;
+}
+
+void destroy_ldt(mm_context_t *pc)
+{
+ int pages = pc->ldt_pages;
+ struct desc_struct *ldt = pc->ldt;
+
+ if (pc == ¤t->active_mm->context)
+ clear_LDT();
+ if (pages > 1)
+ vfree(ldt);
+ else
+ kfree(ldt);
+ pc->ldt_pages = 0;
+ pc->ldt = NULL;
}
-/*
- * we do not have to muc...
2007 Apr 18
0
[PATCH 14/14] i386 / Introduce hypervisor lazy pinning hooks
....size = 0;
old_mm = current->mm;
if (old_mm && unlikely(old_mm->context.size > 0)) {
retval = copy_ldt(&mm->context, &old_mm->context);
}
+ if (retval == 0)
+ add_lazy_mm(mm);
return retval;
}
@@ -31,6 +34,7 @@
{
if (unlikely(mm->context.size))
destroy_ldt(mm);
+ del_lazy_mm(mm);
}
static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
Index: linux-2.6.13/include/asm-i386/mach-default/mach_mmu.h
===================================================================
--- linux-2.6.13.orig/include/asm-i386/mach-default/mach_mm...
2007 Apr 18
0
[PATCH 14/14] i386 / Introduce hypervisor lazy pinning hooks
....size = 0;
old_mm = current->mm;
if (old_mm && unlikely(old_mm->context.size > 0)) {
retval = copy_ldt(&mm->context, &old_mm->context);
}
+ if (retval == 0)
+ add_lazy_mm(mm);
return retval;
}
@@ -31,6 +34,7 @@
{
if (unlikely(mm->context.size))
destroy_ldt(mm);
+ del_lazy_mm(mm);
}
static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
Index: linux-2.6.13/include/asm-i386/mach-default/mach_mmu.h
===================================================================
--- linux-2.6.13.orig/include/asm-i386/mach-default/mach_mm...