Merge tag 'locking-urgent-2020-08-10' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-microblaze.git] / arch / ia64 / kernel / process.c
index 96dfb9e..f19cb97 100644 (file)
@@ -40,7 +40,6 @@
 #include <asm/elf.h>
 #include <asm/irq.h>
 #include <asm/kexec.h>
-#include <asm/pgalloc.h>
 #include <asm/processor.h>
 #include <asm/sal.h>
 #include <asm/switch_to.h>
@@ -48,6 +47,7 @@
 #include <linux/uaccess.h>
 #include <asm/unwind.h>
 #include <asm/user.h>
+#include <asm/xtp.h>
 
 #include "entry.h"
 
@@ -296,7 +296,7 @@ ia64_load_extra (struct task_struct *task)
                pfm_load_regs(task);
 
        info = __this_cpu_read(pfm_syst_info);
-       if (info & PFM_CPUINFO_SYST_WIDE) 
+       if (info & PFM_CPUINFO_SYST_WIDE)
                pfm_syst_wide_update_task(task, info, 1);
 #endif
 }
@@ -310,7 +310,7 @@ ia64_load_extra (struct task_struct *task)
  *
  *     <clone syscall>         <some kernel call frames>
  *     sys_clone                  :
- *     do_fork                 do_fork
+ *     _do_fork                _do_fork
  *     copy_thread             copy_thread
  *
  * This means that the stack layout is as follows:
@@ -333,9 +333,8 @@ ia64_load_extra (struct task_struct *task)
  * so there is nothing to worry about.
  */
 int
-copy_thread(unsigned long clone_flags,
-            unsigned long user_stack_base, unsigned long user_stack_size,
-            struct task_struct *p)
+copy_thread(unsigned long clone_flags, unsigned long user_stack_base,
+           unsigned long user_stack_size, struct task_struct *p, unsigned long tls)
 {
        extern char ia64_ret_from_clone;
        struct switch_stack *child_stack, *stack;
@@ -416,7 +415,7 @@ copy_thread(unsigned long clone_flags,
        rbs_size = stack->ar_bspstore - rbs;
        memcpy((void *) child_rbs, (void *) rbs, rbs_size);
        if (clone_flags & CLONE_SETTLS)
-               child_ptregs->r13 = regs->r16;  /* see sys_clone2() in entry.S */
+               child_ptregs->r13 = tls;
        if (user_stack_base) {
                child_ptregs->r12 = user_stack_base + user_stack_size - 16;
                child_ptregs->ar_bspstore = user_stack_base;
@@ -441,11 +440,29 @@ copy_thread(unsigned long clone_flags,
        return retval;
 }
 
+asmlinkage long ia64_clone(unsigned long clone_flags, unsigned long stack_start,
+                          unsigned long stack_size, unsigned long parent_tidptr,
+                          unsigned long child_tidptr, unsigned long tls)
+{
+       struct kernel_clone_args args = {
+               .flags          = (lower_32_bits(clone_flags) & ~CSIGNAL),
+               .pidfd          = (int __user *)parent_tidptr,
+               .child_tid      = (int __user *)child_tidptr,
+               .parent_tid     = (int __user *)parent_tidptr,
+               .exit_signal    = (lower_32_bits(clone_flags) & CSIGNAL),
+               .stack          = stack_start,
+               .stack_size     = stack_size,
+               .tls            = tls,
+       };
+
+       return _do_fork(&args);
+}
+
 static void
 do_copy_task_regs (struct task_struct *task, struct unw_frame_info *info, void *arg)
 {
        unsigned long mask, sp, nat_bits = 0, ar_rnat, urbs_end, cfm;
-       unsigned long uninitialized_var(ip);    /* GCC be quiet */
+       unsigned long ip;
        elf_greg_t *dst = arg;
        struct pt_regs *pt;
        char nat;
@@ -514,52 +531,18 @@ do_copy_task_regs (struct task_struct *task, struct unw_frame_info *info, void *
        unw_get_ar(info, UNW_AR_SSD, &dst[56]);
 }
 
-void
-do_dump_task_fpu (struct task_struct *task, struct unw_frame_info *info, void *arg)
-{
-       elf_fpreg_t *dst = arg;
-       int i;
-
-       memset(dst, 0, sizeof(elf_fpregset_t)); /* don't leak any "random" bits */
-
-       if (unw_unwind_to_user(info) < 0)
-               return;
-
-       /* f0 is 0.0, f1 is 1.0 */
-
-       for (i = 2; i < 32; ++i)
-               unw_get_fr(info, i, dst + i);
-
-       ia64_flush_fph(task);
-       if ((task->thread.flags & IA64_THREAD_FPH_VALID) != 0)
-               memcpy(dst + 32, task->thread.fph, 96*16);
-}
-
 void
 do_copy_regs (struct unw_frame_info *info, void *arg)
 {
        do_copy_task_regs(current, info, arg);
 }
 
-void
-do_dump_fpu (struct unw_frame_info *info, void *arg)
-{
-       do_dump_task_fpu(current, info, arg);
-}
-
 void
 ia64_elf_core_copy_regs (struct pt_regs *pt, elf_gregset_t dst)
 {
        unw_init_running(do_copy_regs, dst);
 }
 
-int
-dump_fpu (struct pt_regs *pt, elf_fpregset_t dst)
-{
-       unw_init_running(do_dump_fpu, dst);
-       return 1;       /* f0-f31 are always valid so we always return 1 */
-}
-
 /*
  * Flush thread state.  This is called when a thread does an execve().
  */