[PATCH][v850] Handle new do_fork return value on v850

Miles Bader (miles@lsi.nec.co.jp)
Tue, 27 May 2003 18:21:32 +0900 (JST)


diff -ruN -X../cludes linux-2.5.70/arch/v850/kernel/entry.S linux-2.5.70-v850-20030527/arch/v850/kernel/entry.S
--- linux-2.5.70/arch/v850/kernel/entry.S 2003-04-21 10:52:40.000000000 +0900
+++ linux-2.5.70-v850-20030527/arch/v850/kernel/entry.S 2003-05-27 16:53:39.000000000 +0900
@@ -554,11 +571,14 @@

L_ENTRY(sys_fork_wrapper):
#ifdef CONFIG_MMU
- addi SIGCHLD, r0, r6 // Arg 0: flags
+ addi SIGCHLD, r0, r6 // Arg 0: flags
ld.w PTO+PT_GPR(GPR_SP)[sp], r7 // Arg 1: child SP (use parent's)
- movea PTO, sp, r8 // Arg 2: parent context
- mov hilo(CSYM(fork_common)), r18// Where the real work gets done
- br save_extra_state_tramp // Save state and go there
+ movea PTO, sp, r8 // Arg 2: parent context
+ mov r0, r9 // Arg 3/4/5: 0
+ st.w r0, 16[sp]
+ st.w r0, 20[sp]
+ mov hilo(CSYM(do_fork)), r18 // Where the real work gets done
+ br save_extra_state_tramp // Save state and go there
#else
// fork almost works, enough to trick you into looking elsewhere :-(
addi -EINVAL, r0, r10
@@ -569,18 +589,24 @@
L_ENTRY(sys_vfork_wrapper):
addi CLONE_VFORK | CLONE_VM | SIGCHLD, r0, r6 // Arg 0: flags
ld.w PTO+PT_GPR(GPR_SP)[sp], r7 // Arg 1: child SP (use parent's)
- movea PTO, sp, r8 // Arg 2: parent context
- mov hilo(CSYM(fork_common)), r18// Where the real work gets done
- br save_extra_state_tramp // Save state and go there
+ movea PTO, sp, r8 // Arg 2: parent context
+ mov r0, r9 // Arg 3/4/5: 0
+ st.w r0, 16[sp]
+ st.w r0, 20[sp]
+ mov hilo(CSYM(do_fork)), r18 // Where the real work gets done
+ br save_extra_state_tramp // Save state and go there
END(sys_vfork_wrapper)

L_ENTRY(sys_clone_wrapper):
- ld.w PTO+PT_GPR(GPR_SP)[sp], r19 // parent's stack pointer
- cmp r7, r0 // See if child SP arg (arg 1) is 0.
- cmov z, r19, r7, r7 // ... and use the parent's if so.
- movea PTO, sp, r8 // Arg 2: parent context
- mov hilo(CSYM(fork_common)), r18// Where the real work gets done
- br save_extra_state_tramp // Save state and go there
+ ld.w PTO+PT_GPR(GPR_SP)[sp], r19// parent's stack pointer
+ cmp r7, r0 // See if child SP arg (arg 1) is 0.
+ cmov z, r19, r7, r7 // ... and use the parent's if so.
+ movea PTO, sp, r8 // Arg 2: parent context
+ mov r0, r9 // Arg 3/4/5: 0
+ st.w r0, 16[sp]
+ st.w r0, 20[sp]
+ mov hilo(CSYM(do_fork)), r18 // Where the real work gets done
+ br save_extra_state_tramp // Save state and go there
END(sys_clone_wrapper)


diff -ruN -X../cludes linux-2.5.70/arch/v850/kernel/process.c linux-2.5.70-v850-20030527/arch/v850/kernel/process.c
--- linux-2.5.70/arch/v850/kernel/process.c 2003-04-21 10:52:40.000000000 +0900
+++ linux-2.5.70-v850-20030527/arch/v850/kernel/process.c 2003-05-27 16:54:00.000000000 +0900
@@ -200,14 +200,6 @@
return error;
}

-/* This is the common part of the various fork-like system calls (which
- are in entry.S). */
-int fork_common (int flags, unsigned long new_sp, struct pt_regs *regs)
-{
- struct task_struct *p = do_fork (flags, new_sp, regs, 0, 0, 0);
- return IS_ERR (p) ? PTR_ERR (p) : p->pid;
-}
-

/*
* These bracket the sleeping functions..
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/