1 /* $Id: process.c,v 1.109 2000/07/11 01:38:57 davem Exp $
2 * arch/sparc64/kernel/process.c
4 * Copyright (C) 1995, 1996 David S. Miller (davem@caip.rutgers.edu)
5 * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be)
6 * Copyright (C) 1997, 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
10 * This file handles the architecture-dependent parts of process handling..
13 #define __KERNEL_SYSCALLS__
16 #include <linux/errno.h>
17 #include <linux/sched.h>
18 #include <linux/kernel.h>
20 #include <linux/smp.h>
21 #include <linux/smp_lock.h>
22 #include <linux/stddef.h>
23 #include <linux/unistd.h>
24 #include <linux/ptrace.h>
25 #include <linux/malloc.h>
26 #include <linux/user.h>
27 #include <linux/a.out.h>
28 #include <linux/config.h>
29 #include <linux/reboot.h>
30 #include <linux/delay.h>
32 #include <asm/oplib.h>
33 #include <asm/uaccess.h>
34 #include <asm/system.h>
36 #include <asm/pgalloc.h>
37 #include <asm/pgtable.h>
38 #include <asm/processor.h>
39 #include <asm/pstate.h>
41 #include <asm/fpumacro.h>
43 /* #define VERBOSE_SHOWREGS */
48 * the idle loop on a Sparc... ;)
52 if (current
->pid
!= 0)
55 /* endless idle loop with no priority at all */
57 current
->counter
= -100;
61 /* If current->need_resched is zero we should really
62 * setup for a system wakup event and execute a shutdown
65 * But this requires writing back the contents of the
66 * L2 cache etc. so implement this later. -DaveM
77 * the idle loop on a UltraMultiPenguin...
79 #define idle_me_harder() (cpu_data[current->processor].idle_volume += 1)
80 #define unidle_me() (cpu_data[current->processor].idle_volume = 0)
84 current
->counter
= -100;
88 if (current
->need_resched
!= 0) {
95 /* The store ordering is so that IRQ handlers on
96 * other cpus see our increasing idleness for the buddy
97 * redistribution algorithm. -DaveM
99 membar("#StoreStore | #StoreLoad");
105 extern char reboot_command
[];
107 #ifdef CONFIG_SUN_CONSOLE
108 extern void (*prom_palette
)(int);
109 extern int serial_console
;
112 void machine_halt(void)
117 #ifdef CONFIG_SUN_CONSOLE
118 if (!serial_console
&& prom_palette
)
122 panic("Halt failed!");
125 void machine_restart(char * cmd
)
133 p
= strchr (reboot_command
, '\n');
135 #ifdef CONFIG_SUN_CONSOLE
136 if (!serial_console
&& prom_palette
)
142 prom_reboot(reboot_command
);
144 panic("Reboot failed!");
147 static void show_regwindow32(struct pt_regs
*regs
)
149 struct reg_window32
*rw
;
150 struct reg_window32 r_w
;
153 __asm__
__volatile__ ("flushw");
154 rw
= (struct reg_window32
*)((long)(unsigned)regs
->u_regs
[14]);
157 if (copy_from_user (&r_w
, rw
, sizeof(r_w
))) {
163 printk("l0: %08x l1: %08x l2: %08x l3: %08x "
164 "l4: %08x l5: %08x l6: %08x l7: %08x\n",
165 rw
->locals
[0], rw
->locals
[1], rw
->locals
[2], rw
->locals
[3],
166 rw
->locals
[4], rw
->locals
[5], rw
->locals
[6], rw
->locals
[7]);
167 printk("i0: %08x i1: %08x i2: %08x i3: %08x "
168 "i4: %08x i5: %08x i6: %08x i7: %08x\n",
169 rw
->ins
[0], rw
->ins
[1], rw
->ins
[2], rw
->ins
[3],
170 rw
->ins
[4], rw
->ins
[5], rw
->ins
[6], rw
->ins
[7]);
173 static void show_regwindow(struct pt_regs
*regs
)
175 struct reg_window
*rw
;
176 struct reg_window r_w
;
179 if ((regs
->tstate
& TSTATE_PRIV
) || !(current
->thread
.flags
& SPARC_FLAG_32BIT
)) {
180 __asm__
__volatile__ ("flushw");
181 rw
= (struct reg_window
*)(regs
->u_regs
[14] + STACK_BIAS
);
182 if (!(regs
->tstate
& TSTATE_PRIV
)) {
185 if (copy_from_user (&r_w
, rw
, sizeof(r_w
))) {
193 show_regwindow32(regs
);
196 printk("l0: %016lx l1: %016lx l2: %016lx l3: %016lx\n",
197 rw
->locals
[0], rw
->locals
[1], rw
->locals
[2], rw
->locals
[3]);
198 printk("l4: %016lx l5: %016lx l6: %016lx l7: %016lx\n",
199 rw
->locals
[4], rw
->locals
[5], rw
->locals
[6], rw
->locals
[7]);
200 printk("i0: %016lx i1: %016lx i2: %016lx i3: %016lx\n",
201 rw
->ins
[0], rw
->ins
[1], rw
->ins
[2], rw
->ins
[3]);
202 printk("i4: %016lx i5: %016lx i6: %016lx i7: %016lx\n",
203 rw
->ins
[4], rw
->ins
[5], rw
->ins
[6], rw
->ins
[7]);
206 void show_stackframe(struct sparc_stackf
*sf
)
212 printk("l0: %016lx l1: %016lx l2: %016lx l3: %016lx\n"
213 "l4: %016lx l5: %016lx l6: %016lx l7: %016lx\n",
214 sf
->locals
[0], sf
->locals
[1], sf
->locals
[2], sf
->locals
[3],
215 sf
->locals
[4], sf
->locals
[5], sf
->locals
[6], sf
->locals
[7]);
216 printk("i0: %016lx i1: %016lx i2: %016lx i3: %016lx\n"
217 "i4: %016lx i5: %016lx fp: %016lx ret_pc: %016lx\n",
218 sf
->ins
[0], sf
->ins
[1], sf
->ins
[2], sf
->ins
[3],
219 sf
->ins
[4], sf
->ins
[5], (unsigned long)sf
->fp
, sf
->callers_pc
);
220 printk("sp: %016lx x0: %016lx x1: %016lx x2: %016lx\n"
221 "x3: %016lx x4: %016lx x5: %016lx xx: %016lx\n",
222 (unsigned long)sf
->structptr
, sf
->xargs
[0], sf
->xargs
[1],
223 sf
->xargs
[2], sf
->xargs
[3], sf
->xargs
[4], sf
->xargs
[5],
225 size
= ((unsigned long)sf
->fp
) - ((unsigned long)sf
);
226 size
-= STACKFRAME_SZ
;
227 stk
= (unsigned long *)((unsigned long)sf
+ STACKFRAME_SZ
);
230 printk("s%d: %016lx\n", i
++, *stk
++);
231 } while ((size
-= sizeof(unsigned long)));
234 void show_stackframe32(struct sparc_stackf32
*sf
)
240 printk("l0: %08x l1: %08x l2: %08x l3: %08x\n",
241 sf
->locals
[0], sf
->locals
[1], sf
->locals
[2], sf
->locals
[3]);
242 printk("l4: %08x l5: %08x l6: %08x l7: %08x\n",
243 sf
->locals
[4], sf
->locals
[5], sf
->locals
[6], sf
->locals
[7]);
244 printk("i0: %08x i1: %08x i2: %08x i3: %08x\n",
245 sf
->ins
[0], sf
->ins
[1], sf
->ins
[2], sf
->ins
[3]);
246 printk("i4: %08x i5: %08x fp: %08x ret_pc: %08x\n",
247 sf
->ins
[4], sf
->ins
[5], sf
->fp
, sf
->callers_pc
);
248 printk("sp: %08x x0: %08x x1: %08x x2: %08x\n"
249 "x3: %08x x4: %08x x5: %08x xx: %08x\n",
250 sf
->structptr
, sf
->xargs
[0], sf
->xargs
[1],
251 sf
->xargs
[2], sf
->xargs
[3], sf
->xargs
[4], sf
->xargs
[5],
253 size
= ((unsigned long)sf
->fp
) - ((unsigned long)sf
);
254 size
-= STACKFRAME32_SZ
;
255 stk
= (unsigned *)((unsigned long)sf
+ STACKFRAME32_SZ
);
258 printk("s%d: %08x\n", i
++, *stk
++);
259 } while ((size
-= sizeof(unsigned)));
263 static spinlock_t regdump_lock
= SPIN_LOCK_UNLOCKED
;
266 void __show_regs(struct pt_regs
* regs
)
271 spin_lock_irqsave(®dump_lock
, flags
);
272 printk("CPU[%d]: local_irq_count[%u] irqs_running[%d]\n",
274 local_irq_count(smp_processor_id()),
277 printk("TSTATE: %016lx TPC: %016lx TNPC: %016lx Y: %08x\n", regs
->tstate
,
278 regs
->tpc
, regs
->tnpc
, regs
->y
);
279 printk("g0: %016lx g1: %016lx g2: %016lx g3: %016lx\n",
280 regs
->u_regs
[0], regs
->u_regs
[1], regs
->u_regs
[2],
282 printk("g4: %016lx g5: %016lx g6: %016lx g7: %016lx\n",
283 regs
->u_regs
[4], regs
->u_regs
[5], regs
->u_regs
[6],
285 printk("o0: %016lx o1: %016lx o2: %016lx o3: %016lx\n",
286 regs
->u_regs
[8], regs
->u_regs
[9], regs
->u_regs
[10],
288 printk("o4: %016lx o5: %016lx sp: %016lx ret_pc: %016lx\n",
289 regs
->u_regs
[12], regs
->u_regs
[13], regs
->u_regs
[14],
291 show_regwindow(regs
);
293 spin_unlock_irqrestore(®dump_lock
, flags
);
297 #ifdef VERBOSE_SHOWREGS
298 static void idump_from_user (unsigned int *pc
)
303 if((((unsigned long) pc
) & 3))
307 for(i
= -3; i
< 6; i
++) {
309 printk("%c%08x%c",i
?' ':'<',code
,i
?' ':'>');
316 void show_regs(struct pt_regs
*regs
)
318 #ifdef VERBOSE_SHOWREGS
319 extern long etrap
, etraptl1
;
324 extern void smp_report_regs(void);
330 #ifdef VERBOSE_SHOWREGS
331 if (regs
->tpc
>= &etrap
&& regs
->tpc
< &etraptl1
&&
332 regs
->u_regs
[14] >= (long)current
- PAGE_SIZE
&&
333 regs
->u_regs
[14] < (long)current
+ 6 * PAGE_SIZE
) {
334 printk ("*********parent**********\n");
335 __show_regs((struct pt_regs
*)(regs
->u_regs
[14] + STACK_BIAS
+ REGWIN_SZ
));
336 idump_from_user(((struct pt_regs
*)(regs
->u_regs
[14] + STACK_BIAS
+ REGWIN_SZ
))->tpc
);
337 printk ("*********endpar**********\n");
342 void show_regs32(struct pt_regs32
*regs
)
344 printk("PSR: %08x PC: %08x NPC: %08x Y: %08x\n", regs
->psr
,
345 regs
->pc
, regs
->npc
, regs
->y
);
346 printk("g0: %08x g1: %08x g2: %08x g3: %08x ",
347 regs
->u_regs
[0], regs
->u_regs
[1], regs
->u_regs
[2],
349 printk("g4: %08x g5: %08x g6: %08x g7: %08x\n",
350 regs
->u_regs
[4], regs
->u_regs
[5], regs
->u_regs
[6],
352 printk("o0: %08x o1: %08x o2: %08x o3: %08x ",
353 regs
->u_regs
[8], regs
->u_regs
[9], regs
->u_regs
[10],
355 printk("o4: %08x o5: %08x sp: %08x ret_pc: %08x\n",
356 regs
->u_regs
[12], regs
->u_regs
[13], regs
->u_regs
[14],
360 void show_thread(struct thread_struct
*thread
)
365 printk("kregs: 0x%016lx\n", (unsigned long)thread
->kregs
);
366 show_regs(thread
->kregs
);
368 printk("ksp: 0x%016lx\n", thread
->ksp
);
370 if (thread
->w_saved
) {
371 for (i
= 0; i
< NSWINS
; i
++) {
372 if (!thread
->rwbuf_stkptrs
[i
])
374 printk("reg_window[%d]:\n", i
);
375 printk("stack ptr: 0x%016lx\n", thread
->rwbuf_stkptrs
[i
]);
377 printk("w_saved: 0x%04x\n", thread
->w_saved
);
380 printk("flags: 0x%08x\n", thread
->flags
);
381 printk("current_ds: 0x%x\n", thread
->current_ds
.seg
);
384 /* Free current thread data structures etc.. */
385 void exit_thread(void)
387 struct thread_struct
*t
= ¤t
->thread
;
390 if (t
->utraps
[0] < 2)
396 /* Turn off performance counters if on. */
397 if (t
->flags
& SPARC_FLAG_PERFCTR
) {
398 t
->user_cntd0
= t
->user_cntd1
= NULL
;
400 t
->flags
&= ~(SPARC_FLAG_PERFCTR
);
405 void flush_thread(void)
407 struct thread_struct
*t
= ¤t
->thread
;
410 if (t
->flags
& SPARC_FLAG_32BIT
) {
411 struct mm_struct
*mm
= current
->mm
;
412 pgd_t
*pgd0
= &mm
->pgd
[0];
413 unsigned long pgd_cache
;
415 if (pgd_none(*pgd0
)) {
416 pmd_t
*page
= get_pmd_fast();
418 (void) get_pmd_slow(pgd0
, 0);
422 pgd_cache
= pgd_val(*pgd0
) << 11UL;
423 __asm__
__volatile__("stxa %0, [%1] %2"
432 /* Turn off performance counters if on. */
433 if (t
->flags
& SPARC_FLAG_PERFCTR
) {
434 t
->user_cntd0
= t
->user_cntd1
= NULL
;
436 t
->flags
&= ~(SPARC_FLAG_PERFCTR
);
440 /* Clear FPU register state. */
443 if (t
->current_ds
.seg
!= ASI_AIUS
)
446 /* Init new signal delivery disposition. */
447 t
->flags
&= ~SPARC_FLAG_NEWSIGNALS
;
450 /* It's a bit more tricky when 64-bit tasks are involved... */
451 static unsigned long clone_stackframe(unsigned long csp
, unsigned long psp
)
453 unsigned long fp
, distance
, rval
;
455 if (!(current
->thread
.flags
& SPARC_FLAG_32BIT
)) {
458 __get_user(fp
, &(((struct reg_window
*)psp
)->ins
[6]));
460 __get_user(fp
, &(((struct reg_window32
*)psp
)->ins
[6]));
462 /* Now 8-byte align the stack as this is mandatory in the
463 * Sparc ABI due to how register windows work. This hides
464 * the restriction from thread libraries etc. -DaveM
469 rval
= (csp
- distance
);
470 if (copy_in_user(rval
, psp
, distance
))
472 else if (current
->thread
.flags
& SPARC_FLAG_32BIT
) {
473 if (put_user(((u32
)csp
), &(((struct reg_window32
*)rval
)->ins
[6])))
476 if (put_user(((u64
)csp
- STACK_BIAS
),
477 &(((struct reg_window
*)rval
)->ins
[6])))
480 rval
= rval
- STACK_BIAS
;
486 /* Standard stuff. */
487 static inline void shift_window_buffer(int first_win
, int last_win
,
488 struct thread_struct
*t
)
492 for (i
= first_win
; i
< last_win
; i
++) {
493 t
->rwbuf_stkptrs
[i
] = t
->rwbuf_stkptrs
[i
+1];
494 memcpy(&t
->reg_window
[i
], &t
->reg_window
[i
+1],
495 sizeof(struct reg_window
));
499 void synchronize_user_stack(void)
501 struct thread_struct
*t
= ¤t
->thread
;
502 unsigned long window
;
504 flush_user_windows();
505 if ((window
= t
->w_saved
) != 0) {
506 int winsize
= REGWIN_SZ
;
509 if (t
->flags
& SPARC_FLAG_32BIT
)
510 winsize
= REGWIN32_SZ
;
516 unsigned long sp
= (t
->rwbuf_stkptrs
[window
] + bias
);
517 struct reg_window
*rwin
= &t
->reg_window
[window
];
519 if (!copy_to_user((char *)sp
, rwin
, winsize
)) {
520 shift_window_buffer(window
, t
->w_saved
- 1, t
);
527 void fault_in_user_windows(struct pt_regs
*regs
)
529 struct thread_struct
*t
= ¤t
->thread
;
530 unsigned long window
;
531 int winsize
= REGWIN_SZ
;
534 if (t
->flags
& SPARC_FLAG_32BIT
)
535 winsize
= REGWIN32_SZ
;
539 flush_user_windows();
545 unsigned long sp
= (t
->rwbuf_stkptrs
[window
] + bias
);
546 struct reg_window
*rwin
= &t
->reg_window
[window
];
548 if (copy_to_user((char *)sp
, rwin
, winsize
))
556 t
->w_saved
= window
+ 1;
560 /* Copy a Sparc thread. The fork() return value conventions
561 * under SunOS are nothing short of bletcherous:
562 * Parent --> %o0 == childs pid, %o1 == 0
563 * Child --> %o0 == parents pid, %o1 == 1
565 * NOTE: We have a separate fork kpsr/kwim because
566 * the parent could change these values between
567 * sys_fork invocation and when we reach here
568 * if the parent should sleep while trying to
569 * allocate the task_struct and kernel stack in
572 int copy_thread(int nr
, unsigned long clone_flags
, unsigned long sp
,
573 struct task_struct
*p
, struct pt_regs
*regs
)
575 struct thread_struct
*t
= &p
->thread
;
576 char *child_trap_frame
;
578 /* Calculate offset to stack_frame & pt_regs */
579 child_trap_frame
= ((char *)p
) + ((PAGE_SIZE
<< 1) - (TRACEREG_SZ
+REGWIN_SZ
));
580 memcpy(child_trap_frame
, (((struct reg_window
*)regs
)-1), (TRACEREG_SZ
+REGWIN_SZ
));
581 t
->ksp
= ((unsigned long) child_trap_frame
) - STACK_BIAS
;
582 t
->flags
|= SPARC_FLAG_NEWCHILD
;
583 t
->kregs
= (struct pt_regs
*)(child_trap_frame
+sizeof(struct reg_window
));
584 t
->cwp
= (regs
->tstate
+ 1) & TSTATE_CWP
;
587 if (regs
->tstate
& TSTATE_PRIV
) {
588 /* Special case, if we are spawning a kernel thread from
589 * a userspace task (via KMOD, NFS, or similar) we must
590 * disable performance counters in the child because the
591 * address space and protection realm are changing.
593 if (t
->flags
& SPARC_FLAG_PERFCTR
) {
594 t
->user_cntd0
= t
->user_cntd1
= NULL
;
596 t
->flags
&= ~(SPARC_FLAG_PERFCTR
);
598 t
->kregs
->u_regs
[UREG_FP
] = p
->thread
.ksp
;
599 t
->current_ds
= KERNEL_DS
;
600 flush_register_windows();
601 memcpy((void *)(t
->ksp
+ STACK_BIAS
),
602 (void *)(regs
->u_regs
[UREG_FP
] + STACK_BIAS
),
603 sizeof(struct reg_window
));
604 t
->kregs
->u_regs
[UREG_G6
] = (unsigned long) p
;
606 if (t
->flags
& SPARC_FLAG_32BIT
) {
607 sp
&= 0x00000000ffffffffUL
;
608 regs
->u_regs
[UREG_FP
] &= 0x00000000ffffffffUL
;
610 t
->kregs
->u_regs
[UREG_FP
] = sp
;
611 t
->current_ds
= USER_DS
;
612 if (sp
!= regs
->u_regs
[UREG_FP
]) {
615 csp
= clone_stackframe(sp
, regs
->u_regs
[UREG_FP
]);
618 t
->kregs
->u_regs
[UREG_FP
] = csp
;
624 /* Set the return value for the child. */
625 t
->kregs
->u_regs
[UREG_I0
] = current
->pid
;
626 t
->kregs
->u_regs
[UREG_I1
] = 1;
628 /* Set the second return value for the parent. */
629 regs
->u_regs
[UREG_I1
] = 0;
635 * This is the mechanism for creating a new kernel thread.
637 * NOTE! Only a kernel-only process(ie the swapper or direct descendants
638 * who haven't done an "execve()") should use this: it will work within
639 * a system call from a "real" process, but the process memory space will
640 * not be free'd until both the parent and the child have exited.
642 pid_t
kernel_thread(int (*fn
)(void *), void * arg
, unsigned long flags
)
646 __asm__
__volatile("mov %1, %%g1\n\t"
647 "mov %2, %%o0\n\t" /* Clone flags. */
648 "mov 0, %%o1\n\t" /* usp arg == 0 */
649 "t 0x6d\n\t" /* Linux/Sparc clone(). */
650 "brz,a,pn %%o1, 1f\n\t" /* Parent, just return. */
652 "jmpl %4, %%o7\n\t" /* Call the function. */
653 " mov %5, %%o0\n\t" /* Set arg in delay. */
655 "t 0x6d\n\t" /* Linux/Sparc exit(). */
656 /* Notreached by child. */
659 "i" (__NR_clone
), "r" (flags
| CLONE_VM
),
660 "i" (__NR_exit
), "r" (fn
), "r" (arg
) :
661 "g1", "o0", "o1", "memory", "cc");
666 * fill in the user structure for a core dump..
668 void dump_thread(struct pt_regs
* regs
, struct user
* dump
)
671 /* Only should be used for SunOS and ancient a.out
672 * SparcLinux binaries... Fixme some day when bored.
673 * But for now at least plug the security hole :-)
675 memset(dump
, 0, sizeof(struct user
));
677 unsigned long first_stack_page
;
678 dump
->magic
= SUNOS_CORE_MAGIC
;
679 dump
->len
= sizeof(struct user
);
680 dump
->regs
.psr
= regs
->psr
;
681 dump
->regs
.pc
= regs
->pc
;
682 dump
->regs
.npc
= regs
->npc
;
683 dump
->regs
.y
= regs
->y
;
685 memcpy(&dump
->regs
.regs
[0], ®s
->u_regs
[1], (sizeof(unsigned long) * 15));
686 dump
->u_tsize
= (((unsigned long) current
->mm
->end_code
) -
687 ((unsigned long) current
->mm
->start_code
)) & ~(PAGE_SIZE
- 1);
688 dump
->u_dsize
= ((unsigned long) (current
->mm
->brk
+ (PAGE_SIZE
-1)));
689 dump
->u_dsize
-= dump
->u_tsize
;
690 dump
->u_dsize
&= ~(PAGE_SIZE
- 1);
691 first_stack_page
= (regs
->u_regs
[UREG_FP
] & ~(PAGE_SIZE
- 1));
692 dump
->u_ssize
= (TASK_SIZE
- first_stack_page
) & ~(PAGE_SIZE
- 1);
693 memcpy(&dump
->fpu
.fpstatus
.fregs
.regs
[0], ¤t
->thread
.float_regs
[0], (sizeof(unsigned long) * 32));
694 dump
->fpu
.fpstatus
.fsr
= current
->thread
.fsr
;
695 dump
->fpu
.fpstatus
.flags
= dump
->fpu
.fpstatus
.extra
= 0;
701 unsigned int pr_regs
[32];
702 unsigned long pr_dregs
[16];
704 unsigned int __unused
;
706 unsigned char pr_qcnt
;
707 unsigned char pr_q_entrysize
;
709 unsigned int pr_q
[64];
713 * fill in the fpu structure for a core dump.
715 int dump_fpu (struct pt_regs
* regs
, elf_fpregset_t
* fpregs
)
717 unsigned long *kfpregs
= (unsigned long *)(((char *)current
) + AOFF_task_fpregs
);
718 unsigned long fprs
= current
->thread
.fpsaved
[0];
720 if ((current
->thread
.flags
& SPARC_FLAG_32BIT
) != 0) {
721 elf_fpregset_t32
*fpregs32
= (elf_fpregset_t32
*)fpregs
;
724 memcpy(&fpregs32
->pr_fr
.pr_regs
[0], kfpregs
,
725 sizeof(unsigned int) * 32);
727 memset(&fpregs32
->pr_fr
.pr_regs
[0], 0,
728 sizeof(unsigned int) * 32);
729 fpregs32
->pr_qcnt
= 0;
730 fpregs32
->pr_q_entrysize
= 8;
731 memset(&fpregs32
->pr_q
[0], 0,
732 (sizeof(unsigned int) * 64));
733 if (fprs
& FPRS_FEF
) {
734 fpregs32
->pr_fsr
= (unsigned int) current
->thread
.xfsr
[0];
737 fpregs32
->pr_fsr
= 0;
742 memcpy(&fpregs
->pr_regs
[0], kfpregs
,
743 sizeof(unsigned int) * 32);
745 memset(&fpregs
->pr_regs
[0], 0,
746 sizeof(unsigned int) * 32);
748 memcpy(&fpregs
->pr_regs
[16], kfpregs
+16,
749 sizeof(unsigned int) * 32);
751 memset(&fpregs
->pr_regs
[16], 0,
752 sizeof(unsigned int) * 32);
753 if(fprs
& FPRS_FEF
) {
754 fpregs
->pr_fsr
= current
->thread
.xfsr
[0];
755 fpregs
->pr_gsr
= current
->thread
.gsr
[0];
757 fpregs
->pr_fsr
= fpregs
->pr_gsr
= 0;
759 fpregs
->pr_fprs
= fprs
;
765 * sparc_execve() executes a new program after the asm stub has set
766 * things up for us. This should basically do what I want it to.
768 asmlinkage
int sparc_execve(struct pt_regs
*regs
)
773 /* User register window flush is done by entry.S */
775 /* Check for indirect call. */
776 if (regs
->u_regs
[UREG_G1
] == 0)
779 filename
= getname((char *)regs
->u_regs
[base
+ UREG_I0
]);
780 error
= PTR_ERR(filename
);
781 if (IS_ERR(filename
))
783 error
= do_execve(filename
, (char **) regs
->u_regs
[base
+ UREG_I1
],
784 (char **) regs
->u_regs
[base
+ UREG_I2
], regs
);
788 current
->thread
.xfsr
[0] = 0;
789 current
->thread
.fpsaved
[0] = 0;
790 regs
->tstate
&= ~TSTATE_PEF
;