Lines Matching refs:tsk

89 static void check_if_tm_restore_required(struct task_struct *tsk)  in check_if_tm_restore_required()  argument
97 if (tsk == current && tsk->thread.regs && in check_if_tm_restore_required()
98 MSR_TM_ACTIVE(tsk->thread.regs->msr) && in check_if_tm_restore_required()
100 tsk->thread.ckpt_regs.msr = tsk->thread.regs->msr; in check_if_tm_restore_required()
110 static bool tm_active_with_fp(struct task_struct *tsk) in tm_active_with_fp() argument
112 return msr_tm_active(tsk->thread.regs->msr) && in tm_active_with_fp()
113 (tsk->thread.ckpt_regs.msr & MSR_FP); in tm_active_with_fp()
116 static bool tm_active_with_altivec(struct task_struct *tsk) in tm_active_with_altivec() argument
118 return msr_tm_active(tsk->thread.regs->msr) && in tm_active_with_altivec()
119 (tsk->thread.ckpt_regs.msr & MSR_VEC); in tm_active_with_altivec()
123 static inline void check_if_tm_restore_required(struct task_struct *tsk) { } in check_if_tm_restore_required() argument
124 static inline bool tm_active_with_fp(struct task_struct *tsk) { return false; } in tm_active_with_fp() argument
125 static inline bool tm_active_with_altivec(struct task_struct *tsk) { return false; } in tm_active_with_altivec() argument
177 static void __giveup_fpu(struct task_struct *tsk) in __giveup_fpu() argument
181 save_fpu(tsk); in __giveup_fpu()
182 msr = tsk->thread.regs->msr; in __giveup_fpu()
188 tsk->thread.regs->msr = msr; in __giveup_fpu()
191 void giveup_fpu(struct task_struct *tsk) in giveup_fpu() argument
193 check_if_tm_restore_required(tsk); in giveup_fpu()
196 __giveup_fpu(tsk); in giveup_fpu()
205 void flush_fp_to_thread(struct task_struct *tsk) in flush_fp_to_thread() argument
207 if (tsk->thread.regs) { in flush_fp_to_thread()
217 if (tsk->thread.regs->msr & MSR_FP) { in flush_fp_to_thread()
225 BUG_ON(tsk != current); in flush_fp_to_thread()
226 giveup_fpu(tsk); in flush_fp_to_thread()
257 static int restore_fp(struct task_struct *tsk) in restore_fp() argument
259 if (tsk->thread.load_fp || tm_active_with_fp(tsk)) { in restore_fp()
267 static int restore_fp(struct task_struct *tsk) { return 0; } in restore_fp() argument
273 static void __giveup_altivec(struct task_struct *tsk) in __giveup_altivec() argument
277 save_altivec(tsk); in __giveup_altivec()
278 msr = tsk->thread.regs->msr; in __giveup_altivec()
284 tsk->thread.regs->msr = msr; in __giveup_altivec()
287 void giveup_altivec(struct task_struct *tsk) in giveup_altivec() argument
289 check_if_tm_restore_required(tsk); in giveup_altivec()
292 __giveup_altivec(tsk); in giveup_altivec()
325 void flush_altivec_to_thread(struct task_struct *tsk) in flush_altivec_to_thread() argument
327 if (tsk->thread.regs) { in flush_altivec_to_thread()
329 if (tsk->thread.regs->msr & MSR_VEC) { in flush_altivec_to_thread()
330 BUG_ON(tsk != current); in flush_altivec_to_thread()
331 giveup_altivec(tsk); in flush_altivec_to_thread()
338 static int restore_altivec(struct task_struct *tsk) in restore_altivec() argument
341 (tsk->thread.load_vec || tm_active_with_altivec(tsk))) { in restore_altivec()
342 load_vr_state(&tsk->thread.vr_state); in restore_altivec()
343 tsk->thread.used_vr = 1; in restore_altivec()
344 tsk->thread.load_vec++; in restore_altivec()
352 static inline int restore_altivec(struct task_struct *tsk) { return 0; } in restore_altivec() argument
356 static void __giveup_vsx(struct task_struct *tsk) in __giveup_vsx() argument
358 unsigned long msr = tsk->thread.regs->msr; in __giveup_vsx()
368 __giveup_fpu(tsk); in __giveup_vsx()
370 __giveup_altivec(tsk); in __giveup_vsx()
373 static void giveup_vsx(struct task_struct *tsk) in giveup_vsx() argument
375 check_if_tm_restore_required(tsk); in giveup_vsx()
378 __giveup_vsx(tsk); in giveup_vsx()
407 void flush_vsx_to_thread(struct task_struct *tsk) in flush_vsx_to_thread() argument
409 if (tsk->thread.regs) { in flush_vsx_to_thread()
411 if (tsk->thread.regs->msr & (MSR_VSX|MSR_VEC|MSR_FP)) { in flush_vsx_to_thread()
412 BUG_ON(tsk != current); in flush_vsx_to_thread()
413 giveup_vsx(tsk); in flush_vsx_to_thread()
420 static int restore_vsx(struct task_struct *tsk) in restore_vsx() argument
423 tsk->thread.used_vsr = 1; in restore_vsx()
430 static inline int restore_vsx(struct task_struct *tsk) { return 0; } in restore_vsx() argument
434 void giveup_spe(struct task_struct *tsk) in giveup_spe() argument
436 check_if_tm_restore_required(tsk); in giveup_spe()
439 __giveup_spe(tsk); in giveup_spe()
457 void flush_spe_to_thread(struct task_struct *tsk) in flush_spe_to_thread() argument
459 if (tsk->thread.regs) { in flush_spe_to_thread()
461 if (tsk->thread.regs->msr & MSR_SPE) { in flush_spe_to_thread()
462 BUG_ON(tsk != current); in flush_spe_to_thread()
463 tsk->thread.spefscr = mfspr(SPRN_SPEFSCR); in flush_spe_to_thread()
464 giveup_spe(tsk); in flush_spe_to_thread()
495 void giveup_all(struct task_struct *tsk) in giveup_all() argument
499 if (!tsk->thread.regs) in giveup_all()
502 usermsr = tsk->thread.regs->msr; in giveup_all()
508 check_if_tm_restore_required(tsk); in giveup_all()
514 __giveup_fpu(tsk); in giveup_all()
518 __giveup_altivec(tsk); in giveup_all()
522 __giveup_spe(tsk); in giveup_all()
560 static void save_all(struct task_struct *tsk) in save_all() argument
564 if (!tsk->thread.regs) in save_all()
567 usermsr = tsk->thread.regs->msr; in save_all()
577 save_fpu(tsk); in save_all()
580 save_altivec(tsk); in save_all()
583 __giveup_spe(tsk); in save_all()
586 thread_pkey_regs_save(&tsk->thread); in save_all()
589 void flush_all_to_thread(struct task_struct *tsk) in flush_all_to_thread() argument
591 if (tsk->thread.regs) { in flush_all_to_thread()
593 BUG_ON(tsk != current); in flush_all_to_thread()
594 save_all(tsk); in flush_all_to_thread()
597 if (tsk->thread.regs->msr & MSR_SPE) in flush_all_to_thread()
598 tsk->thread.spefscr = mfspr(SPRN_SPEFSCR); in flush_all_to_thread()
865 static inline bool tm_enabled(struct task_struct *tsk) in tm_enabled() argument
867 return tsk && tsk->thread.regs && (tsk->thread.regs->msr & MSR_TM); in tm_enabled()
920 static inline void tm_reclaim_task(struct task_struct *tsk) in tm_reclaim_task() argument
932 struct thread_struct *thr = &tsk->thread; in tm_reclaim_task()
944 tsk->pid, thr->regs->nip, in tm_reclaim_task()
951 tsk->pid); in tm_reclaim_task()
1851 int set_fpexc_mode(struct task_struct *tsk, unsigned int val) in set_fpexc_mode() argument
1853 struct pt_regs *regs = tsk->thread.regs; in set_fpexc_mode()
1874 tsk->thread.spefscr_last = mfspr(SPRN_SPEFSCR); in set_fpexc_mode()
1875 tsk->thread.fpexc_mode = val & in set_fpexc_mode()
1893 tsk->thread.fpexc_mode = __pack_fe01(val); in set_fpexc_mode()
1896 | tsk->thread.fpexc_mode; in set_fpexc_mode()
1900 int get_fpexc_mode(struct task_struct *tsk, unsigned long adr) in get_fpexc_mode() argument
1904 if (tsk->thread.fpexc_mode & PR_FP_EXC_SW_ENABLE) in get_fpexc_mode()
1919 tsk->thread.spefscr_last = mfspr(SPRN_SPEFSCR); in get_fpexc_mode()
1920 val = tsk->thread.fpexc_mode; in get_fpexc_mode()
1927 val = __unpack_fe01(tsk->thread.fpexc_mode); in get_fpexc_mode()
1931 int set_endian(struct task_struct *tsk, unsigned int val) in set_endian() argument
1933 struct pt_regs *regs = tsk->thread.regs; in set_endian()
1952 int get_endian(struct task_struct *tsk, unsigned long adr) in get_endian() argument
1954 struct pt_regs *regs = tsk->thread.regs; in get_endian()
1975 int set_unalign_ctl(struct task_struct *tsk, unsigned int val) in set_unalign_ctl() argument
1977 tsk->thread.align_ctl = val; in set_unalign_ctl()
1981 int get_unalign_ctl(struct task_struct *tsk, unsigned long adr) in get_unalign_ctl() argument
1983 return put_user(tsk->thread.align_ctl, (unsigned int __user *)adr); in get_unalign_ctl()
2052 void show_stack(struct task_struct *tsk, unsigned long *stack) in show_stack() argument
2064 if (tsk == NULL) in show_stack()
2065 tsk = current; in show_stack()
2067 if (tsk == current) in show_stack()
2070 sp = tsk->thread.ksp; in show_stack()
2076 if (!validate_sp(sp, tsk, STACK_FRAME_OVERHEAD)) in show_stack()
2101 if (validate_sp(sp, tsk, STACK_INT_FRAME_SIZE) in show_stack()