aboutsummaryrefslogtreecommitdiffstats
path: root/arch/c6x/kernel/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/c6x/kernel/process.c')
-rw-r--r--arch/c6x/kernel/process.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/arch/c6x/kernel/process.c b/arch/c6x/kernel/process.c
index 2770d9a9a84e..6434df476f77 100644
--- a/arch/c6x/kernel/process.c
+++ b/arch/c6x/kernel/process.c
@@ -112,22 +112,6 @@ void exit_thread(void)
112{ 112{
113} 113}
114 114
115SYSCALL_DEFINE1(c6x_clone, struct pt_regs *, regs)
116{
117 unsigned long clone_flags;
118 unsigned long newsp;
119
120 /* syscall puts clone_flags in A4 and usp in B4 */
121 clone_flags = regs->orig_a4;
122 if (regs->b4)
123 newsp = regs->b4;
124 else
125 newsp = regs->sp;
126
127 return do_fork(clone_flags, newsp, regs, 0, (int __user *)regs->a6,
128 (int __user *)regs->b6);
129}
130
131/* 115/*
132 * Do necessary setup to start up a newly executed thread. 116 * Do necessary setup to start up a newly executed thread.
133 */ 117 */
@@ -155,13 +139,13 @@ void start_thread(struct pt_regs *regs, unsigned int pc, unsigned long usp)
155 */ 139 */
156int copy_thread(unsigned long clone_flags, unsigned long usp, 140int copy_thread(unsigned long clone_flags, unsigned long usp,
157 unsigned long ustk_size, 141 unsigned long ustk_size,
158 struct task_struct *p, struct pt_regs *regs) 142 struct task_struct *p)
159{ 143{
160 struct pt_regs *childregs; 144 struct pt_regs *childregs;
161 145
162 childregs = task_pt_regs(p); 146 childregs = task_pt_regs(p);
163 147
164 if (!regs) { 148 if (unlikely(p->flags & PF_KTHREAD)) {
165 /* case of __kernel_thread: we return to supervisor space */ 149 /* case of __kernel_thread: we return to supervisor space */
166 memset(childregs, 0, sizeof(struct pt_regs)); 150 memset(childregs, 0, sizeof(struct pt_regs));
167 childregs->sp = (unsigned long)(childregs + 1); 151 childregs->sp = (unsigned long)(childregs + 1);
@@ -170,8 +154,9 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
170 childregs->a1 = ustk_size; /* argument */ 154 childregs->a1 = ustk_size; /* argument */
171 } else { 155 } else {
172 /* Otherwise use the given stack */ 156 /* Otherwise use the given stack */
173 *childregs = *regs; 157 *childregs = *current_pt_regs();
174 childregs->sp = usp; 158 if (usp)
159 childregs->sp = usp;
175 p->thread.pc = (unsigned long) ret_from_fork; 160 p->thread.pc = (unsigned long) ret_from_fork;
176 } 161 }
177 162