m68knommu: NPTL support for uClinux
authorMaxim Kuvyrkov <maxim@codesourcery.com>
Sun, 6 Dec 2009 18:08:14 +0000 (10:08 -0800)
committerGeert Uytterhoeven <geert@linux-m68k.org>
Sat, 27 Feb 2010 17:35:22 +0000 (18:35 +0100)
Port syscalls for NPTL support to m68knommu.

Signed-off-by: Maxim Kuvyrkov <maxim@codesourcery.com>
Acked-by: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
arch/m68k/include/asm/thread_info_no.h
arch/m68knommu/kernel/process.c
arch/m68knommu/kernel/ptrace.c
arch/m68knommu/kernel/sys_m68k.c
arch/m68knommu/kernel/syscalltable.S

index a6512bfdd01ddbe5dc304d7fc72e985bd3478259..884776f686cacf4159699a00953e4203ee0e8537 100644 (file)
@@ -37,6 +37,7 @@ struct thread_info {
        unsigned long      flags;               /* low level flags */
        int                cpu;                 /* cpu we're on */
        int                preempt_count;       /* 0 => preemptable, <0 => BUG */
+       unsigned long      tp_value;            /* thread pointer */
        struct restart_block restart_block;
 };
 
index 5c9ecd427090c0a8b5c701b2bdddf21072d44582..959cb249c759fd4cae926a49259a67c9893fac34 100644 (file)
@@ -221,6 +221,10 @@ int copy_thread(unsigned long clone_flags,
 
        p->thread.usp = usp;
        p->thread.ksp = (unsigned long)childstack;
+
+       if (clone_flags & CLONE_SETTLS)
+               task_thread_info(p)->tp_value = regs->d5;
+
        /*
         * Must save the current SFC/DFC value, NOT the value when
         * the parent was last descheduled - RGH  10-08-96
index 4d3828959fb05465d97de3e4e12cf288f8bd0276..85ed2f988f98d882e32b3c72cd400cba16e3974a 100644 (file)
@@ -319,6 +319,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                }
 #endif
 
+       case PTRACE_GET_THREAD_AREA:
+               ret = put_user(task_thread_info(child)->tp_value,
+                              (unsigned long __user *)data);
+               break;
+
                default:
                        ret = -EIO;
                        break;
index b67cbc735a9b13d7e0ca3d52fdef01b3ff944d09..923dd4aab8758378489d78c91cb11d37151335c8 100644 (file)
@@ -190,3 +190,39 @@ int kernel_execve(const char *filename, char *const argv[], char *const envp[])
                        : "d" (__a), "d" (__b), "d" (__c));
        return __res;
 }
+
+asmlinkage unsigned long sys_get_thread_area(void)
+{
+       return current_thread_info()->tp_value;
+}
+
+asmlinkage int sys_set_thread_area(unsigned long tp)
+{
+       current_thread_info()->tp_value = tp;
+       return 0;
+}
+
+/* This syscall gets its arguments in A0 (mem), D2 (oldval) and
+   D1 (newval).  */
+asmlinkage int
+sys_atomic_cmpxchg_32(unsigned long newval, int oldval, int d3, int d4, int d5,
+                     unsigned long __user * mem)
+{
+       struct mm_struct *mm = current->mm;
+       unsigned long mem_value;
+
+       down_read(&mm->mmap_sem);
+
+       mem_value = *mem;
+       if (mem_value == oldval)
+               *mem = newval;
+
+       up_read(&mm->mmap_sem);
+       return mem_value;
+}
+
+asmlinkage int sys_atomic_barrier(void)
+{
+       /* no code needed for uniprocs */
+       return 0;
+}
index 486837efa3d788d5196f77130675880d23a43a0d..56dd01ded148c09a1ee3751873db9e407ea4d336 100644 (file)
@@ -351,6 +351,10 @@ ENTRY(sys_call_table)
        .long sys_pwritev               /* 330 */
        .long sys_rt_tgsigqueueinfo
        .long sys_perf_event_open
+       .long sys_get_thread_area
+       .long sys_set_thread_area
+       .long sys_atomic_cmpxchg_32     /* 335 */
+       .long sys_atomic_barrier
 
        .rept NR_syscalls-(.-sys_call_table)/4
                .long sys_ni_syscall