process_32.c (08a7c7772b4db0be06e3b27239147c0a36e2a507) process_32.c (a4261d4bb45022e1b8b95df13dbb05abac490165)
1// SPDX-License-Identifier: GPL-2.0
2/* linux/arch/sparc/kernel/process.c
3 *
4 * Copyright (C) 1995, 2008 David S. Miller (davem@davemloft.net)
5 * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be)
6 */
7
8/*

--- 243 unchanged lines hidden (view full) ---

252 if (__copy_user(sp, src, size))
253 sp = NULL;
254 else if (put_user(fp, &sp->fp))
255 sp = NULL;
256
257 return sp;
258}
259
1// SPDX-License-Identifier: GPL-2.0
2/* linux/arch/sparc/kernel/process.c
3 *
4 * Copyright (C) 1995, 2008 David S. Miller (davem@davemloft.net)
5 * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be)
6 */
7
8/*

--- 243 unchanged lines hidden (view full) ---

252 if (__copy_user(sp, src, size))
253 sp = NULL;
254 else if (put_user(fp, &sp->fp))
255 sp = NULL;
256
257 return sp;
258}
259
260asmlinkage int sparc_do_fork(unsigned long clone_flags,
261 unsigned long stack_start,
262 struct pt_regs *regs,
263 unsigned long stack_size)
264{
265 unsigned long parent_tid_ptr, child_tid_ptr;
266 unsigned long orig_i1 = regs->u_regs[UREG_I1];
267 long ret;
268
269 parent_tid_ptr = regs->u_regs[UREG_I2];
270 child_tid_ptr = regs->u_regs[UREG_I4];
271
272 ret = do_fork(clone_flags, stack_start, stack_size,
273 (int __user *) parent_tid_ptr,
274 (int __user *) child_tid_ptr);
275
276 /* If we get an error and potentially restart the system
277 * call, we're screwed because copy_thread() clobbered
278 * the parent's %o1. So detect that case and restore it
279 * here.
280 */
281 if ((unsigned long)ret >= -ERESTART_RESTARTBLOCK)
282 regs->u_regs[UREG_I1] = orig_i1;
283
284 return ret;
285}
286
287/* Copy a Sparc thread. The fork() return value conventions
288 * under SunOS are nothing short of bletcherous:
289 * Parent --> %o0 == childs pid, %o1 == 0
290 * Child --> %o0 == parents pid, %o1 == 1
291 *
292 * NOTE: We have a separate fork kpsr/kwim because
293 * the parent could change these values between
294 * sys_fork invocation and when we reach here

--- 196 unchanged lines hidden ---
260/* Copy a Sparc thread. The fork() return value conventions
261 * under SunOS are nothing short of bletcherous:
262 * Parent --> %o0 == childs pid, %o1 == 0
263 * Child --> %o0 == parents pid, %o1 == 1
264 *
265 * NOTE: We have a separate fork kpsr/kwim because
266 * the parent could change these values between
267 * sys_fork invocation and when we reach here

--- 196 unchanged lines hidden ---