process_32.c (98817a84ff1c755c347ac633ff017a623a631fad) process_32.c (714acdbd1c94e7e3ab90f6b6938f1ccb27b662f0)
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
295 * if the parent should sleep while trying to
296 * allocate the task_struct and kernel stack in
297 * do_fork().
298 * XXX See comment above sys_vfork in sparc64. todo.
299 */
300extern void ret_from_fork(void);
301extern void ret_from_kernel_thread(void);
302
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
268 * if the parent should sleep while trying to
269 * allocate the task_struct and kernel stack in
270 * do_fork().
271 * XXX See comment above sys_vfork in sparc64. todo.
272 */
273extern void ret_from_fork(void);
274extern void ret_from_kernel_thread(void);
275
303int copy_thread(unsigned long clone_flags, unsigned long sp,
304 unsigned long arg, struct task_struct *p)
276int copy_thread(unsigned long clone_flags, unsigned long sp, unsigned long arg,
277 struct task_struct *p, unsigned long tls)
305{
306 struct thread_info *ti = task_thread_info(p);
307 struct pt_regs *childregs, *regs = current_pt_regs();
308 char *new_stack;
309
310#ifndef CONFIG_SMP
311 if(last_task_used_math == current) {
312#else

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

398 /* Set the return value for the child. */
399 childregs->u_regs[UREG_I0] = current->pid;
400 childregs->u_regs[UREG_I1] = 1;
401
402 /* Set the return value for the parent. */
403 regs->u_regs[UREG_I1] = 0;
404
405 if (clone_flags & CLONE_SETTLS)
278{
279 struct thread_info *ti = task_thread_info(p);
280 struct pt_regs *childregs, *regs = current_pt_regs();
281 char *new_stack;
282
283#ifndef CONFIG_SMP
284 if(last_task_used_math == current) {
285#else

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

371 /* Set the return value for the child. */
372 childregs->u_regs[UREG_I0] = current->pid;
373 childregs->u_regs[UREG_I1] = 1;
374
375 /* Set the return value for the parent. */
376 regs->u_regs[UREG_I1] = 0;
377
378 if (clone_flags & CLONE_SETTLS)
406 childregs->u_regs[UREG_G7] = regs->u_regs[UREG_I3];
379 childregs->u_regs[UREG_G7] = tls;
407
408 return 0;
409}
410
411/*
412 * fill in the fpu structure for a core dump.
413 */
414int dump_fpu (struct pt_regs * regs, elf_fpregset_t * fpregs)

--- 76 unchanged lines hidden ---
380
381 return 0;
382}
383
384/*
385 * fill in the fpu structure for a core dump.
386 */
387int dump_fpu (struct pt_regs * regs, elf_fpregset_t * fpregs)

--- 76 unchanged lines hidden ---