diff options
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/Kconfig | 2 | ||||
-rw-r--r-- | arch/powerpc/include/asm/signal.h | 2 | ||||
-rw-r--r-- | arch/powerpc/include/asm/syscalls.h | 9 | ||||
-rw-r--r-- | arch/powerpc/include/asm/unistd.h | 4 | ||||
-rw-r--r-- | arch/powerpc/kernel/entry_32.S | 5 | ||||
-rw-r--r-- | arch/powerpc/kernel/entry_64.S | 8 | ||||
-rw-r--r-- | arch/powerpc/kernel/process.c | 64 |
7 files changed, 15 insertions, 79 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index a902a5c1c76a..951a517a1a0f 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -144,6 +144,8 @@ config PPC | |||
144 | select GENERIC_KERNEL_THREAD | 144 | select GENERIC_KERNEL_THREAD |
145 | select HAVE_MOD_ARCH_SPECIFIC | 145 | select HAVE_MOD_ARCH_SPECIFIC |
146 | select MODULES_USE_ELF_RELA | 146 | select MODULES_USE_ELF_RELA |
147 | select GENERIC_KERNEL_EXECVE | ||
148 | select CLONE_BACKWARDS | ||
147 | 149 | ||
148 | config EARLY_PRINTK | 150 | config EARLY_PRINTK |
149 | bool | 151 | bool |
diff --git a/arch/powerpc/include/asm/signal.h b/arch/powerpc/include/asm/signal.h index 189998bb61c4..a101637725a2 100644 --- a/arch/powerpc/include/asm/signal.h +++ b/arch/powerpc/include/asm/signal.h | |||
@@ -3,6 +3,4 @@ | |||
3 | 3 | ||
4 | #include <uapi/asm/signal.h> | 4 | #include <uapi/asm/signal.h> |
5 | 5 | ||
6 | struct pt_regs; | ||
7 | #define ptrace_signal_deliver(regs, cookie) do { } while (0) | ||
8 | #endif /* _ASM_POWERPC_SIGNAL_H */ | 6 | #endif /* _ASM_POWERPC_SIGNAL_H */ |
diff --git a/arch/powerpc/include/asm/syscalls.h b/arch/powerpc/include/asm/syscalls.h index 329db4ec12ca..b5308d3e6d39 100644 --- a/arch/powerpc/include/asm/syscalls.h +++ b/arch/powerpc/include/asm/syscalls.h | |||
@@ -17,15 +17,6 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len, | |||
17 | asmlinkage unsigned long sys_mmap2(unsigned long addr, size_t len, | 17 | asmlinkage unsigned long sys_mmap2(unsigned long addr, size_t len, |
18 | unsigned long prot, unsigned long flags, | 18 | unsigned long prot, unsigned long flags, |
19 | unsigned long fd, unsigned long pgoff); | 19 | unsigned long fd, unsigned long pgoff); |
20 | asmlinkage int sys_clone(unsigned long clone_flags, unsigned long usp, | ||
21 | int __user *parent_tidp, void __user *child_threadptr, | ||
22 | int __user *child_tidp, int p6, struct pt_regs *regs); | ||
23 | asmlinkage int sys_fork(unsigned long p1, unsigned long p2, | ||
24 | unsigned long p3, unsigned long p4, unsigned long p5, | ||
25 | unsigned long p6, struct pt_regs *regs); | ||
26 | asmlinkage int sys_vfork(unsigned long p1, unsigned long p2, | ||
27 | unsigned long p3, unsigned long p4, unsigned long p5, | ||
28 | unsigned long p6, struct pt_regs *regs); | ||
29 | asmlinkage long sys_pipe(int __user *fildes); | 20 | asmlinkage long sys_pipe(int __user *fildes); |
30 | asmlinkage long sys_pipe2(int __user *fildes, int flags); | 21 | asmlinkage long sys_pipe2(int __user *fildes, int flags); |
31 | asmlinkage long sys_rt_sigaction(int sig, | 22 | asmlinkage long sys_rt_sigaction(int sig, |
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h index 921dce6d8445..76fe846ec40e 100644 --- a/arch/powerpc/include/asm/unistd.h +++ b/arch/powerpc/include/asm/unistd.h | |||
@@ -56,7 +56,9 @@ | |||
56 | #define __ARCH_WANT_COMPAT_SYS_SENDFILE | 56 | #define __ARCH_WANT_COMPAT_SYS_SENDFILE |
57 | #endif | 57 | #endif |
58 | #define __ARCH_WANT_SYS_EXECVE | 58 | #define __ARCH_WANT_SYS_EXECVE |
59 | #define __ARCH_WANT_KERNEL_EXECVE | 59 | #define __ARCH_WANT_SYS_FORK |
60 | #define __ARCH_WANT_SYS_VFORK | ||
61 | #define __ARCH_WANT_SYS_CLONE | ||
60 | 62 | ||
61 | /* | 63 | /* |
62 | * "Conditional" syscalls | 64 | * "Conditional" syscalls |
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S index 9499385676e7..d22e73e4618b 100644 --- a/arch/powerpc/kernel/entry_32.S +++ b/arch/powerpc/kernel/entry_32.S | |||
@@ -444,11 +444,6 @@ ret_from_kernel_thread: | |||
444 | PPC440EP_ERR42 | 444 | PPC440EP_ERR42 |
445 | blrl | 445 | blrl |
446 | li r3,0 | 446 | li r3,0 |
447 | b do_exit # no return | ||
448 | |||
449 | .globl __ret_from_kernel_execve | ||
450 | __ret_from_kernel_execve: | ||
451 | addi r1,r3,-STACK_FRAME_OVERHEAD | ||
452 | b ret_from_syscall | 447 | b ret_from_syscall |
453 | 448 | ||
454 | /* Traced system call support */ | 449 | /* Traced system call support */ |
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index 56e0ff0878b5..e9a906c27234 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S | |||
@@ -373,17 +373,11 @@ _GLOBAL(ret_from_fork) | |||
373 | _GLOBAL(ret_from_kernel_thread) | 373 | _GLOBAL(ret_from_kernel_thread) |
374 | bl .schedule_tail | 374 | bl .schedule_tail |
375 | REST_NVGPRS(r1) | 375 | REST_NVGPRS(r1) |
376 | REST_GPR(2,r1) | 376 | ld r14, 0(r14) |
377 | mtlr r14 | 377 | mtlr r14 |
378 | mr r3,r15 | 378 | mr r3,r15 |
379 | blrl | 379 | blrl |
380 | li r3,0 | 380 | li r3,0 |
381 | b .do_exit # no return | ||
382 | |||
383 | _GLOBAL(__ret_from_kernel_execve) | ||
384 | addi r1,r3,-STACK_FRAME_OVERHEAD | ||
385 | li r10,1 | ||
386 | std r10,SOFTE(r1) | ||
387 | b syscall_exit | 381 | b syscall_exit |
388 | 382 | ||
389 | .section ".toc","aw" | 383 | .section ".toc","aw" |
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index ba48233500f6..81430674e71c 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c | |||
@@ -733,8 +733,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) | |||
733 | extern unsigned long dscr_default; /* defined in arch/powerpc/kernel/sysfs.c */ | 733 | extern unsigned long dscr_default; /* defined in arch/powerpc/kernel/sysfs.c */ |
734 | 734 | ||
735 | int copy_thread(unsigned long clone_flags, unsigned long usp, | 735 | int copy_thread(unsigned long clone_flags, unsigned long usp, |
736 | unsigned long arg, struct task_struct *p, | 736 | unsigned long arg, struct task_struct *p) |
737 | struct pt_regs *regs) | ||
738 | { | 737 | { |
739 | struct pt_regs *childregs, *kregs; | 738 | struct pt_regs *childregs, *kregs; |
740 | extern void ret_from_fork(void); | 739 | extern void ret_from_fork(void); |
@@ -745,25 +744,25 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, | |||
745 | /* Copy registers */ | 744 | /* Copy registers */ |
746 | sp -= sizeof(struct pt_regs); | 745 | sp -= sizeof(struct pt_regs); |
747 | childregs = (struct pt_regs *) sp; | 746 | childregs = (struct pt_regs *) sp; |
748 | if (!regs) { | 747 | if (unlikely(p->flags & PF_KTHREAD)) { |
749 | /* for kernel thread, set `current' and stackptr in new task */ | 748 | struct thread_info *ti = (void *)task_stack_page(p); |
750 | memset(childregs, 0, sizeof(struct pt_regs)); | 749 | memset(childregs, 0, sizeof(struct pt_regs)); |
751 | childregs->gpr[1] = sp + sizeof(struct pt_regs); | 750 | childregs->gpr[1] = sp + sizeof(struct pt_regs); |
751 | childregs->gpr[14] = usp; /* function */ | ||
752 | #ifdef CONFIG_PPC64 | 752 | #ifdef CONFIG_PPC64 |
753 | childregs->gpr[14] = *(unsigned long *)usp; | ||
754 | childregs->gpr[2] = ((unsigned long *)usp)[1], | ||
755 | clear_tsk_thread_flag(p, TIF_32BIT); | 753 | clear_tsk_thread_flag(p, TIF_32BIT); |
756 | #else | 754 | childregs->softe = 1; |
757 | childregs->gpr[14] = usp; /* function */ | ||
758 | childregs->gpr[2] = (unsigned long) p; | ||
759 | #endif | 755 | #endif |
760 | childregs->gpr[15] = arg; | 756 | childregs->gpr[15] = arg; |
761 | p->thread.regs = NULL; /* no user register state */ | 757 | p->thread.regs = NULL; /* no user register state */ |
758 | ti->flags |= _TIF_RESTOREALL; | ||
762 | f = ret_from_kernel_thread; | 759 | f = ret_from_kernel_thread; |
763 | } else { | 760 | } else { |
761 | struct pt_regs *regs = current_pt_regs(); | ||
764 | CHECK_FULL_REGS(regs); | 762 | CHECK_FULL_REGS(regs); |
765 | *childregs = *regs; | 763 | *childregs = *regs; |
766 | childregs->gpr[1] = usp; | 764 | if (usp) |
765 | childregs->gpr[1] = usp; | ||
767 | p->thread.regs = childregs; | 766 | p->thread.regs = childregs; |
768 | childregs->gpr[3] = 0; /* Result from fork() */ | 767 | childregs->gpr[3] = 0; /* Result from fork() */ |
769 | if (clone_flags & CLONE_SETTLS) { | 768 | if (clone_flags & CLONE_SETTLS) { |
@@ -1027,51 +1026,6 @@ int get_unalign_ctl(struct task_struct *tsk, unsigned long adr) | |||
1027 | return put_user(tsk->thread.align_ctl, (unsigned int __user *)adr); | 1026 | return put_user(tsk->thread.align_ctl, (unsigned int __user *)adr); |
1028 | } | 1027 | } |
1029 | 1028 | ||
1030 | #define TRUNC_PTR(x) ((typeof(x))(((unsigned long)(x)) & 0xffffffff)) | ||
1031 | |||
1032 | int sys_clone(unsigned long clone_flags, unsigned long usp, | ||
1033 | int __user *parent_tidp, void __user *child_threadptr, | ||
1034 | int __user *child_tidp, int p6, | ||
1035 | struct pt_regs *regs) | ||
1036 | { | ||
1037 | CHECK_FULL_REGS(regs); | ||
1038 | if (usp == 0) | ||
1039 | usp = regs->gpr[1]; /* stack pointer for child */ | ||
1040 | #ifdef CONFIG_PPC64 | ||
1041 | if (is_32bit_task()) { | ||
1042 | parent_tidp = TRUNC_PTR(parent_tidp); | ||
1043 | child_tidp = TRUNC_PTR(child_tidp); | ||
1044 | } | ||
1045 | #endif | ||
1046 | return do_fork(clone_flags, usp, regs, 0, parent_tidp, child_tidp); | ||
1047 | } | ||
1048 | |||
1049 | int sys_fork(unsigned long p1, unsigned long p2, unsigned long p3, | ||
1050 | unsigned long p4, unsigned long p5, unsigned long p6, | ||
1051 | struct pt_regs *regs) | ||
1052 | { | ||
1053 | CHECK_FULL_REGS(regs); | ||
1054 | return do_fork(SIGCHLD, regs->gpr[1], regs, 0, NULL, NULL); | ||
1055 | } | ||
1056 | |||
1057 | int sys_vfork(unsigned long p1, unsigned long p2, unsigned long p3, | ||
1058 | unsigned long p4, unsigned long p5, unsigned long p6, | ||
1059 | struct pt_regs *regs) | ||
1060 | { | ||
1061 | CHECK_FULL_REGS(regs); | ||
1062 | return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->gpr[1], | ||
1063 | regs, 0, NULL, NULL); | ||
1064 | } | ||
1065 | |||
1066 | void __ret_from_kernel_execve(struct pt_regs *normal) | ||
1067 | __noreturn; | ||
1068 | |||
1069 | void ret_from_kernel_execve(struct pt_regs *normal) | ||
1070 | { | ||
1071 | set_thread_flag(TIF_RESTOREALL); | ||
1072 | __ret_from_kernel_execve(normal); | ||
1073 | } | ||
1074 | |||
1075 | static inline int valid_irq_stack(unsigned long sp, struct task_struct *p, | 1029 | static inline int valid_irq_stack(unsigned long sp, struct task_struct *p, |
1076 | unsigned long nbytes) | 1030 | unsigned long nbytes) |
1077 | { | 1031 | { |