patch-2.3.99-pre6 linux/arch/sh/kernel/process.c
Next file: linux/arch/sh/kernel/setup.c
Previous file: linux/arch/sh/kernel/irq_onchip.c
Back to the patch index
Back to the overall index
- Lines: 76
- Date:
Mon Apr 24 13:54:17 2000
- Orig file:
v2.3.99-pre5/linux/arch/sh/kernel/process.c
- Orig date:
Tue Apr 11 15:09:14 2000
diff -u --recursive --new-file v2.3.99-pre5/linux/arch/sh/kernel/process.c linux/arch/sh/kernel/process.c
@@ -136,20 +136,20 @@
*/
int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
{ /* Don't use this in BL=1(cli). Or else, CPU resets! */
- register unsigned long __sc0 __asm__ ("$r0") = __NR_clone;
+ register unsigned long __sc0 __asm__ ("$r3") = __NR_clone;
register unsigned long __sc4 __asm__ ("$r4") = (long) flags | CLONE_VM;
register unsigned long __sc5 __asm__ ("$r5") = 0;
register unsigned long __sc8 __asm__ ("$r8") = (long) arg;
register unsigned long __sc9 __asm__ ("$r9") = (long) fn;
- __asm__("trapa #0\n\t" /* Linux/SH system call */
+ __asm__("trapa #0x12\n\t" /* Linux/SH system call */
"tst #0xff, $r0\n\t" /* child or parent? */
"bf 1f\n\t" /* parent - jump */
"jsr @$r9\n\t" /* call fn */
" mov $r8, $r4\n\t" /* push argument */
"mov $r0, $r4\n\t" /* return value to arg of exit */
- "mov %2, $r0\n\t" /* exit */
- "trapa #0\n"
+ "mov %2, $r3\n\t" /* exit */
+ "trapa #0x11\n"
"1:"
: "=z" (__sc0)
: "0" (__sc0), "i" (__NR_exit),
@@ -194,7 +194,11 @@
fpvalid = tsk->used_math;
if (fpvalid) {
+ unsigned long flags;
+
+ save_and_cli(flags);
unlazy_fpu(tsk);
+ restore_flags(flags);
memcpy(fpu, &tsk->thread.fpu.hard, sizeof(*fpu));
}
@@ -214,7 +218,11 @@
struct task_struct *tsk = current;
if (tsk != &init_task) {
+ unsigned long flags;
+
+ save_and_cli(flags);
unlazy_fpu(tsk);
+ restore_flags(flags);
p->thread.fpu = current->thread.fpu;
p->used_math = tsk->used_math;
}
@@ -263,16 +271,21 @@
void __switch_to(struct task_struct *prev, struct task_struct *next)
{
#if defined(__SH4__)
- if (prev != &init_task)
+ if (prev != &init_task) {
+ unsigned long flags;
+
+ save_and_cli(flags);
unlazy_fpu(prev);
+ restore_flags(flags);
+ }
#endif
/*
- * Restore the kernel stack onto kernel mode register
- * k4 (r4_bank1)
+ * Restore the kernel mode register
+ * k7 (r7_bank1)
*/
- asm volatile("ldc %0, $r4_bank"
+ asm volatile("ldc %0, $r7_bank"
: /* no output */
- :"r" ((unsigned long)next+8192));
+ :"r" (next));
}
asmlinkage int sys_fork(unsigned long r4, unsigned long r5,
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)