]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/um/sys-i386/tls.c
Merge branch 'genirq-v28-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-omap-h63xx.git] / arch / um / sys-i386 / tls.c
index b02266ab5c55fbf212cd6a6734b508880d3ae9a0..c6c7131e563bcab77bf69cdfc1ef9160c8c6f9d4 100644 (file)
@@ -26,6 +26,11 @@ int do_set_thread_area(struct user_desc *info)
        cpu = get_cpu();
        ret = os_set_thread_area(info, userspace_pid[cpu]);
        put_cpu();
+
+       if (ret)
+               printk(KERN_ERR "PTRACE_SET_THREAD_AREA failed, err = %d, "
+                      "index = %d\n", ret, info->entry_number);
+
        return ret;
 }
 
@@ -37,6 +42,11 @@ int do_get_thread_area(struct user_desc *info)
        cpu = get_cpu();
        ret = os_get_thread_area(info, userspace_pid[cpu]);
        put_cpu();
+
+       if (ret)
+               printk(KERN_ERR "PTRACE_GET_THREAD_AREA failed, err = %d, "
+                      "index = %d\n", ret, info->entry_number);
+
        return ret;
 }
 
@@ -45,7 +55,7 @@ int do_get_thread_area(struct user_desc *info)
  * XXX: Consider leaving one free slot for glibc usage at first place. This must
  * be done here (and by changing GDT_ENTRY_TLS_* macros) and nowhere else.
  *
- * Also, this must be tested when compiling in SKAS mode with dinamic linking
+ * Also, this must be tested when compiling in SKAS mode with dynamic linking
  * and running against NPTL.
  */
 static int get_free_idx(struct task_struct* task)
@@ -172,7 +182,7 @@ void clear_flushed_tls(struct task_struct *task)
  * SKAS patch.
  */
 
-int arch_switch_tls(struct task_struct *from, struct task_struct *to)
+int arch_switch_tls(struct task_struct *to)
 {
        if (!host_supports_tls)
                return 0;
@@ -225,7 +235,8 @@ out:
 }
 
 /* XXX: use do_get_thread_area to read the host value? I'm not at all sure! */
-static int get_tls_entry(struct task_struct* task, struct user_desc *info, int idx)
+static int get_tls_entry(struct task_struct *task, struct user_desc *info,
+                        int idx)
 {
        struct thread_struct *t = &task->thread;
 
@@ -263,7 +274,7 @@ clear:
        goto out;
 }
 
-asmlinkage int sys_set_thread_area(struct user_desc __user *user_desc)
+int sys_set_thread_area(struct user_desc __user *user_desc)
 {
        struct user_desc info;
        int idx, ret;
@@ -298,7 +309,7 @@ asmlinkage int sys_set_thread_area(struct user_desc __user *user_desc)
  * i386. However the only possible error are caused by bugs.
  */
 int ptrace_set_thread_area(struct task_struct *child, int idx,
-               struct user_desc __user *user_desc)
+                          struct user_desc __user *user_desc)
 {
        struct user_desc info;
 
@@ -311,7 +322,7 @@ int ptrace_set_thread_area(struct task_struct *child, int idx,
        return set_tls_entry(child, &info, idx, 0);
 }
 
-asmlinkage int sys_get_thread_area(struct user_desc __user *user_desc)
+int sys_get_thread_area(struct user_desc __user *user_desc)
 {
        struct user_desc info;
        int idx, ret;
@@ -355,10 +366,9 @@ out:
        return ret;
 }
 
-
 /*
- * XXX: This part is probably common to i386 and x86-64. Don't create a common
- * file for now, do that when implementing x86-64 support.
+ * This code is really i386-only, but it detects and logs x86_64 GDT indexes
+ * if a 32-bit UML is running on a 64-bit host.
  */
 static int __init __setup_host_supports_tls(void)
 {
@@ -367,13 +377,16 @@ static int __init __setup_host_supports_tls(void)
                printk(KERN_INFO "Host TLS support detected\n");
                printk(KERN_INFO "Detected host type: ");
                switch (host_gdt_entry_tls_min) {
-                       case GDT_ENTRY_TLS_MIN_I386:
-                               printk("i386\n");
-                               break;
-                       case GDT_ENTRY_TLS_MIN_X86_64:
-                               printk("x86_64\n");
-                               break;
+               case GDT_ENTRY_TLS_MIN_I386:
+                       printk(KERN_CONT "i386");
+                       break;
+               case GDT_ENTRY_TLS_MIN_X86_64:
+                       printk(KERN_CONT "x86_64");
+                       break;
                }
+               printk(KERN_CONT " (GDT indexes %d to %d)\n",
+                      host_gdt_entry_tls_min,
+                      host_gdt_entry_tls_min + GDT_ENTRY_TLS_ENTRIES);
        } else
                printk(KERN_ERR "  Host TLS support NOT detected! "
                                "TLS support inside UML will not work\n");