process.c (fb09692e71f13af7298eb603a1975850b1c7a8d8) process.c (bc2a9408fa65195288b41751016c36fd00a75a85)
1/*
2 * Derived from "arch/i386/kernel/process.c"
3 * Copyright (C) 1995 Linus Torvalds
4 *
5 * Updated and modified by Cort Dougan (cort@cs.nmt.edu) and
6 * Paul Mackerras (paulus@cs.anu.edu.au)
7 *
8 * PowerPC version

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

510 /* Always save the regs here, even if a transaction's not active.
511 * This context-switches a thread's TM info SPRs. We do it here to
512 * be consistent with the restore path (in recheckpoint) which
513 * cannot happen later in _switch().
514 */
515 tm_save_sprs(thr);
516}
517
1/*
2 * Derived from "arch/i386/kernel/process.c"
3 * Copyright (C) 1995 Linus Torvalds
4 *
5 * Updated and modified by Cort Dougan (cort@cs.nmt.edu) and
6 * Paul Mackerras (paulus@cs.anu.edu.au)
7 *
8 * PowerPC version

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

510 /* Always save the regs here, even if a transaction's not active.
511 * This context-switches a thread's TM info SPRs. We do it here to
512 * be consistent with the restore path (in recheckpoint) which
513 * cannot happen later in _switch().
514 */
515 tm_save_sprs(thr);
516}
517
518static inline void __maybe_unused tm_recheckpoint_new_task(struct task_struct *new)
518static inline void tm_recheckpoint_new_task(struct task_struct *new)
519{
520 unsigned long msr;
521
522 if (!cpu_has_feature(CPU_FTR_TM))
523 return;
524
525 /* Recheckpoint the registers of the thread we're about to switch to.
526 *

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

585{
586 struct thread_struct *new_thread, *old_thread;
587 unsigned long flags;
588 struct task_struct *last;
589#ifdef CONFIG_PPC_BOOK3S_64
590 struct ppc64_tlb_batch *batch;
591#endif
592
519{
520 unsigned long msr;
521
522 if (!cpu_has_feature(CPU_FTR_TM))
523 return;
524
525 /* Recheckpoint the registers of the thread we're about to switch to.
526 *

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

585{
586 struct thread_struct *new_thread, *old_thread;
587 unsigned long flags;
588 struct task_struct *last;
589#ifdef CONFIG_PPC_BOOK3S_64
590 struct ppc64_tlb_batch *batch;
591#endif
592
593 __switch_to_tm(prev);
594
593#ifdef CONFIG_SMP
594 /* avoid complexity of lazy save/restore of fpu
595 * by just saving it every time we switch out if
596 * this task used the fpu during the last quantum.
597 *
598 * If it tries to use the fpu again, it'll trap and
599 * reload its fp regs. So we don't have to do a restore
600 * every switch, just a save.

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

700 local_irq_save(flags);
701
702 /*
703 * We can't take a PMU exception inside _switch() since there is a
704 * window where the kernel stack SLB and the kernel stack are out
705 * of sync. Hard disable here.
706 */
707 hard_irq_disable();
595#ifdef CONFIG_SMP
596 /* avoid complexity of lazy save/restore of fpu
597 * by just saving it every time we switch out if
598 * this task used the fpu during the last quantum.
599 *
600 * If it tries to use the fpu again, it'll trap and
601 * reload its fp regs. So we don't have to do a restore
602 * every switch, just a save.

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

702 local_irq_save(flags);
703
704 /*
705 * We can't take a PMU exception inside _switch() since there is a
706 * window where the kernel stack SLB and the kernel stack are out
707 * of sync. Hard disable here.
708 */
709 hard_irq_disable();
710
711 tm_recheckpoint_new_task(new);
712
708 last = _switch(old_thread, new_thread);
709
710#ifdef CONFIG_PPC_BOOK3S_64
711 if (current_thread_info()->local_flags & _TLF_LAZY_MMU) {
712 current_thread_info()->local_flags &= ~_TLF_LAZY_MMU;
713 batch = &__get_cpu_var(ppc64_tlb_batch);
714 batch->active = 1;
715 }

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

1075 regs->gpr[2] = toc;
1076 regs->msr = MSR_USER64;
1077 } else {
1078 regs->nip = start;
1079 regs->gpr[2] = 0;
1080 regs->msr = MSR_USER32;
1081 }
1082#endif
713 last = _switch(old_thread, new_thread);
714
715#ifdef CONFIG_PPC_BOOK3S_64
716 if (current_thread_info()->local_flags & _TLF_LAZY_MMU) {
717 current_thread_info()->local_flags &= ~_TLF_LAZY_MMU;
718 batch = &__get_cpu_var(ppc64_tlb_batch);
719 batch->active = 1;
720 }

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

1080 regs->gpr[2] = toc;
1081 regs->msr = MSR_USER64;
1082 } else {
1083 regs->nip = start;
1084 regs->gpr[2] = 0;
1085 regs->msr = MSR_USER32;
1086 }
1087#endif
1083
1084 discard_lazy_cpu_state();
1085#ifdef CONFIG_VSX
1086 current->thread.used_vsr = 0;
1087#endif
1088 memset(current->thread.fpr, 0, sizeof(current->thread.fpr));
1089 current->thread.fpscr.val = 0;
1090#ifdef CONFIG_ALTIVEC
1091 memset(current->thread.vr, 0, sizeof(current->thread.vr));
1092 memset(&current->thread.vscr, 0, sizeof(current->thread.vscr));
1093 current->thread.vscr.u[3] = 0x00010000; /* Java mode disabled */
1094 current->thread.vrsave = 0;
1095 current->thread.used_vr = 0;
1096#endif /* CONFIG_ALTIVEC */
1097#ifdef CONFIG_SPE
1098 memset(current->thread.evr, 0, sizeof(current->thread.evr));
1099 current->thread.acc = 0;
1100 current->thread.spefscr = 0;
1101 current->thread.used_spe = 0;
1102#endif /* CONFIG_SPE */
1088 discard_lazy_cpu_state();
1089#ifdef CONFIG_VSX
1090 current->thread.used_vsr = 0;
1091#endif
1092 memset(current->thread.fpr, 0, sizeof(current->thread.fpr));
1093 current->thread.fpscr.val = 0;
1094#ifdef CONFIG_ALTIVEC
1095 memset(current->thread.vr, 0, sizeof(current->thread.vr));
1096 memset(&current->thread.vscr, 0, sizeof(current->thread.vscr));
1097 current->thread.vscr.u[3] = 0x00010000; /* Java mode disabled */
1098 current->thread.vrsave = 0;
1099 current->thread.used_vr = 0;
1100#endif /* CONFIG_ALTIVEC */
1101#ifdef CONFIG_SPE
1102 memset(current->thread.evr, 0, sizeof(current->thread.evr));
1103 current->thread.acc = 0;
1104 current->thread.spefscr = 0;
1105 current->thread.used_spe = 0;
1106#endif /* CONFIG_SPE */
1107#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
1108 if (cpu_has_feature(CPU_FTR_TM))
1109 regs->msr |= MSR_TM;
1110 current->thread.tm_tfhar = 0;
1111 current->thread.tm_texasr = 0;
1112 current->thread.tm_tfiar = 0;
1113#endif /* CONFIG_PPC_TRANSACTIONAL_MEM */
1103}
1104
1105#define PR_FP_ALL_EXCEPT (PR_FP_EXC_DIV | PR_FP_EXC_OVF | PR_FP_EXC_UND \
1106 | PR_FP_EXC_RES | PR_FP_EXC_INV)
1107
1108int set_fpexc_mode(struct task_struct *tsk, unsigned int val)
1109{
1110 struct pt_regs *regs = tsk->thread.regs;

--- 329 unchanged lines hidden ---
1114}
1115
1116#define PR_FP_ALL_EXCEPT (PR_FP_EXC_DIV | PR_FP_EXC_OVF | PR_FP_EXC_UND \
1117 | PR_FP_EXC_RES | PR_FP_EXC_INV)
1118
1119int set_fpexc_mode(struct task_struct *tsk, unsigned int val)
1120{
1121 struct pt_regs *regs = tsk->thread.regs;

--- 329 unchanged lines hidden ---