Lines Matching +full:supervisor +full:- +full:mode +full:- +full:visible

1 // SPDX-License-Identifier: GPL-2.0-or-later
10 * Copyright (C) 1995-1996 Gary Thomas ([email protected])
57 #include <asm/text-patching.h>
61 #include <asm/asm-prototypes.h>
77 * Are we running in "Suspend disabled" mode? If so we have to block any
91 if (tsk == current && tsk->thread.regs && in check_if_tm_restore_required()
92 MSR_TM_ACTIVE(tsk->thread.regs->msr) && in check_if_tm_restore_required()
94 regs_set_return_msr(&tsk->thread.ckpt_regs, in check_if_tm_restore_required()
95 tsk->thread.regs->msr); in check_if_tm_restore_required()
156 msr = tsk->thread.regs->msr; in __giveup_fpu()
160 regs_set_return_msr(tsk->thread.regs, msr); in __giveup_fpu()
174 * Make sure the floating-point register state in the
179 if (tsk->thread.regs) { in flush_fp_to_thread()
182 * another process could get scheduled after the regs->msr in flush_fp_to_thread()
189 if (tsk->thread.regs->msr & MSR_FP) { in flush_fp_to_thread()
213 if (current->thread.regs && (current->thread.regs->msr & MSR_FP)) { in enable_kernel_fp()
223 MSR_TM_ACTIVE(current->thread.regs->msr)) in enable_kernel_fp()
239 msr = tsk->thread.regs->msr; in __giveup_altivec()
243 regs_set_return_msr(tsk->thread.regs, msr); in __giveup_altivec()
264 if (current->thread.regs && (current->thread.regs->msr & MSR_VEC)) { in enable_kernel_altivec()
274 MSR_TM_ACTIVE(current->thread.regs->msr)) in enable_kernel_altivec()
287 if (tsk->thread.regs) { in flush_altivec_to_thread()
289 if (tsk->thread.regs->msr & MSR_VEC) { in flush_altivec_to_thread()
302 unsigned long msr = tsk->thread.regs->msr; in __giveup_vsx()
334 if (current->thread.regs && in enable_kernel_vsx()
335 (current->thread.regs->msr & (MSR_VSX|MSR_VEC|MSR_FP))) { in enable_kernel_vsx()
345 MSR_TM_ACTIVE(current->thread.regs->msr)) in enable_kernel_vsx()
354 if (tsk->thread.regs) { in flush_vsx_to_thread()
356 if (tsk->thread.regs->msr & (MSR_VSX|MSR_VEC|MSR_FP)) { in flush_vsx_to_thread()
383 if (current->thread.regs && (current->thread.regs->msr & MSR_SPE)) { in enable_kernel_spe()
392 if (tsk->thread.regs) { in flush_spe_to_thread()
394 if (tsk->thread.regs->msr & MSR_SPE) { in flush_spe_to_thread()
396 tsk->thread.spefscr = mfspr(SPRN_SPEFSCR); in flush_spe_to_thread()
425 if (!tsk->thread.regs) in giveup_all()
430 usermsr = tsk->thread.regs->msr; in giveup_all()
454 if (current->thread.load_fp) { in should_restore_fp()
455 current->thread.load_fp++; in should_restore_fp()
463 load_fp_state(&current->thread.fp_state); in do_restore_fp()
473 if (cpu_has_feature(CPU_FTR_ALTIVEC) && (current->thread.load_vec)) { in should_restore_altivec()
474 current->thread.load_vec++; in should_restore_altivec()
482 load_vr_state(&current->thread.vr_state); in do_restore_altivec()
483 current->thread.used_vr = 1; in do_restore_altivec()
499 current->thread.used_vsr = 1; in do_restore_vsx()
511 * could be done by having ftrace entry code check for this un-reconciled
520 msr = regs->msr; in restore_math()
547 fpexc_mode = current->thread.fpexc_mode; in restore_math()
558 regs_set_return_msr(regs, regs->msr | new_msr | fpexc_mode); in restore_math()
567 if (!tsk->thread.regs) in save_all()
570 usermsr = tsk->thread.regs->msr; in save_all()
593 if (tsk->thread.regs) { 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()
611 current->thread.trap_nr = TRAP_HWBKPT; in do_send_trap()
638 current->thread.hw_brk[0] = null_brk; in do_break_handler()
639 current->thread.hw_brk[0].flags |= HW_BRK_FLAG_DISABLED; in do_break_handler()
647 info = &current->thread.hw_brk[i]; in do_break_handler()
648 if (!info->address) in do_break_handler()
653 current->thread.hw_brk[i] = null_brk; in do_break_handler()
654 current->thread.hw_brk[i].flags |= HW_BRK_FLAG_DISABLED; in do_break_handler()
661 current->thread.trap_nr = TRAP_HWBKPT; in DEFINE_INTERRUPT_HANDLER()
662 if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, regs->dsisr, in DEFINE_INTERRUPT_HANDLER()
680 force_sig_fault(SIGTRAP, TRAP_HWBKPT, (void __user *)regs->dar); in DEFINE_INTERRUPT_HANDLER()
692 thread->debug.iac1 = thread->debug.iac2 = 0; in set_debug_reg_defaults()
694 thread->debug.iac3 = thread->debug.iac4 = 0; in set_debug_reg_defaults()
696 thread->debug.dac1 = thread->debug.dac2 = 0; in set_debug_reg_defaults()
698 thread->debug.dvc1 = thread->debug.dvc2 = 0; in set_debug_reg_defaults()
700 thread->debug.dbcr0 = 0; in set_debug_reg_defaults()
703 * Force User/Supervisor bits to b11 (user-only MSR[PR]=1) in set_debug_reg_defaults()
705 thread->debug.dbcr1 = DBCR1_IAC1US | DBCR1_IAC2US | in set_debug_reg_defaults()
708 * Force Data Address Compare User/Supervisor bits to be User-only in set_debug_reg_defaults()
711 thread->debug.dbcr2 = DBCR2_DAC1US | DBCR2_DAC2US; in set_debug_reg_defaults()
713 thread->debug.dbcr1 = 0; in set_debug_reg_defaults()
726 mtspr(SPRN_IAC1, debug->iac1); in prime_debug_regs()
727 mtspr(SPRN_IAC2, debug->iac2); in prime_debug_regs()
729 mtspr(SPRN_IAC3, debug->iac3); in prime_debug_regs()
730 mtspr(SPRN_IAC4, debug->iac4); in prime_debug_regs()
732 mtspr(SPRN_DAC1, debug->dac1); in prime_debug_regs()
733 mtspr(SPRN_DAC2, debug->dac2); in prime_debug_regs()
735 mtspr(SPRN_DVC1, debug->dvc1); in prime_debug_regs()
736 mtspr(SPRN_DVC2, debug->dvc2); in prime_debug_regs()
738 mtspr(SPRN_DBCR0, debug->dbcr0); in prime_debug_regs()
739 mtspr(SPRN_DBCR1, debug->dbcr1); in prime_debug_regs()
741 mtspr(SPRN_DBCR2, debug->dbcr2); in prime_debug_regs()
751 if ((current->thread.debug.dbcr0 & DBCR0_IDM) in switch_booke_debug_regs()
752 || (new_debug->dbcr0 & DBCR0_IDM)) in switch_booke_debug_regs()
771 thread->hw_brk[i] = null_brk; in set_debug_reg_defaults()
773 set_breakpoint(i, &thread->hw_brk[i]); in set_debug_reg_defaults()
780 if (a->address != b->address) in hw_brk_match()
782 if (a->type != b->type) in hw_brk_match()
784 if (a->len != b->len) in hw_brk_match()
796 &new->thread.hw_brk[i]))) in switch_hw_breakpoint()
799 __set_breakpoint(i, &new->thread.hw_brk[i]); in switch_hw_breakpoint()
809 dabr = brk->address | (brk->type & HW_BRK_TYPE_DABR); in set_dabr()
810 dabrx = ((brk->type >> 3) & 0x7); in set_dabr()
826 return -EINVAL; in set_dabr()
835 unsigned long start_addr = ALIGN_DOWN(brk->address, HW_BREAKPOINT_SIZE); in set_breakpoint_8xx()
836 unsigned long end_addr = ALIGN(brk->address + brk->len, HW_BREAKPOINT_SIZE); in set_breakpoint_8xx()
847 if ((brk->type & HW_BRK_TYPE_RDWR) == 0) in set_breakpoint_8xx()
850 if ((brk->type & HW_BRK_TYPE_RDWR) == HW_BRK_TYPE_READ) in set_breakpoint_8xx()
852 if ((brk->type & HW_BRK_TYPE_RDWR) == HW_BRK_TYPE_WRITE) in set_breakpoint_8xx()
855 mtspr(SPRN_CMPE, start_addr - 1); in set_breakpoint_8xx()
910 * Re-enable breakpoints suspended by suspend_breakpoints() in hardware
928 return tsk && tsk->thread.regs && (tsk->thread.regs->msr & MSR_TM); in tm_enabled()
967 if ((thr->ckpt_regs.msr & MSR_FP) == 0) in tm_reclaim_thread()
968 memcpy(&thr->ckfp_state, &thr->fp_state, in tm_reclaim_thread()
970 if ((thr->ckpt_regs.msr & MSR_VEC) == 0) in tm_reclaim_thread()
971 memcpy(&thr->ckvr_state, &thr->vr_state, in tm_reclaim_thread()
978 tm_reclaim_thread(&current->thread, cause); in tm_reclaim_current()
987 * oldtask->thread.ckpt_regs. We tm_reclaim(oldproc); this saves the in tm_reclaim_task()
993 struct thread_struct *thr = &tsk->thread; in tm_reclaim_task()
995 if (!thr->regs) in tm_reclaim_task()
998 if (!MSR_TM_ACTIVE(thr->regs->msr)) in tm_reclaim_task()
1003 TM_DEBUG("--- tm_reclaim on pid %d (NIP=%lx, " in tm_reclaim_task()
1005 tsk->pid, thr->regs->nip, in tm_reclaim_task()
1006 thr->regs->ccr, thr->regs->msr, in tm_reclaim_task()
1007 thr->regs->trap); in tm_reclaim_task()
1011 TM_DEBUG("--- tm_reclaim on pid %d complete\n", in tm_reclaim_task()
1012 tsk->pid); in tm_reclaim_task()
1016 * This context-switches a thread's TM info SPRs. We do it here to in tm_reclaim_task()
1029 if (!(thread->regs->msr & MSR_TM)) in tm_recheckpoint()
1056 * If the task was using FP, we non-lazily reload both the original and in tm_recheckpoint_new_task()
1065 if (!MSR_TM_ACTIVE(new->thread.regs->msr)){ in tm_recheckpoint_new_task()
1066 tm_restore_sprs(&new->thread); in tm_recheckpoint_new_task()
1070 TM_DEBUG("*** tm_recheckpoint of pid %d (new->msr 0x%lx)\n", in tm_recheckpoint_new_task()
1071 new->pid, new->thread.regs->msr); in tm_recheckpoint_new_task()
1073 tm_recheckpoint(&new->thread); in tm_recheckpoint_new_task()
1080 new->thread.regs->msr &= ~(MSR_FP | MSR_VEC | MSR_VSX); in tm_recheckpoint_new_task()
1084 new->pid, mfmsr()); in tm_recheckpoint_new_task()
1095 prev->thread.load_tm++; in __switch_to_tm()
1097 if (!MSR_TM_ACTIVE(prev->thread.regs->msr) && prev->thread.load_tm == 0) in __switch_to_tm()
1098 prev->thread.regs->msr &= ~MSR_TM; in __switch_to_tm()
1130 if (!MSR_TM_ACTIVE(regs->msr)) in restore_tm_state()
1133 msr_diff = current->thread.ckpt_regs.msr & ~regs->msr; in restore_tm_state()
1138 current->thread.load_fp = 1; in restore_tm_state()
1141 current->thread.load_vec = 1; in restore_tm_state()
1145 regs_set_return_msr(regs, regs->msr | msr_diff); in restore_tm_state()
1158 t->vrsave = mfspr(SPRN_VRSAVE); in save_sprs()
1162 t->spefscr = mfspr(SPRN_SPEFSCR); in save_sprs()
1166 t->dscr = mfspr(SPRN_DSCR); in save_sprs()
1169 t->bescr = mfspr(SPRN_BESCR); in save_sprs()
1170 t->ebbhr = mfspr(SPRN_EBBHR); in save_sprs()
1171 t->ebbrr = mfspr(SPRN_EBBRR); in save_sprs()
1173 t->fscr = mfspr(SPRN_FSCR); in save_sprs()
1181 t->tar = mfspr(SPRN_TAR); in save_sprs()
1185 t->hashkeyr = mfspr(SPRN_HASHKEYR); in save_sprs()
1188 t->dexcr = mfspr(SPRN_DEXCR); in save_sprs()
1197 if (!current->thread.regs) in kvmppc_save_user_regs()
1200 usermsr = current->thread.regs->msr; in kvmppc_save_user_regs()
1210 current->thread.tm_tfhar = mfspr(SPRN_TFHAR); in kvmppc_save_user_regs()
1211 current->thread.tm_tfiar = mfspr(SPRN_TFIAR); in kvmppc_save_user_regs()
1212 current->thread.tm_texasr = mfspr(SPRN_TEXASR); in kvmppc_save_user_regs()
1213 current->thread.regs->msr &= ~MSR_TM; in kvmppc_save_user_regs()
1221 save_sprs(&current->thread); in kvmppc_save_current_sprs()
1231 old_thread->vrsave != new_thread->vrsave) in restore_sprs()
1232 mtspr(SPRN_VRSAVE, new_thread->vrsave); in restore_sprs()
1236 old_thread->spefscr != new_thread->spefscr) in restore_sprs()
1237 mtspr(SPRN_SPEFSCR, new_thread->spefscr); in restore_sprs()
1241 u64 dscr = get_paca()->dscr_default; in restore_sprs()
1242 if (new_thread->dscr_inherit) in restore_sprs()
1243 dscr = new_thread->dscr; in restore_sprs()
1245 if (old_thread->dscr != dscr) in restore_sprs()
1250 if (old_thread->bescr != new_thread->bescr) in restore_sprs()
1251 mtspr(SPRN_BESCR, new_thread->bescr); in restore_sprs()
1252 if (old_thread->ebbhr != new_thread->ebbhr) in restore_sprs()
1253 mtspr(SPRN_EBBHR, new_thread->ebbhr); in restore_sprs()
1254 if (old_thread->ebbrr != new_thread->ebbrr) in restore_sprs()
1255 mtspr(SPRN_EBBRR, new_thread->ebbrr); in restore_sprs()
1257 if (old_thread->fscr != new_thread->fscr) in restore_sprs()
1258 mtspr(SPRN_FSCR, new_thread->fscr); in restore_sprs()
1260 if (old_thread->tar != new_thread->tar) in restore_sprs()
1261 mtspr(SPRN_TAR, new_thread->tar); in restore_sprs()
1265 old_thread->tidr != new_thread->tidr) in restore_sprs()
1266 mtspr(SPRN_TIDR, new_thread->tidr); in restore_sprs()
1269 old_thread->hashkeyr != new_thread->hashkeyr) in restore_sprs()
1270 mtspr(SPRN_HASHKEYR, new_thread->hashkeyr); in restore_sprs()
1273 old_thread->dexcr != new_thread->dexcr) in restore_sprs()
1274 mtspr(SPRN_DEXCR, new_thread->dexcr); in restore_sprs()
1288 new_thread = &new->thread; in __switch_to()
1289 old_thread = &current->thread; in __switch_to()
1295 if (batch->active) { in __switch_to()
1296 current_thread_info()->local_flags |= _TLF_LAZY_MMU; in __switch_to()
1297 if (batch->index) in __switch_to()
1299 batch->active = 0; in __switch_to()
1303 * On POWER9 the copy-paste buffer can only paste into in __switch_to()
1311 if (new->mm && (cpu_has_feature(CPU_FTR_ARCH_31) || in __switch_to()
1312 atomic_read(&new->mm->context.vas_windows))) in __switch_to()
1317 switch_booke_debug_regs(&new->thread.debug); in __switch_to()
1320 * For PPC_BOOK3S_64, we use the hw-breakpoint interfaces that would in __switch_to()
1332 save_sprs(&prev->thread); in __switch_to()
1375 * arch_enter_lazy_mmu_mode(), to re-activate the batch that was in __switch_to()
1379 if (current_thread_info()->local_flags & _TLF_LAZY_MMU) { in __switch_to()
1380 current_thread_info()->local_flags &= ~_TLF_LAZY_MMU; in __switch_to()
1382 batch->active = 1; in __switch_to()
1391 if (current->thread.regs) in __switch_to()
1392 restore_math(current->thread.regs); in __switch_to()
1403 unsigned long nip = regs->nip; in show_instructions()
1404 unsigned long pc = regs->nip - (NR_INSN_TO_PRINT * 3 / 4 * sizeof(int)); in show_instructions()
1412 if (!IS_ENABLED(CONFIG_BOOKE) && !(regs->msr & MSR_IR)) { in show_instructions()
1414 nip = (unsigned long)phys_to_virt(regs->nip); in show_instructions()
1442 pc = regs->nip - (NR_INSN_TO_PRINT * 3 / 4 * sizeof(int)); in show_user_instructions()
1451 for (i = 0; i < 8 && n; i++, n--, pc += sizeof(int)) { in show_user_instructions()
1459 seq_buf_printf(&s, regs->nip == pc ? "<%08x> " : "%08x ", instr); in show_user_instructions()
1463 pr_info("%s[%d]: code: %s\n", current->comm, in show_user_instructions()
1464 current->pid, s.buffer); in show_user_instructions()
1507 for (; bits->bit; ++bits) in print_bits()
1508 if (val & bits->bit) { in print_bits()
1509 pr_cont("%s%s", s, bits->name); in print_bits()
1562 regs->nip, regs->link, regs->ctr); in __show_regs()
1564 regs, regs->trap, print_tainted(), init_utsname()->release); in __show_regs()
1565 printk("MSR: "REG" ", regs->msr); in __show_regs()
1566 print_msr_bits(regs->msr); in __show_regs()
1567 pr_cont(" CR: %08lx XER: %08lx\n", regs->ccr, regs->xer); in __show_regs()
1570 pr_cont("CFAR: "REG" ", regs->orig_gpr3); in __show_regs()
1575 pr_cont("DEAR: "REG" ESR: "REG" ", regs->dear, regs->esr); in __show_regs()
1577 pr_cont("DAR: "REG" DSISR: %08lx ", regs->dar, regs->dsisr); in __show_regs()
1581 pr_cont("IRQMASK: %lx ", regs->softe); in __show_regs()
1584 if (MSR_TM_ACTIVE(regs->msr)) in __show_regs()
1585 pr_cont("\nPACATMSCRATCH: %016llx ", get_paca()->tm_scratch); in __show_regs()
1591 pr_cont(REG " ", regs->gpr[i]); in __show_regs()
1599 printk("NIP ["REG"] %pS\n", regs->nip, (void *)regs->nip); in __show_regs()
1600 printk("LR ["REG"] %pS\n", regs->link, (void *)regs->link); in __show_regs()
1608 show_stack(current, (unsigned long *) regs->gpr[1], KERN_DEFAULT); in show_regs()
1618 set_debug_reg_defaults(&current->thread); in flush_thread()
1633 if (!current->thread.regs) { in arch_setup_new_exec()
1635 current->thread.regs = regs - 1; in arch_setup_new_exec()
1639 current->thread.regs->amr = default_amr; in arch_setup_new_exec()
1640 current->thread.regs->iamr = default_iamr; in arch_setup_new_exec()
1645 current->thread.dexcr = current->thread.dexcr_onexec; in arch_setup_new_exec()
1646 mtspr(SPRN_DEXCR, current->thread.dexcr); in arch_setup_new_exec()
1673 * re-execute wait. The correct thread, when scheduled, will execute either
1688 return -EINVAL; in set_thread_tidr()
1691 return -EINVAL; in set_thread_tidr()
1693 if (t->thread.tidr) in set_thread_tidr()
1696 t->thread.tidr = (u16)task_pid_nr(t); in set_thread_tidr()
1697 mtspr(SPRN_TIDR, t->thread.tidr); in set_thread_tidr()
1715 * transitions the CPU out of TM mode. Hence we need to call in arch_dup_task_struct()
1717 * checkpointed state back and the TM mode. in arch_dup_task_struct()
1747 p->thread.ksp_vsid = sp_vsid; in setup_ksp_vsid()
1756 * Copy architecture-specific thread state
1773 if (unlikely(p->flags & PF_KTHREAD)) { in copy_thread()
1777 sp -= STACK_FRAME_MIN_SIZE; in copy_thread()
1781 p->thread.regs = NULL; /* no user register state */ in copy_thread()
1788 sp -= STACK_USER_INT_FRAME_SIZE; in copy_thread()
1793 if (unlikely(args->fn)) { in copy_thread()
1803 childregs->softe = IRQS_ENABLED; in copy_thread()
1808 unsigned long clone_flags = args->flags; in copy_thread()
1809 unsigned long usp = args->stack; in copy_thread()
1814 childregs->gpr[1] = usp; in copy_thread()
1815 ((unsigned long *)sp)[0] = childregs->gpr[1]; in copy_thread()
1817 WARN_ON_ONCE(childregs->softe != IRQS_ENABLED); in copy_thread()
1820 unsigned long tls = args->tls; in copy_thread()
1823 childregs->gpr[13] = tls; in copy_thread()
1825 childregs->gpr[2] = tls; in copy_thread()
1834 childregs->msr &= ~(MSR_FP|MSR_VEC|MSR_VSX); in copy_thread()
1835 p->thread.regs = childregs; in copy_thread()
1847 sp -= STACK_SWITCH_FRAME_SIZE; in copy_thread()
1850 kregs->nip = ppc_function_entry(f); in copy_thread()
1851 if (unlikely(args->fn)) { in copy_thread()
1853 * Put kthread fn, arg parameters in non-volatile GPRs in the in copy_thread()
1857 kregs->gpr[14] = ppc_function_entry((void *)args->fn); in copy_thread()
1858 kregs->gpr[15] = (unsigned long)args->fn_arg; in copy_thread()
1860 p->thread.ksp = sp; in copy_thread()
1864 p->thread.ptrace_bps[i] = NULL; in copy_thread()
1868 p->thread.fp_save_area = NULL; in copy_thread()
1871 p->thread.vr_save_area = NULL; in copy_thread()
1874 p->thread.kuap = KUAP_NONE; in copy_thread()
1877 p->thread.pid = MMU_NO_CONTEXT; in copy_thread()
1884 p->thread.dscr_inherit = current->thread.dscr_inherit; in copy_thread()
1885 p->thread.dscr = mfspr(SPRN_DSCR); in copy_thread()
1888 p->thread.tidr = 0; in copy_thread()
1892 p->thread.hashkeyr = current->thread.hashkeyr; in copy_thread()
1895 p->thread.dexcr = mfspr(SPRN_DEXCR); in copy_thread()
1908 unsigned long load_addr = regs->gpr[2]; /* saved by ELF_PLAT_INIT */ in start_thread()
1918 * user visible. in start_thread()
1924 memset(&regs->gpr[1], 0, sizeof(regs->gpr) - sizeof(regs->gpr[0])); in start_thread()
1925 regs->ctr = 0; in start_thread()
1926 regs->link = 0; in start_thread()
1927 regs->xer = 0; in start_thread()
1928 regs->ccr = 0; in start_thread()
1929 regs->gpr[1] = sp; in start_thread()
1932 regs->mq = 0; in start_thread()
1933 regs->nip = start; in start_thread()
1934 regs->msr = MSR_USER; in start_thread()
1951 regs->gpr[12] = start; in start_thread()
1973 regs->gpr[2] = toc; in start_thread()
1978 regs->gpr[2] = 0; in start_thread()
1985 current->thread.used_vsr = 0; in start_thread()
1987 current->thread.load_slb = 0; in start_thread()
1988 current->thread.load_fp = 0; in start_thread()
1990 memset(&current->thread.fp_state, 0, sizeof(current->thread.fp_state)); in start_thread()
1991 current->thread.fp_save_area = NULL; in start_thread()
1994 memset(&current->thread.vr_state, 0, sizeof(current->thread.vr_state)); in start_thread()
1995 current->thread.vr_state.vscr.u[3] = 0x00010000; /* Java mode disabled */ in start_thread()
1996 current->thread.vr_save_area = NULL; in start_thread()
1997 current->thread.vrsave = 0; in start_thread()
1998 current->thread.used_vr = 0; in start_thread()
1999 current->thread.load_vec = 0; in start_thread()
2002 memset(current->thread.evr, 0, sizeof(current->thread.evr)); in start_thread()
2003 current->thread.acc = 0; in start_thread()
2004 current->thread.spefscr = 0; in start_thread()
2005 current->thread.used_spe = 0; in start_thread()
2008 current->thread.tm_tfhar = 0; in start_thread()
2009 current->thread.tm_texasr = 0; in start_thread()
2010 current->thread.tm_tfiar = 0; in start_thread()
2011 current->thread.load_tm = 0; in start_thread()
2015 current->thread.hashkeyr = get_random_long(); in start_thread()
2016 mtspr(SPRN_HASHKEYR, current->thread.hashkeyr); in start_thread()
2027 struct pt_regs *regs = tsk->thread.regs; in set_fpexc_mode()
2032 * mode (asyn, precise, disabled) for 'Classic' FP. */ in set_fpexc_mode()
2043 * floating-point environment need to do so in set_fpexc_mode()
2048 tsk->thread.spefscr_last = mfspr(SPRN_SPEFSCR); in set_fpexc_mode()
2049 tsk->thread.fpexc_mode = val & in set_fpexc_mode()
2054 return -EINVAL; in set_fpexc_mode()
2064 return -EINVAL; in set_fpexc_mode()
2065 tsk->thread.fpexc_mode = __pack_fe01(val); in set_fpexc_mode()
2066 if (regs != NULL && (regs->msr & MSR_FP) != 0) { in set_fpexc_mode()
2067 regs_set_return_msr(regs, (regs->msr & ~(MSR_FE0|MSR_FE1)) in set_fpexc_mode()
2068 | tsk->thread.fpexc_mode); in set_fpexc_mode()
2077 if (tsk->thread.fpexc_mode & PR_FP_EXC_SW_ENABLE) { in get_fpexc_mode()
2087 * floating-point environment need to do so in get_fpexc_mode()
2092 tsk->thread.spefscr_last = mfspr(SPRN_SPEFSCR); in get_fpexc_mode()
2093 val = tsk->thread.fpexc_mode; in get_fpexc_mode()
2096 return -EINVAL; in get_fpexc_mode()
2098 val = __unpack_fe01(tsk->thread.fpexc_mode); in get_fpexc_mode()
2105 struct pt_regs *regs = tsk->thread.regs; in set_endian()
2109 return -EINVAL; in set_endian()
2112 return -EINVAL; in set_endian()
2115 regs_set_return_msr(regs, regs->msr & ~MSR_LE); in set_endian()
2117 regs_set_return_msr(regs, regs->msr | MSR_LE); in set_endian()
2119 return -EINVAL; in set_endian()
2126 struct pt_regs *regs = tsk->thread.regs; in get_endian()
2131 return -EINVAL; in get_endian()
2134 return -EINVAL; in get_endian()
2136 if (regs->msr & MSR_LE) { in get_endian()
2149 tsk->thread.align_ctl = val; in set_unalign_ctl()
2155 return put_user(tsk->thread.align_ctl, (unsigned int __user *)adr); in get_unalign_ctl()
2168 if (sp >= stack_page && sp <= stack_page + THREAD_SIZE - nbytes) in valid_irq_stack()
2172 if (sp >= stack_page && sp <= stack_page + THREAD_SIZE - nbytes) in valid_irq_stack()
2188 if (!paca_ptrs[cpu]->emergency_sp) in valid_emergency_stack()
2192 if (!paca_ptrs[cpu]->nmi_emergency_sp || !paca_ptrs[cpu]->mc_emergency_sp) in valid_emergency_stack()
2196 stack_page = (unsigned long)paca_ptrs[cpu]->emergency_sp - THREAD_SIZE; in valid_emergency_stack()
2197 if (sp >= stack_page && sp <= stack_page + THREAD_SIZE - nbytes) in valid_emergency_stack()
2201 stack_page = (unsigned long)paca_ptrs[cpu]->nmi_emergency_sp - THREAD_SIZE; in valid_emergency_stack()
2202 if (sp >= stack_page && sp <= stack_page + THREAD_SIZE - nbytes) in valid_emergency_stack()
2205 stack_page = (unsigned long)paca_ptrs[cpu]->mc_emergency_sp - THREAD_SIZE; in valid_emergency_stack()
2206 if (sp >= stack_page && sp <= stack_page + THREAD_SIZE - nbytes) in valid_emergency_stack()
2222 stack_page = (unsigned long)emergency_ctx[cpu] - THREAD_SIZE; in valid_emergency_stack()
2223 if (sp >= stack_page && sp <= stack_page + THREAD_SIZE - nbytes) in valid_emergency_stack()
2242 if (sp >= stack_page && sp <= stack_page + THREAD_SIZE - nbytes) in validate_sp_size()
2261 sp = p->thread.ksp; in ___get_wchan()
2296 // A non-empty pt_regs should never have a zero MSR or TRAP value. in empty_user_regs()
2297 if (regs->msr || regs->trap) in empty_user_regs()
2331 sp = tsk->thread.ksp; in show_stack()
2369 lr = regs->link; in show_stack()
2370 printk("%s--- interrupt: %lx at %pS\n", in show_stack()
2371 loglvl, regs->trap, (void *)regs->nip); in show_stack()
2377 printk("%s--- interrupt: %lx\n", loglvl, regs->trap); in show_stack()
2407 * than RUN, so do the read-modify-write. in __ppc64_runlatch_on()
2414 ti->local_flags |= _TLF_RUNLATCH; in __ppc64_runlatch_on()
2422 ti->local_flags &= ~_TLF_RUNLATCH; in __ppc64_runlatch_off()
2438 if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space) in arch_align_stack()
2439 sp -= get_random_u32_below(PAGE_SIZE); in arch_align_stack()