aboutsummaryrefslogtreecommitdiffstats
path: root/arch/microblaze/kernel
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-10-27 00:03:41 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-11-28 22:43:40 -0500
commitf3268edbe6fe0ce56e62c6d6b14640aeb04864b7 (patch)
tree1ff80222598a1f259ab1910affe0740478090369 /arch/microblaze/kernel
parentf01aceac61ad5cc9ea463f6bb185c1f72702357f (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/microblaze/kernel')
-rw-r--r--arch/microblaze/kernel/entry-nommu.S8
-rw-r--r--arch/microblaze/kernel/entry.S26
-rw-r--r--arch/microblaze/kernel/process.c8
-rw-r--r--arch/microblaze/kernel/sys_microblaze.c14
-rw-r--r--arch/microblaze/kernel/syscall_table.S6
5 files changed, 6 insertions, 56 deletions
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
562sys_vfork:
563 brid microblaze_vfork
564 addk r5, r1, r0
565
566sys_clone:
567 brid microblaze_clone
568 addk r7, r1, r0
569
570sys_rt_sigreturn_wrapper: 562sys_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
448C_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
478C_ENTRY(sys_vfork):
479 brid microblaze_vfork /* Do real work (tail-call) */
480 addik r5, r1, 0
481
482C_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 */
4851: 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
492C_ENTRY(sys_rt_sigreturn_wrapper): 466C_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
121int copy_thread(unsigned long clone_flags, unsigned long usp, 122int 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
37asmlinkage 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
43asmlinkage 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
51asmlinkage long sys_mmap(unsigned long addr, unsigned long len, 37asmlinkage 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 */