patch-2.3.45 linux/arch/ppc/kernel/process.c
Next file: linux/arch/ppc/kernel/prom.c
Previous file: linux/arch/ppc/kernel/ppc_ksyms.c
Back to the patch index
Back to the overall index
- Lines: 101
- Date:
Sun Feb 13 10:47:01 2000
- Orig file:
v2.3.44/linux/arch/ppc/kernel/process.c
- Orig date:
Thu Feb 10 17:11:05 2000
diff -u --recursive --new-file v2.3.44/linux/arch/ppc/kernel/process.c linux/arch/ppc/kernel/process.c
@@ -140,15 +140,31 @@
}
#endif /* defined(CHECK_STACK) */
+#ifdef CONFIG_ALTIVEC
int
-dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpregs)
+dump_altivec(struct pt_regs *regs, elf_vrregset_t *vrregs)
{
- if (regs->msr & MSR_FP)
- giveup_fpu(current);
- memcpy(fpregs, ¤t->thread.fpr[0], sizeof(*fpregs));
+ if (regs->msr & MSR_VEC)
+ giveup_altivec(current);
+ memcpy(vrregs, ¤t->thread.vr[0], sizeof(*vrregs));
return 1;
}
+void
+enable_kernel_altivec(void)
+{
+#ifdef __SMP__
+ if (current->thread.regs && (current->thread.regs->msr & MSR_VEC))
+ giveup_altivec(current);
+ else
+ giveup_altivec(NULL): /* just enable AltiVec for kernel - force */
+#else
+ giveup_altivec(last_task_used_altivec);
+#endif /* __SMP __ */
+ printk("MSR_VEC in enable_altivec_kernel\n");
+}
+#endif /* CONFIG_ALTIVEC */
+
void
enable_kernel_fp(void)
{
@@ -162,6 +178,15 @@
#endif /* __SMP__ */
}
+int
+dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpregs)
+{
+ if (regs->msr & MSR_FP)
+ giveup_fpu(current);
+ memcpy(fpregs, ¤t->thread.fpr[0], sizeof(*fpregs));
+ return 1;
+}
+
void
_switch_to(struct task_struct *prev, struct task_struct *new,
struct task_struct **last)
@@ -194,6 +219,7 @@
*/
if ( prev->thread.regs && (prev->thread.regs->msr & MSR_FP) )
giveup_fpu(prev);
+#ifdef CONFIG_ALTIVEC
/*
* If the previous thread 1) has some altivec regs it wants saved
* (has bits in vrsave set) and 2) used altivec in the last quantum
@@ -206,6 +232,7 @@
if ( (prev->thread.regs && (prev->thread.regs->msr & MSR_VEC)) &&
prev->thread.vrsave )
giveup_altivec(prev);
+#endif /* CONFIG_ALTIVEC */
prev->last_processor = prev->processor;
current_set[smp_processor_id()] = new;
#endif /* __SMP__ */
@@ -337,13 +364,18 @@
p->thread.fpscr = current->thread.fpscr;
childregs->msr &= ~MSR_FP;
+#ifdef CONFIG_ALTIVEC
+ /*
+ * copy altiVec info - assume lazy altiVec switch
+ * - kumar
+ */
if (regs->msr & MSR_VEC)
giveup_altivec(current);
- if ( p->thread.vrsave )
- memcpy(&p->thread.vrf, ¤t->thread.vrf, sizeof(p->thread.vrf));
+
+ memcpy(&p->thread.vr, ¤t->thread.vr, sizeof(p->thread.vr));
p->thread.vscr = current->thread.vscr;
- p->thread.vrsave = current->thread.vrsave;
childregs->msr &= ~MSR_VEC;
+#endif /* CONFIG_ALTIVEC */
#ifdef __SMP__
p->last_processor = NO_PROC_ID;
@@ -463,6 +495,10 @@
goto out;
if (regs->msr & MSR_FP)
giveup_fpu(current);
+#ifdef CONFIG_ALTIVEC
+ if (regs->msr & MSR_VEC)
+ giveup_altivec(current);
+#endif /* CONFIG_ALTIVEC */
error = do_execve(filename, (char **) a1, (char **) a2, regs);
putname(filename);
out:
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)