]> err.no Git - linux-2.6/blobdiff - arch/um/sys-i386/ldt.c
Merge branches 'release' and 'autoload' into release
[linux-2.6] / arch / um / sys-i386 / ldt.c
index 0bf7572a80a35d2b3bdf40c35cec4fec8699b7e9..a34263e6b08d3cc2cedf5e87ed0083ef05288e0b 100644 (file)
@@ -3,8 +3,9 @@
  * Licensed under the GPL
  */
 
-#include "linux/mm.h"
-#include "asm/unistd.h"
+#include <linux/mm.h>
+#include <linux/sched.h>
+#include <asm/unistd.h>
 #include "os.h"
 #include "proc_mm.h"
 #include "skas.h"
@@ -33,7 +34,7 @@ long write_ldt_entry(struct mm_id * mm_idp, int func, struct user_desc * desc,
                 * Note: I'm unsure: should interrupts be disabled here?
                 */
                if (!current->active_mm || current->active_mm == &init_mm ||
-                   mm_idp != &current->active_mm->context.skas.id)
+                   mm_idp != &current->active_mm->context.id)
                        __switch_mm(mm_idp);
        }
 
@@ -79,8 +80,8 @@ long write_ldt_entry(struct mm_id * mm_idp, int func, struct user_desc * desc,
                 * PTRACE_LDT possible to implement.
                 */
                if (current->active_mm && current->active_mm != &init_mm &&
-                   mm_idp != &current->active_mm->context.skas.id)
-                       __switch_mm(&current->active_mm->context.skas.id);
+                   mm_idp != &current->active_mm->context.id)
+                       __switch_mm(&current->active_mm->context.id);
        }
 
        return res;
@@ -135,7 +136,7 @@ static int read_ldt(void __user * ptr, unsigned long bytecount)
 {
        int i, err = 0;
        unsigned long size;
-       uml_ldt_t * ldt = &current->mm->context.skas.ldt;
+       uml_ldt_t * ldt = &current->mm->context.ldt;
 
        if (!ldt->entry_count)
                goto out;
@@ -146,7 +147,7 @@ static int read_ldt(void __user * ptr, unsigned long bytecount)
        if (ptrace_ldt)
                return read_ldt_from_host(ptr, bytecount);
 
-       down(&ldt->semaphore);
+       mutex_lock(&ldt->lock);
        if (ldt->entry_count <= LDT_DIRECT_ENTRIES) {
                size = LDT_ENTRY_SIZE*LDT_DIRECT_ENTRIES;
                if (size > bytecount)
@@ -170,7 +171,7 @@ static int read_ldt(void __user * ptr, unsigned long bytecount)
                        ptr += size;
                }
        }
-       up(&ldt->semaphore);
+       mutex_unlock(&ldt->lock);
 
        if (bytecount == 0 || err == -EFAULT)
                goto out;
@@ -203,8 +204,8 @@ static int read_default_ldt(void __user * ptr, unsigned long bytecount)
 
 static int write_ldt(void __user * ptr, unsigned long bytecount, int func)
 {
-       uml_ldt_t * ldt = &current->mm->context.skas.ldt;
-       struct mm_id * mm_idp = &current->mm->context.skas.id;
+       uml_ldt_t * ldt = &current->mm->context.ldt;
+       struct mm_id * mm_idp = &current->mm->context.id;
        int i, err;
        struct user_desc ldt_info;
        struct ldt_entry entry0, *ldt_p;
@@ -228,7 +229,7 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int func)
        }
 
        if (!ptrace_ldt)
-               down(&ldt->semaphore);
+               mutex_lock(&ldt->lock);
 
        err = write_ldt_entry(mm_idp, func, &ldt_info, &addr, 1);
        if (err)
@@ -288,7 +289,7 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int func)
        err = 0;
 
 out_unlock:
-       up(&ldt->semaphore);
+       mutex_unlock(&ldt->lock);
 out:
        return err;
 }
@@ -384,8 +385,7 @@ out_free:
        free_pages((unsigned long)ldt, order);
 }
 
-long init_new_ldt(struct mmu_context_skas * new_mm,
-                 struct mmu_context_skas * from_mm)
+long init_new_ldt(struct mm_context *new_mm, struct mm_context *from_mm)
 {
        struct user_desc desc;
        short * num_p;
@@ -396,7 +396,7 @@ long init_new_ldt(struct mmu_context_skas * new_mm,
 
 
        if (!ptrace_ldt)
-               init_MUTEX(&new_mm->ldt.semaphore);
+               mutex_init(&new_mm->ldt.lock);
 
        if (!from_mm) {
                memset(&desc, 0, sizeof(desc));
@@ -456,7 +456,7 @@ long init_new_ldt(struct mmu_context_skas * new_mm,
                 * i.e., we have to use the stub for modify_ldt, which
                 * can't handle the big read buffer of up to 64kB.
                 */
-               down(&from_mm->ldt.semaphore);
+               mutex_lock(&from_mm->ldt.lock);
                if (from_mm->ldt.entry_count <= LDT_DIRECT_ENTRIES)
                        memcpy(new_mm->ldt.u.entries, from_mm->ldt.u.entries,
                               sizeof(new_mm->ldt.u.entries));
@@ -475,7 +475,7 @@ long init_new_ldt(struct mmu_context_skas * new_mm,
                        }
                }
                new_mm->ldt.entry_count = from_mm->ldt.entry_count;
-               up(&from_mm->ldt.semaphore);
+               mutex_unlock(&from_mm->ldt.lock);
        }
 
     out:
@@ -483,7 +483,7 @@ long init_new_ldt(struct mmu_context_skas * new_mm,
 }
 
 
-void free_ldt(struct mmu_context_skas * mm)
+void free_ldt(struct mm_context *mm)
 {
        int i;