Lines Matching refs:tsk
88 static void check_if_tm_restore_required(struct task_struct *tsk) in check_if_tm_restore_required() argument
96 if (tsk == current && tsk->thread.regs && in check_if_tm_restore_required()
97 MSR_TM_ACTIVE(tsk->thread.regs->msr) && in check_if_tm_restore_required()
99 regs_set_return_msr(&tsk->thread.ckpt_regs, in check_if_tm_restore_required()
100 tsk->thread.regs->msr); in check_if_tm_restore_required()
106 static inline void check_if_tm_restore_required(struct task_struct *tsk) { } in check_if_tm_restore_required() argument
156 static void __giveup_fpu(struct task_struct *tsk) in __giveup_fpu() argument
160 save_fpu(tsk); in __giveup_fpu()
161 msr = tsk->thread.regs->msr; in __giveup_fpu()
165 regs_set_return_msr(tsk->thread.regs, msr); in __giveup_fpu()
168 void giveup_fpu(struct task_struct *tsk) in giveup_fpu() argument
170 check_if_tm_restore_required(tsk); in giveup_fpu()
173 __giveup_fpu(tsk); in giveup_fpu()
182 void flush_fp_to_thread(struct task_struct *tsk) in flush_fp_to_thread() argument
184 if (tsk->thread.regs) { in flush_fp_to_thread()
194 if (tsk->thread.regs->msr & MSR_FP) { in flush_fp_to_thread()
202 BUG_ON(tsk != current); in flush_fp_to_thread()
203 giveup_fpu(tsk); in flush_fp_to_thread()
235 static inline void __giveup_fpu(struct task_struct *tsk) { } in __giveup_fpu() argument
239 static void __giveup_altivec(struct task_struct *tsk) in __giveup_altivec() argument
243 save_altivec(tsk); in __giveup_altivec()
244 msr = tsk->thread.regs->msr; in __giveup_altivec()
248 regs_set_return_msr(tsk->thread.regs, msr); in __giveup_altivec()
251 void giveup_altivec(struct task_struct *tsk) in giveup_altivec() argument
253 check_if_tm_restore_required(tsk); in giveup_altivec()
256 __giveup_altivec(tsk); in giveup_altivec()
290 void flush_altivec_to_thread(struct task_struct *tsk) in flush_altivec_to_thread() argument
292 if (tsk->thread.regs) { in flush_altivec_to_thread()
294 if (tsk->thread.regs->msr & MSR_VEC) { in flush_altivec_to_thread()
295 BUG_ON(tsk != current); in flush_altivec_to_thread()
296 giveup_altivec(tsk); in flush_altivec_to_thread()
305 static void __giveup_vsx(struct task_struct *tsk) in __giveup_vsx() argument
307 unsigned long msr = tsk->thread.regs->msr; in __giveup_vsx()
317 __giveup_fpu(tsk); in __giveup_vsx()
319 __giveup_altivec(tsk); in __giveup_vsx()
322 static void giveup_vsx(struct task_struct *tsk) in giveup_vsx() argument
324 check_if_tm_restore_required(tsk); in giveup_vsx()
327 __giveup_vsx(tsk); in giveup_vsx()
357 void flush_vsx_to_thread(struct task_struct *tsk) in flush_vsx_to_thread() argument
359 if (tsk->thread.regs) { in flush_vsx_to_thread()
361 if (tsk->thread.regs->msr & (MSR_VSX|MSR_VEC|MSR_FP)) { in flush_vsx_to_thread()
362 BUG_ON(tsk != current); in flush_vsx_to_thread()
363 giveup_vsx(tsk); in flush_vsx_to_thread()
372 void giveup_spe(struct task_struct *tsk) in giveup_spe() argument
374 check_if_tm_restore_required(tsk); in giveup_spe()
377 __giveup_spe(tsk); in giveup_spe()
395 void flush_spe_to_thread(struct task_struct *tsk) in flush_spe_to_thread() argument
397 if (tsk->thread.regs) { in flush_spe_to_thread()
399 if (tsk->thread.regs->msr & MSR_SPE) { in flush_spe_to_thread()
400 BUG_ON(tsk != current); in flush_spe_to_thread()
401 tsk->thread.spefscr = mfspr(SPRN_SPEFSCR); in flush_spe_to_thread()
402 giveup_spe(tsk); in flush_spe_to_thread()
426 void giveup_all(struct task_struct *tsk) in giveup_all() argument
430 if (!tsk->thread.regs) in giveup_all()
433 check_if_tm_restore_required(tsk); in giveup_all()
435 usermsr = tsk->thread.regs->msr; in giveup_all()
445 __giveup_fpu(tsk); in giveup_all()
447 __giveup_altivec(tsk); in giveup_all()
449 __giveup_spe(tsk); in giveup_all()
568 static void save_all(struct task_struct *tsk) in save_all() argument
572 if (!tsk->thread.regs) in save_all()
575 usermsr = tsk->thread.regs->msr; in save_all()
585 save_fpu(tsk); in save_all()
588 save_altivec(tsk); in save_all()
591 __giveup_spe(tsk); in save_all()
596 void flush_all_to_thread(struct task_struct *tsk) in flush_all_to_thread() argument
598 if (tsk->thread.regs) { in flush_all_to_thread()
600 BUG_ON(tsk != current); in flush_all_to_thread()
602 if (tsk->thread.regs->msr & MSR_SPE) in flush_all_to_thread()
603 tsk->thread.spefscr = mfspr(SPRN_SPEFSCR); in flush_all_to_thread()
605 save_all(tsk); in flush_all_to_thread()
899 static inline bool tm_enabled(struct task_struct *tsk) in tm_enabled() argument
901 return tsk && tsk->thread.regs && (tsk->thread.regs->msr & MSR_TM); in tm_enabled()
954 static inline void tm_reclaim_task(struct task_struct *tsk) in tm_reclaim_task() argument
966 struct thread_struct *thr = &tsk->thread; in tm_reclaim_task()
978 tsk->pid, thr->regs->nip, in tm_reclaim_task()
985 tsk->pid); in tm_reclaim_task()
1916 int set_fpexc_mode(struct task_struct *tsk, unsigned int val) in set_fpexc_mode() argument
1918 struct pt_regs *regs = tsk->thread.regs; in set_fpexc_mode()
1939 tsk->thread.spefscr_last = mfspr(SPRN_SPEFSCR); in set_fpexc_mode()
1940 tsk->thread.fpexc_mode = val & in set_fpexc_mode()
1956 tsk->thread.fpexc_mode = __pack_fe01(val); in set_fpexc_mode()
1959 | tsk->thread.fpexc_mode); in set_fpexc_mode()
1964 int get_fpexc_mode(struct task_struct *tsk, unsigned long adr) in get_fpexc_mode() argument
1968 if (tsk->thread.fpexc_mode & PR_FP_EXC_SW_ENABLE) { in get_fpexc_mode()
1983 tsk->thread.spefscr_last = mfspr(SPRN_SPEFSCR); in get_fpexc_mode()
1984 val = tsk->thread.fpexc_mode; in get_fpexc_mode()
1989 val = __unpack_fe01(tsk->thread.fpexc_mode); in get_fpexc_mode()
1994 int set_endian(struct task_struct *tsk, unsigned int val) in set_endian() argument
1996 struct pt_regs *regs = tsk->thread.regs; in set_endian()
2015 int get_endian(struct task_struct *tsk, unsigned long adr) in get_endian() argument
2017 struct pt_regs *regs = tsk->thread.regs; in get_endian()
2038 int set_unalign_ctl(struct task_struct *tsk, unsigned int val) in set_unalign_ctl() argument
2040 tsk->thread.align_ctl = val; in set_unalign_ctl()
2044 int get_unalign_ctl(struct task_struct *tsk, unsigned long adr) in get_unalign_ctl() argument
2046 return put_user(tsk->thread.align_ctl, (unsigned int __user *)adr); in get_unalign_ctl()
2153 void __no_sanitize_address show_stack(struct task_struct *tsk, in show_stack() argument
2163 if (tsk == NULL) in show_stack()
2164 tsk = current; in show_stack()
2166 if (!try_get_task_stack(tsk)) in show_stack()
2171 if (tsk == current) in show_stack()
2174 sp = tsk->thread.ksp; in show_stack()
2180 if (!validate_sp(sp, tsk, STACK_FRAME_OVERHEAD)) in show_stack()
2203 if (validate_sp(sp, tsk, STACK_FRAME_WITH_PT_REGS) in show_stack()
2221 put_task_stack(tsk); in show_stack()