diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-10-27 00:03:41 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-11-28 22:43:40 -0500 |
commit | f3268edbe6fe0ce56e62c6d6b14640aeb04864b7 (patch) | |
tree | 1ff80222598a1f259ab1910affe0740478090369 /arch | |
parent | f01aceac61ad5cc9ea463f6bb185c1f72702357f (diff) |
microblaze: switch to generic fork/vfork/clone
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/microblaze/Kconfig | 1 | ||||
-rw-r--r-- | arch/microblaze/include/asm/unistd.h | 5 | ||||
-rw-r--r-- | arch/microblaze/kernel/entry-nommu.S | 8 | ||||
-rw-r--r-- | arch/microblaze/kernel/entry.S | 26 | ||||
-rw-r--r-- | arch/microblaze/kernel/process.c | 8 | ||||
-rw-r--r-- | arch/microblaze/kernel/sys_microblaze.c | 14 | ||||
-rw-r--r-- | arch/microblaze/kernel/syscall_table.S | 6 |
7 files changed, 12 insertions, 56 deletions
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig index 198abf6d41c4..4bcf89148f3c 100644 --- a/arch/microblaze/Kconfig +++ b/arch/microblaze/Kconfig | |||
@@ -28,6 +28,7 @@ config MICROBLAZE | |||
28 | select MODULES_USE_ELF_RELA | 28 | select MODULES_USE_ELF_RELA |
29 | select GENERIC_KERNEL_THREAD | 29 | select GENERIC_KERNEL_THREAD |
30 | select GENERIC_KERNEL_EXECVE | 30 | select GENERIC_KERNEL_EXECVE |
31 | select CLONE_BACKWARDS | ||
31 | 32 | ||
32 | config SWAP | 33 | config SWAP |
33 | def_bool n | 34 | def_bool n |
diff --git a/arch/microblaze/include/asm/unistd.h b/arch/microblaze/include/asm/unistd.h index ea7442834294..94d978986b75 100644 --- a/arch/microblaze/include/asm/unistd.h +++ b/arch/microblaze/include/asm/unistd.h | |||
@@ -423,6 +423,11 @@ | |||
423 | #define __ARCH_WANT_SYS_RT_SIGACTION | 423 | #define __ARCH_WANT_SYS_RT_SIGACTION |
424 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND | 424 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND |
425 | #define __ARCH_WANT_SYS_EXECVE | 425 | #define __ARCH_WANT_SYS_EXECVE |
426 | #define __ARCH_WANT_SYS_CLONE | ||
427 | #define __ARCH_WANT_SYS_VFORK | ||
428 | #ifdef CONFIG_MMU | ||
429 | #define __ARCH_WANT_SYS_FORK | ||
430 | #endif | ||
426 | 431 | ||
427 | /* | 432 | /* |
428 | * "Conditional" syscalls | 433 | * "Conditional" syscalls |
diff --git a/arch/microblaze/kernel/entry-nommu.S b/arch/microblaze/kernel/entry-nommu.S index 673a49c04a02..cb0327f204ab 100644 --- a/arch/microblaze/kernel/entry-nommu.S +++ b/arch/microblaze/kernel/entry-nommu.S | |||
@@ -559,14 +559,6 @@ no_work_pending: | |||
559 | rtid r14, 0 | 559 | rtid r14, 0 |
560 | nop | 560 | nop |
561 | 561 | ||
562 | sys_vfork: | ||
563 | brid microblaze_vfork | ||
564 | addk r5, r1, r0 | ||
565 | |||
566 | sys_clone: | ||
567 | brid microblaze_clone | ||
568 | addk r7, r1, r0 | ||
569 | |||
570 | sys_rt_sigreturn_wrapper: | 562 | sys_rt_sigreturn_wrapper: |
571 | brid sys_rt_sigreturn | 563 | brid sys_rt_sigreturn |
572 | addk r5, r1, r0 | 564 | addk r5, r1, r0 |
diff --git a/arch/microblaze/kernel/entry.S b/arch/microblaze/kernel/entry.S index 10f360ed82b4..c217367dfc7b 100644 --- a/arch/microblaze/kernel/entry.S +++ b/arch/microblaze/kernel/entry.S | |||
@@ -442,18 +442,6 @@ TRAP_return: /* Make global symbol for debugging */ | |||
442 | nop; | 442 | nop; |
443 | 443 | ||
444 | 444 | ||
445 | /* These syscalls need access to the struct pt_regs on the stack, so we | ||
446 | implement them in assembly (they're basically all wrappers anyway). */ | ||
447 | |||
448 | C_ENTRY(sys_fork_wrapper): | ||
449 | addi r5, r0, SIGCHLD /* Arg 0: flags */ | ||
450 | lwi r6, r1, PT_R1 /* Arg 1: child SP (use parent's) */ | ||
451 | addik r7, r1, 0 /* Arg 2: parent context */ | ||
452 | add r8, r0, r0 /* Arg 3: (unused) */ | ||
453 | add r9, r0, r0; /* Arg 4: (unused) */ | ||
454 | brid do_fork /* Do real work (tail-call) */ | ||
455 | add r10, r0, r0; /* Arg 5: (unused) */ | ||
456 | |||
457 | /* This the initial entry point for a new child thread, with an appropriate | 445 | /* This the initial entry point for a new child thread, with an appropriate |
458 | stack in place that makes it look the the child is in the middle of an | 446 | stack in place that makes it look the the child is in the middle of an |
459 | syscall. This function is actually `returned to' from switch_thread | 447 | syscall. This function is actually `returned to' from switch_thread |
@@ -475,20 +463,6 @@ C_ENTRY(ret_from_kernel_thread): | |||
475 | brid ret_from_trap | 463 | brid ret_from_trap |
476 | add r3, r0, r0 | 464 | add r3, r0, r0 |
477 | 465 | ||
478 | C_ENTRY(sys_vfork): | ||
479 | brid microblaze_vfork /* Do real work (tail-call) */ | ||
480 | addik r5, r1, 0 | ||
481 | |||
482 | C_ENTRY(sys_clone): | ||
483 | bnei r6, 1f; /* See if child SP arg (arg 1) is 0. */ | ||
484 | lwi r6, r1, PT_R1; /* If so, use paret's stack ptr */ | ||
485 | 1: addik r7, r1, 0; /* Arg 2: parent context */ | ||
486 | lwi r9, r1, PT_R8; /* parent tid. */ | ||
487 | lwi r10, r1, PT_R9; /* child tid. */ | ||
488 | /* do_fork will pick up TLS from regs->r10. */ | ||
489 | brid do_fork /* Do real work (tail-call) */ | ||
490 | add r8, r0, r0; /* Arg 3: (unused) */ | ||
491 | |||
492 | C_ENTRY(sys_rt_sigreturn_wrapper): | 466 | C_ENTRY(sys_rt_sigreturn_wrapper): |
493 | brid sys_rt_sigreturn /* Do real work */ | 467 | brid sys_rt_sigreturn /* Do real work */ |
494 | addik r5, r1, 0; /* add user context as 1st arg */ | 468 | addik r5, r1, 0; /* add user context as 1st arg */ |
diff --git a/arch/microblaze/kernel/process.c b/arch/microblaze/kernel/process.c index 29768c3dc358..a5fed8db7263 100644 --- a/arch/microblaze/kernel/process.c +++ b/arch/microblaze/kernel/process.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/pm.h> | 13 | #include <linux/pm.h> |
14 | #include <linux/tick.h> | 14 | #include <linux/tick.h> |
15 | #include <linux/bitops.h> | 15 | #include <linux/bitops.h> |
16 | #include <linux/ptrace.h> | ||
16 | #include <asm/pgalloc.h> | 17 | #include <asm/pgalloc.h> |
17 | #include <asm/uaccess.h> /* for USER_DS macros */ | 18 | #include <asm/uaccess.h> /* for USER_DS macros */ |
18 | #include <asm/cacheflush.h> | 19 | #include <asm/cacheflush.h> |
@@ -120,7 +121,7 @@ void flush_thread(void) | |||
120 | 121 | ||
121 | int copy_thread(unsigned long clone_flags, unsigned long usp, | 122 | int copy_thread(unsigned long clone_flags, unsigned long usp, |
122 | unsigned long arg, | 123 | unsigned long arg, |
123 | struct task_struct *p, struct pt_regs *regs) | 124 | struct task_struct *p, struct pt_regs *unused) |
124 | { | 125 | { |
125 | struct pt_regs *childregs = task_pt_regs(p); | 126 | struct pt_regs *childregs = task_pt_regs(p); |
126 | struct thread_info *ti = task_thread_info(p); | 127 | struct thread_info *ti = task_thread_info(p); |
@@ -141,8 +142,9 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, | |||
141 | ti->cpu_context.r15 = (unsigned long)ret_from_kernel_thread - 8; | 142 | ti->cpu_context.r15 = (unsigned long)ret_from_kernel_thread - 8; |
142 | return 0; | 143 | return 0; |
143 | } | 144 | } |
144 | *childregs = *regs; | 145 | *childregs = *current_pt_regs(); |
145 | childregs->r1 = usp; | 146 | if (usp) |
147 | childregs->r1 = usp; | ||
146 | 148 | ||
147 | memset(&ti->cpu_context, 0, sizeof(struct cpu_context)); | 149 | memset(&ti->cpu_context, 0, sizeof(struct cpu_context)); |
148 | ti->cpu_context.r1 = (unsigned long)childregs; | 150 | ti->cpu_context.r1 = (unsigned long)childregs; |
diff --git a/arch/microblaze/kernel/sys_microblaze.c b/arch/microblaze/kernel/sys_microblaze.c index a6a7bae9f5c6..63647c586b43 100644 --- a/arch/microblaze/kernel/sys_microblaze.c +++ b/arch/microblaze/kernel/sys_microblaze.c | |||
@@ -34,20 +34,6 @@ | |||
34 | 34 | ||
35 | #include <asm/syscalls.h> | 35 | #include <asm/syscalls.h> |
36 | 36 | ||
37 | asmlinkage long microblaze_vfork(struct pt_regs *regs) | ||
38 | { | ||
39 | return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->r1, | ||
40 | regs, 0, NULL, NULL); | ||
41 | } | ||
42 | |||
43 | asmlinkage long microblaze_clone(int flags, unsigned long stack, | ||
44 | struct pt_regs *regs) | ||
45 | { | ||
46 | if (!stack) | ||
47 | stack = regs->r1; | ||
48 | return do_fork(flags, stack, regs, 0, NULL, NULL); | ||
49 | } | ||
50 | |||
51 | asmlinkage long sys_mmap(unsigned long addr, unsigned long len, | 37 | asmlinkage long sys_mmap(unsigned long addr, unsigned long len, |
52 | unsigned long prot, unsigned long flags, | 38 | unsigned long prot, unsigned long flags, |
53 | unsigned long fd, off_t pgoff) | 39 | unsigned long fd, off_t pgoff) |
diff --git a/arch/microblaze/kernel/syscall_table.S b/arch/microblaze/kernel/syscall_table.S index 6a2b294ef6dc..ff6431e54680 100644 --- a/arch/microblaze/kernel/syscall_table.S +++ b/arch/microblaze/kernel/syscall_table.S | |||
@@ -2,11 +2,7 @@ ENTRY(sys_call_table) | |||
2 | .long sys_restart_syscall /* 0 - old "setup()" system call, | 2 | .long sys_restart_syscall /* 0 - old "setup()" system call, |
3 | * used for restarting */ | 3 | * used for restarting */ |
4 | .long sys_exit | 4 | .long sys_exit |
5 | #ifdef CONFIG_MMU | 5 | .long sys_fork |
6 | .long sys_fork_wrapper | ||
7 | #else | ||
8 | .long sys_ni_syscall | ||
9 | #endif | ||
10 | .long sys_read | 6 | .long sys_read |
11 | .long sys_write | 7 | .long sys_write |
12 | .long sys_open /* 5 */ | 8 | .long sys_open /* 5 */ |