process_64.c (98817a84ff1c755c347ac633ff017a623a631fad) process_64.c (714acdbd1c94e7e3ab90f6b6938f1ccb27b662f0)
1// SPDX-License-Identifier: GPL-2.0
2/* arch/sparc64/kernel/process.c
3 *
4 * Copyright (C) 1995, 1996, 2008 David S. Miller (davem@davemloft.net)
5 * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be)
6 * Copyright (C) 1997, 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
7 */
8

--- 558 unchanged lines hidden (view full) ---

567 set_thread_wsaved(0);
568 return;
569
570barf:
571 set_thread_wsaved(window + 1);
572 force_sig(SIGSEGV);
573}
574
1// SPDX-License-Identifier: GPL-2.0
2/* arch/sparc64/kernel/process.c
3 *
4 * Copyright (C) 1995, 1996, 2008 David S. Miller (davem@davemloft.net)
5 * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be)
6 * Copyright (C) 1997, 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
7 */
8

--- 558 unchanged lines hidden (view full) ---

567 set_thread_wsaved(0);
568 return;
569
570barf:
571 set_thread_wsaved(window + 1);
572 force_sig(SIGSEGV);
573}
574
575asmlinkage long sparc_do_fork(unsigned long clone_flags,
576 unsigned long stack_start,
577 struct pt_regs *regs,
578 unsigned long stack_size)
579{
580 int __user *parent_tid_ptr, *child_tid_ptr;
581 unsigned long orig_i1 = regs->u_regs[UREG_I1];
582 long ret;
583
584#ifdef CONFIG_COMPAT
585 if (test_thread_flag(TIF_32BIT)) {
586 parent_tid_ptr = compat_ptr(regs->u_regs[UREG_I2]);
587 child_tid_ptr = compat_ptr(regs->u_regs[UREG_I4]);
588 } else
589#endif
590 {
591 parent_tid_ptr = (int __user *) regs->u_regs[UREG_I2];
592 child_tid_ptr = (int __user *) regs->u_regs[UREG_I4];
593 }
594
595 ret = do_fork(clone_flags, stack_start, stack_size,
596 parent_tid_ptr, child_tid_ptr);
597
598 /* If we get an error and potentially restart the system
599 * call, we're screwed because copy_thread() clobbered
600 * the parent's %o1. So detect that case and restore it
601 * here.
602 */
603 if ((unsigned long)ret >= -ERESTART_RESTARTBLOCK)
604 regs->u_regs[UREG_I1] = orig_i1;
605
606 return ret;
607}
608
609/* Copy a Sparc thread. The fork() return value conventions
610 * under SunOS are nothing short of bletcherous:
611 * Parent --> %o0 == childs pid, %o1 == 0
612 * Child --> %o0 == parents pid, %o1 == 1
613 */
575/* Copy a Sparc thread. The fork() return value conventions
576 * under SunOS are nothing short of bletcherous:
577 * Parent --> %o0 == childs pid, %o1 == 0
578 * Child --> %o0 == parents pid, %o1 == 1
579 */
614int copy_thread(unsigned long clone_flags, unsigned long sp,
615 unsigned long arg, struct task_struct *p)
580int copy_thread(unsigned long clone_flags, unsigned long sp, unsigned long arg,
581 struct task_struct *p, unsigned long tls)
616{
617 struct thread_info *t = task_thread_info(p);
618 struct pt_regs *regs = current_pt_regs();
619 struct sparc_stackf *parent_sf;
620 unsigned long child_stack_sz;
621 char *child_trap_frame;
622
623 /* Calculate offset to stack_frame & pt_regs */

--- 41 unchanged lines hidden (view full) ---

665 /* Set the return value for the child. */
666 t->kregs->u_regs[UREG_I0] = current->pid;
667 t->kregs->u_regs[UREG_I1] = 1;
668
669 /* Set the second return value for the parent. */
670 regs->u_regs[UREG_I1] = 0;
671
672 if (clone_flags & CLONE_SETTLS)
582{
583 struct thread_info *t = task_thread_info(p);
584 struct pt_regs *regs = current_pt_regs();
585 struct sparc_stackf *parent_sf;
586 unsigned long child_stack_sz;
587 char *child_trap_frame;
588
589 /* Calculate offset to stack_frame & pt_regs */

--- 41 unchanged lines hidden (view full) ---

631 /* Set the return value for the child. */
632 t->kregs->u_regs[UREG_I0] = current->pid;
633 t->kregs->u_regs[UREG_I1] = 1;
634
635 /* Set the second return value for the parent. */
636 regs->u_regs[UREG_I1] = 0;
637
638 if (clone_flags & CLONE_SETTLS)
673 t->kregs->u_regs[UREG_G7] = regs->u_regs[UREG_I3];
639 t->kregs->u_regs[UREG_G7] = tls;
674
675 return 0;
676}
677
678/* TIF_MCDPER in thread info flags for current task is updated lazily upon
679 * a context switch. Update this flag in current task's thread flags
680 * before dup so the dup'd task will inherit the current TIF_MCDPER flag.
681 */

--- 118 unchanged lines hidden ---
640
641 return 0;
642}
643
644/* TIF_MCDPER in thread info flags for current task is updated lazily upon
645 * a context switch. Update this flag in current task's thread flags
646 * before dup so the dup'd task will inherit the current TIF_MCDPER flag.
647 */

--- 118 unchanged lines hidden ---