process_64.c (dcad2a62bc7948342404217831233957e8f169cc) | process_64.c (a4261d4bb45022e1b8b95df13dbb05abac490165) |
---|---|
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_fork(struct pt_regs *regs) 576{ 577 unsigned long orig_i1 = regs->u_regs[UREG_I1]; 578 long ret; 579 struct kernel_clone_args args = { 580 .exit_signal = SIGCHLD, 581 /* Reuse the parent's stack for the child. */ 582 .stack = regs->u_regs[UREG_FP], 583 }; 584 585 ret = _do_fork(&args); 586 587 /* If we get an error and potentially restart the system 588 * call, we're screwed because copy_thread_tls() clobbered 589 * the parent's %o1. So detect that case and restore it 590 * here. 591 */ 592 if ((unsigned long)ret >= -ERESTART_RESTARTBLOCK) 593 regs->u_regs[UREG_I1] = orig_i1; 594 595 return ret; 596} 597 598asmlinkage long sparc_vfork(struct pt_regs *regs) 599{ 600 unsigned long orig_i1 = regs->u_regs[UREG_I1]; 601 long ret; 602 603 struct kernel_clone_args args = { 604 .flags = CLONE_VFORK | CLONE_VM, 605 .exit_signal = SIGCHLD, 606 /* Reuse the parent's stack for the child. */ 607 .stack = regs->u_regs[UREG_FP], 608 }; 609 610 ret = _do_fork(&args); 611 612 /* If we get an error and potentially restart the system 613 * call, we're screwed because copy_thread_tls() clobbered 614 * the parent's %o1. So detect that case and restore it 615 * here. 616 */ 617 if ((unsigned long)ret >= -ERESTART_RESTARTBLOCK) 618 regs->u_regs[UREG_I1] = orig_i1; 619 620 return ret; 621} 622 623asmlinkage long sparc_clone(struct pt_regs *regs) 624{ 625 unsigned long orig_i1 = regs->u_regs[UREG_I1]; 626 unsigned int flags = lower_32_bits(regs->u_regs[UREG_I0]); 627 long ret; 628 629 struct kernel_clone_args args = { 630 .flags = (flags & ~CSIGNAL), 631 .exit_signal = (flags & CSIGNAL), 632 .tls = regs->u_regs[UREG_I3], 633 }; 634 635#ifdef CONFIG_COMPAT 636 if (test_thread_flag(TIF_32BIT)) { 637 args.pidfd = compat_ptr(regs->u_regs[UREG_I2]); 638 args.child_tid = compat_ptr(regs->u_regs[UREG_I4]); 639 args.parent_tid = compat_ptr(regs->u_regs[UREG_I2]); 640 } else 641#endif 642 { 643 args.pidfd = (int __user *)regs->u_regs[UREG_I2]; 644 args.child_tid = (int __user *)regs->u_regs[UREG_I4]; 645 args.parent_tid = (int __user *)regs->u_regs[UREG_I2]; 646 } 647 648 /* Did userspace setup a separate stack for the child or are we 649 * copying the parent's? 650 */ 651 if (regs->u_regs[UREG_I1]) 652 args.stack = regs->u_regs[UREG_I1]; 653 else 654 args.stack = regs->u_regs[UREG_FP]; 655 656 ret = _do_fork(&args); 657 658 /* If we get an error and potentially restart the system 659 * call, we're screwed because copy_thread_tls() clobbered 660 * the parent's %o1. So detect that case and restore it 661 * here. 662 */ 663 if ((unsigned long)ret >= -ERESTART_RESTARTBLOCK) 664 regs->u_regs[UREG_I1] = orig_i1; 665 666 return ret; 667} 668 | |
669/* Copy a Sparc thread. The fork() return value conventions 670 * under SunOS are nothing short of bletcherous: 671 * Parent --> %o0 == childs pid, %o1 == 0 672 * Child --> %o0 == parents pid, %o1 == 1 673 */ 674int copy_thread_tls(unsigned long clone_flags, unsigned long sp, 675 unsigned long arg, struct task_struct *p, 676 unsigned long tls) --- 184 unchanged lines hidden --- | 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 */ 580int copy_thread_tls(unsigned long clone_flags, unsigned long sp, 581 unsigned long arg, struct task_struct *p, 582 unsigned long tls) --- 184 unchanged lines hidden --- |