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 (gdt@linuxppc.org)
57 #include <asm/code-patching.h>
61 #include <asm/asm-prototypes.h>
79 * Are we running in "Suspend disabled" mode? If so we have to block any
93 if (tsk == current && tsk->thread.regs && in check_if_tm_restore_required()
94 MSR_TM_ACTIVE(tsk->thread.regs->msr) && in check_if_tm_restore_required()
96 regs_set_return_msr(&tsk->thread.ckpt_regs, in check_if_tm_restore_required()
97 tsk->thread.regs->msr); in check_if_tm_restore_required()
158 msr = tsk->thread.regs->msr; in __giveup_fpu()
162 regs_set_return_msr(tsk->thread.regs, msr); in __giveup_fpu()
176 * Make sure the floating-point register state in the
181 if (tsk->thread.regs) { in flush_fp_to_thread()
184 * another process could get scheduled after the regs->msr in flush_fp_to_thread()
191 if (tsk->thread.regs->msr & MSR_FP) { in flush_fp_to_thread()
215 if (current->thread.regs && (current->thread.regs->msr & MSR_FP)) { in enable_kernel_fp()
225 MSR_TM_ACTIVE(current->thread.regs->msr)) in enable_kernel_fp()
241 msr = tsk->thread.regs->msr; in __giveup_altivec()
245 regs_set_return_msr(tsk->thread.regs, msr); in __giveup_altivec()
266 if (current->thread.regs && (current->thread.regs->msr & MSR_VEC)) { in enable_kernel_altivec()
276 MSR_TM_ACTIVE(current->thread.regs->msr)) in enable_kernel_altivec()
289 if (tsk->thread.regs) { in flush_altivec_to_thread()
291 if (tsk->thread.regs->msr & MSR_VEC) { in flush_altivec_to_thread()
304 unsigned long msr = tsk->thread.regs->msr; in __giveup_vsx()
336 if (current->thread.regs && in enable_kernel_vsx()
337 (current->thread.regs->msr & (MSR_VSX|MSR_VEC|MSR_FP))) { in enable_kernel_vsx()
347 MSR_TM_ACTIVE(current->thread.regs->msr)) in enable_kernel_vsx()
356 if (tsk->thread.regs) { in flush_vsx_to_thread()
358 if (tsk->thread.regs->msr & (MSR_VSX|MSR_VEC|MSR_FP)) { in flush_vsx_to_thread()
385 if (current->thread.regs && (current->thread.regs->msr & MSR_SPE)) { in enable_kernel_spe()
394 if (tsk->thread.regs) { in flush_spe_to_thread()
396 if (tsk->thread.regs->msr & MSR_SPE) { in flush_spe_to_thread()
398 tsk->thread.spefscr = mfspr(SPRN_SPEFSCR); in flush_spe_to_thread()
427 if (!tsk->thread.regs) in giveup_all()
432 usermsr = tsk->thread.regs->msr; in giveup_all()
456 if (current->thread.load_fp) { in should_restore_fp()
457 current->thread.load_fp++; in should_restore_fp()
465 load_fp_state(&current->thread.fp_state); in do_restore_fp()
475 if (cpu_has_feature(CPU_FTR_ALTIVEC) && (current->thread.load_vec)) { in should_restore_altivec()
476 current->thread.load_vec++; in should_restore_altivec()
484 load_vr_state(&current->thread.vr_state); in do_restore_altivec()
485 current->thread.used_vr = 1; in do_restore_altivec()
501 current->thread.used_vsr = 1; in do_restore_vsx()
513 * could be done by having ftrace entry code check for this un-reconciled
522 msr = regs->msr; in restore_math()
549 fpexc_mode = current->thread.fpexc_mode; in restore_math()
560 regs_set_return_msr(regs, regs->msr | new_msr | fpexc_mode); in restore_math()
569 if (!tsk->thread.regs) in save_all()
572 usermsr = tsk->thread.regs->msr; in save_all()
595 if (tsk->thread.regs) { in flush_all_to_thread()
599 if (tsk->thread.regs->msr & MSR_SPE) in flush_all_to_thread()
600 tsk->thread.spefscr = mfspr(SPRN_SPEFSCR); in flush_all_to_thread()
613 current->thread.trap_nr = TRAP_HWBKPT; in do_send_trap()
640 current->thread.hw_brk[0] = null_brk; in do_break_handler()
641 current->thread.hw_brk[0].flags |= HW_BRK_FLAG_DISABLED; in do_break_handler()
649 info = &current->thread.hw_brk[i]; in do_break_handler()
650 if (!info->address) in do_break_handler()
655 current->thread.hw_brk[i] = null_brk; in do_break_handler()
656 current->thread.hw_brk[i].flags |= HW_BRK_FLAG_DISABLED; in do_break_handler()
663 current->thread.trap_nr = TRAP_HWBKPT; in DEFINE_INTERRUPT_HANDLER()
664 if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, regs->dsisr, in DEFINE_INTERRUPT_HANDLER()
682 force_sig_fault(SIGTRAP, TRAP_HWBKPT, (void __user *)regs->dar); in DEFINE_INTERRUPT_HANDLER()
694 thread->debug.iac1 = thread->debug.iac2 = 0; in set_debug_reg_defaults()
696 thread->debug.iac3 = thread->debug.iac4 = 0; in set_debug_reg_defaults()
698 thread->debug.dac1 = thread->debug.dac2 = 0; in set_debug_reg_defaults()
700 thread->debug.dvc1 = thread->debug.dvc2 = 0; in set_debug_reg_defaults()
702 thread->debug.dbcr0 = 0; in set_debug_reg_defaults()
705 * Force User/Supervisor bits to b11 (user-only MSR[PR]=1) in set_debug_reg_defaults()
707 thread->debug.dbcr1 = DBCR1_IAC1US | DBCR1_IAC2US | in set_debug_reg_defaults()
710 * Force Data Address Compare User/Supervisor bits to be User-only in set_debug_reg_defaults()
713 thread->debug.dbcr2 = DBCR2_DAC1US | DBCR2_DAC2US; in set_debug_reg_defaults()
715 thread->debug.dbcr1 = 0; in set_debug_reg_defaults()
728 mtspr(SPRN_IAC1, debug->iac1); in prime_debug_regs()
729 mtspr(SPRN_IAC2, debug->iac2); in prime_debug_regs()
731 mtspr(SPRN_IAC3, debug->iac3); in prime_debug_regs()
732 mtspr(SPRN_IAC4, debug->iac4); in prime_debug_regs()
734 mtspr(SPRN_DAC1, debug->dac1); in prime_debug_regs()
735 mtspr(SPRN_DAC2, debug->dac2); in prime_debug_regs()
737 mtspr(SPRN_DVC1, debug->dvc1); in prime_debug_regs()
738 mtspr(SPRN_DVC2, debug->dvc2); in prime_debug_regs()
740 mtspr(SPRN_DBCR0, debug->dbcr0); in prime_debug_regs()
741 mtspr(SPRN_DBCR1, debug->dbcr1); in prime_debug_regs()
743 mtspr(SPRN_DBCR2, debug->dbcr2); in prime_debug_regs()
753 if ((current->thread.debug.dbcr0 & DBCR0_IDM) in switch_booke_debug_regs()
754 || (new_debug->dbcr0 & DBCR0_IDM)) in switch_booke_debug_regs()
773 thread->hw_brk[i] = null_brk; in set_debug_reg_defaults()
775 set_breakpoint(i, &thread->hw_brk[i]); in set_debug_reg_defaults()
782 if (a->address != b->address) in hw_brk_match()
784 if (a->type != b->type) in hw_brk_match()
786 if (a->len != b->len) in hw_brk_match()
798 &new->thread.hw_brk[i]))) in switch_hw_breakpoint()
801 __set_breakpoint(i, &new->thread.hw_brk[i]); in switch_hw_breakpoint()
811 dabr = brk->address | (brk->type & HW_BRK_TYPE_DABR); in set_dabr()
812 dabrx = ((brk->type >> 3) & 0x7); in set_dabr()
828 return -EINVAL; in set_dabr()
837 unsigned long start_addr = ALIGN_DOWN(brk->address, HW_BREAKPOINT_SIZE); in set_breakpoint_8xx()
838 unsigned long end_addr = ALIGN(brk->address + brk->len, HW_BREAKPOINT_SIZE); in set_breakpoint_8xx()
849 if ((brk->type & HW_BRK_TYPE_RDWR) == 0) in set_breakpoint_8xx()
852 if ((brk->type & HW_BRK_TYPE_RDWR) == HW_BRK_TYPE_READ) in set_breakpoint_8xx()
854 if ((brk->type & HW_BRK_TYPE_RDWR) == HW_BRK_TYPE_WRITE) in set_breakpoint_8xx()
857 mtspr(SPRN_CMPE, start_addr - 1); in set_breakpoint_8xx()
912 * Re-enable breakpoints suspended by suspend_breakpoints() in hardware
930 return tsk && tsk->thread.regs && (tsk->thread.regs->msr & MSR_TM); in tm_enabled()
969 if ((thr->ckpt_regs.msr & MSR_FP) == 0) in tm_reclaim_thread()
970 memcpy(&thr->ckfp_state, &thr->fp_state, in tm_reclaim_thread()
972 if ((thr->ckpt_regs.msr & MSR_VEC) == 0) in tm_reclaim_thread()
973 memcpy(&thr->ckvr_state, &thr->vr_state, in tm_reclaim_thread()
980 tm_reclaim_thread(&current->thread, cause); in tm_reclaim_current()
989 * oldtask->thread.ckpt_regs. We tm_reclaim(oldproc); this saves the in tm_reclaim_task()
995 struct thread_struct *thr = &tsk->thread; in tm_reclaim_task()
997 if (!thr->regs) in tm_reclaim_task()
1000 if (!MSR_TM_ACTIVE(thr->regs->msr)) in tm_reclaim_task()
1005 TM_DEBUG("--- tm_reclaim on pid %d (NIP=%lx, " in tm_reclaim_task()
1007 tsk->pid, thr->regs->nip, in tm_reclaim_task()
1008 thr->regs->ccr, thr->regs->msr, in tm_reclaim_task()
1009 thr->regs->trap); in tm_reclaim_task()
1013 TM_DEBUG("--- tm_reclaim on pid %d complete\n", in tm_reclaim_task()
1014 tsk->pid); in tm_reclaim_task()
1018 * This context-switches a thread's TM info SPRs. We do it here to in tm_reclaim_task()
1031 if (!(thread->regs->msr & MSR_TM)) in tm_recheckpoint()
1058 * If the task was using FP, we non-lazily reload both the original and in tm_recheckpoint_new_task()
1067 if (!MSR_TM_ACTIVE(new->thread.regs->msr)){ in tm_recheckpoint_new_task()
1068 tm_restore_sprs(&new->thread); in tm_recheckpoint_new_task()
1072 TM_DEBUG("*** tm_recheckpoint of pid %d (new->msr 0x%lx)\n", in tm_recheckpoint_new_task()
1073 new->pid, new->thread.regs->msr); in tm_recheckpoint_new_task()
1075 tm_recheckpoint(&new->thread); in tm_recheckpoint_new_task()
1082 new->thread.regs->msr &= ~(MSR_FP | MSR_VEC | MSR_VSX); in tm_recheckpoint_new_task()
1086 new->pid, mfmsr()); in tm_recheckpoint_new_task()
1097 prev->thread.load_tm++; in __switch_to_tm()
1099 if (!MSR_TM_ACTIVE(prev->thread.regs->msr) && prev->thread.load_tm == 0) in __switch_to_tm()
1100 prev->thread.regs->msr &= ~MSR_TM; in __switch_to_tm()
1132 if (!MSR_TM_ACTIVE(regs->msr)) in restore_tm_state()
1135 msr_diff = current->thread.ckpt_regs.msr & ~regs->msr; in restore_tm_state()
1140 current->thread.load_fp = 1; in restore_tm_state()
1143 current->thread.load_vec = 1; in restore_tm_state()
1147 regs_set_return_msr(regs, regs->msr | msr_diff); in restore_tm_state()
1160 t->vrsave = mfspr(SPRN_VRSAVE); in save_sprs()
1164 t->spefscr = mfspr(SPRN_SPEFSCR); in save_sprs()
1168 t->dscr = mfspr(SPRN_DSCR); in save_sprs()
1171 t->bescr = mfspr(SPRN_BESCR); in save_sprs()
1172 t->ebbhr = mfspr(SPRN_EBBHR); in save_sprs()
1173 t->ebbrr = mfspr(SPRN_EBBRR); in save_sprs()
1175 t->fscr = mfspr(SPRN_FSCR); in save_sprs()
1183 t->tar = mfspr(SPRN_TAR); in save_sprs()
1187 t->hashkeyr = mfspr(SPRN_HASHKEYR); in save_sprs()
1196 if (!current->thread.regs) in kvmppc_save_user_regs()
1199 usermsr = current->thread.regs->msr; in kvmppc_save_user_regs()
1209 current->thread.tm_tfhar = mfspr(SPRN_TFHAR); in kvmppc_save_user_regs()
1210 current->thread.tm_tfiar = mfspr(SPRN_TFIAR); in kvmppc_save_user_regs()
1211 current->thread.tm_texasr = mfspr(SPRN_TEXASR); in kvmppc_save_user_regs()
1212 current->thread.regs->msr &= ~MSR_TM; in kvmppc_save_user_regs()
1220 save_sprs(&current->thread); in kvmppc_save_current_sprs()
1230 old_thread->vrsave != new_thread->vrsave) in restore_sprs()
1231 mtspr(SPRN_VRSAVE, new_thread->vrsave); in restore_sprs()
1235 old_thread->spefscr != new_thread->spefscr) in restore_sprs()
1236 mtspr(SPRN_SPEFSCR, new_thread->spefscr); in restore_sprs()
1240 u64 dscr = get_paca()->dscr_default; in restore_sprs()
1241 if (new_thread->dscr_inherit) in restore_sprs()
1242 dscr = new_thread->dscr; in restore_sprs()
1244 if (old_thread->dscr != dscr) in restore_sprs()
1249 if (old_thread->bescr != new_thread->bescr) in restore_sprs()
1250 mtspr(SPRN_BESCR, new_thread->bescr); in restore_sprs()
1251 if (old_thread->ebbhr != new_thread->ebbhr) in restore_sprs()
1252 mtspr(SPRN_EBBHR, new_thread->ebbhr); in restore_sprs()
1253 if (old_thread->ebbrr != new_thread->ebbrr) in restore_sprs()
1254 mtspr(SPRN_EBBRR, new_thread->ebbrr); in restore_sprs()
1256 if (old_thread->fscr != new_thread->fscr) in restore_sprs()
1257 mtspr(SPRN_FSCR, new_thread->fscr); in restore_sprs()
1259 if (old_thread->tar != new_thread->tar) in restore_sprs()
1260 mtspr(SPRN_TAR, new_thread->tar); in restore_sprs()
1264 old_thread->tidr != new_thread->tidr) in restore_sprs()
1265 mtspr(SPRN_TIDR, new_thread->tidr); in restore_sprs()
1268 old_thread->hashkeyr != new_thread->hashkeyr) in restore_sprs()
1269 mtspr(SPRN_HASHKEYR, new_thread->hashkeyr); in restore_sprs()
1283 new_thread = &new->thread; in __switch_to()
1284 old_thread = &current->thread; in __switch_to()
1290 if (batch->active) { in __switch_to()
1291 current_thread_info()->local_flags |= _TLF_LAZY_MMU; in __switch_to()
1292 if (batch->index) in __switch_to()
1294 batch->active = 0; in __switch_to()
1298 * On POWER9 the copy-paste buffer can only paste into in __switch_to()
1306 if (new->mm && (cpu_has_feature(CPU_FTR_ARCH_31) || in __switch_to()
1307 atomic_read(&new->mm->context.vas_windows))) in __switch_to()
1312 switch_booke_debug_regs(&new->thread.debug); in __switch_to()
1315 * For PPC_BOOK3S_64, we use the hw-breakpoint interfaces that would in __switch_to()
1327 save_sprs(&prev->thread); in __switch_to()
1370 * arch_enter_lazy_mmu_mode(), to re-activate the batch that was in __switch_to()
1374 if (current_thread_info()->local_flags & _TLF_LAZY_MMU) { in __switch_to()
1375 current_thread_info()->local_flags &= ~_TLF_LAZY_MMU; in __switch_to()
1377 batch->active = 1; in __switch_to()
1386 if (current->thread.regs) in __switch_to()
1387 restore_math(current->thread.regs); in __switch_to()
1398 unsigned long nip = regs->nip; in show_instructions()
1399 unsigned long pc = regs->nip - (NR_INSN_TO_PRINT * 3 / 4 * sizeof(int)); in show_instructions()
1407 if (!IS_ENABLED(CONFIG_BOOKE) && !(regs->msr & MSR_IR)) { in show_instructions()
1409 nip = (unsigned long)phys_to_virt(regs->nip); in show_instructions()
1437 pc = regs->nip - (NR_INSN_TO_PRINT * 3 / 4 * sizeof(int)); in show_user_instructions()
1446 for (i = 0; i < 8 && n; i++, n--, pc += sizeof(int)) { in show_user_instructions()
1454 seq_buf_printf(&s, regs->nip == pc ? "<%08x> " : "%08x ", instr); in show_user_instructions()
1458 pr_info("%s[%d]: code: %s\n", current->comm, in show_user_instructions()
1459 current->pid, s.buffer); in show_user_instructions()
1502 for (; bits->bit; ++bits) in print_bits()
1503 if (val & bits->bit) { in print_bits()
1504 pr_cont("%s%s", s, bits->name); in print_bits()
1557 regs->nip, regs->link, regs->ctr); in __show_regs()
1559 regs, regs->trap, print_tainted(), init_utsname()->release); in __show_regs()
1560 printk("MSR: "REG" ", regs->msr); in __show_regs()
1561 print_msr_bits(regs->msr); in __show_regs()
1562 pr_cont(" CR: %08lx XER: %08lx\n", regs->ccr, regs->xer); in __show_regs()
1565 pr_cont("CFAR: "REG" ", regs->orig_gpr3); in __show_regs()
1570 pr_cont("DEAR: "REG" ESR: "REG" ", regs->dear, regs->esr); in __show_regs()
1572 pr_cont("DAR: "REG" DSISR: %08lx ", regs->dar, regs->dsisr); in __show_regs()
1576 pr_cont("IRQMASK: %lx ", regs->softe); in __show_regs()
1579 if (MSR_TM_ACTIVE(regs->msr)) in __show_regs()
1580 pr_cont("\nPACATMSCRATCH: %016llx ", get_paca()->tm_scratch); in __show_regs()
1586 pr_cont(REG " ", regs->gpr[i]); in __show_regs()
1594 printk("NIP ["REG"] %pS\n", regs->nip, (void *)regs->nip); in __show_regs()
1595 printk("LR ["REG"] %pS\n", regs->link, (void *)regs->link); in __show_regs()
1603 show_stack(current, (unsigned long *) regs->gpr[1], KERN_DEFAULT); in show_regs()
1613 set_debug_reg_defaults(&current->thread); in flush_thread()
1628 if (!current->thread.regs) { in arch_setup_new_exec()
1630 current->thread.regs = regs - 1; in arch_setup_new_exec()
1634 current->thread.regs->amr = default_amr; in arch_setup_new_exec()
1635 current->thread.regs->iamr = default_iamr; in arch_setup_new_exec()
1661 * re-execute wait. The correct thread, when scheduled, will execute either
1676 return -EINVAL; in set_thread_tidr()
1679 return -EINVAL; in set_thread_tidr()
1681 if (t->thread.tidr) in set_thread_tidr()
1684 t->thread.tidr = (u16)task_pid_nr(t); in set_thread_tidr()
1685 mtspr(SPRN_TIDR, t->thread.tidr); in set_thread_tidr()
1703 * transitions the CPU out of TM mode. Hence we need to call in arch_dup_task_struct()
1705 * checkpointed state back and the TM mode. in arch_dup_task_struct()
1735 p->thread.ksp_vsid = sp_vsid; in setup_ksp_vsid()
1744 * Copy architecture-specific thread state
1761 if (unlikely(p->flags & PF_KTHREAD)) { in copy_thread()
1765 sp -= STACK_FRAME_MIN_SIZE; in copy_thread()
1769 p->thread.regs = NULL; /* no user register state */ in copy_thread()
1776 sp -= STACK_USER_INT_FRAME_SIZE; in copy_thread()
1781 if (unlikely(args->fn)) { in copy_thread()
1791 childregs->softe = IRQS_ENABLED; in copy_thread()
1796 unsigned long clone_flags = args->flags; in copy_thread()
1797 unsigned long usp = args->stack; in copy_thread()
1802 childregs->gpr[1] = usp; in copy_thread()
1803 ((unsigned long *)sp)[0] = childregs->gpr[1]; in copy_thread()
1805 WARN_ON_ONCE(childregs->softe != IRQS_ENABLED); in copy_thread()
1808 unsigned long tls = args->tls; in copy_thread()
1811 childregs->gpr[13] = tls; in copy_thread()
1813 childregs->gpr[2] = tls; in copy_thread()
1822 childregs->msr &= ~(MSR_FP|MSR_VEC|MSR_VSX); in copy_thread()
1823 p->thread.regs = childregs; in copy_thread()
1835 sp -= STACK_SWITCH_FRAME_SIZE; in copy_thread()
1838 kregs->nip = ppc_function_entry(f); in copy_thread()
1839 if (unlikely(args->fn)) { in copy_thread()
1841 * Put kthread fn, arg parameters in non-volatile GPRs in the in copy_thread()
1845 kregs->gpr[14] = ppc_function_entry((void *)args->fn); in copy_thread()
1846 kregs->gpr[15] = (unsigned long)args->fn_arg; in copy_thread()
1848 p->thread.ksp = sp; in copy_thread()
1852 p->thread.ptrace_bps[i] = NULL; in copy_thread()
1856 p->thread.fp_save_area = NULL; in copy_thread()
1859 p->thread.vr_save_area = NULL; in copy_thread()
1862 p->thread.kuap = KUAP_NONE; in copy_thread()
1865 p->thread.pid = MMU_NO_CONTEXT; in copy_thread()
1872 p->thread.dscr_inherit = current->thread.dscr_inherit; in copy_thread()
1873 p->thread.dscr = mfspr(SPRN_DSCR); in copy_thread()
1876 p->thread.tidr = 0; in copy_thread()
1880 p->thread.hashkeyr = current->thread.hashkeyr; in copy_thread()
1893 unsigned long load_addr = regs->gpr[2]; /* saved by ELF_PLAT_INIT */ in start_thread()
1903 * user visible. in start_thread()
1909 memset(&regs->gpr[1], 0, sizeof(regs->gpr) - sizeof(regs->gpr[0])); in start_thread()
1910 regs->ctr = 0; in start_thread()
1911 regs->link = 0; in start_thread()
1912 regs->xer = 0; in start_thread()
1913 regs->ccr = 0; in start_thread()
1914 regs->gpr[1] = sp; in start_thread()
1917 regs->mq = 0; in start_thread()
1918 regs->nip = start; in start_thread()
1919 regs->msr = MSR_USER; in start_thread()
1936 regs->gpr[12] = start; in start_thread()
1958 regs->gpr[2] = toc; in start_thread()
1963 regs->gpr[2] = 0; in start_thread()
1970 current->thread.used_vsr = 0; in start_thread()
1972 current->thread.load_slb = 0; in start_thread()
1973 current->thread.load_fp = 0; in start_thread()
1975 memset(&current->thread.fp_state, 0, sizeof(current->thread.fp_state)); in start_thread()
1976 current->thread.fp_save_area = NULL; in start_thread()
1979 memset(&current->thread.vr_state, 0, sizeof(current->thread.vr_state)); in start_thread()
1980 current->thread.vr_state.vscr.u[3] = 0x00010000; /* Java mode disabled */ in start_thread()
1981 current->thread.vr_save_area = NULL; in start_thread()
1982 current->thread.vrsave = 0; in start_thread()
1983 current->thread.used_vr = 0; in start_thread()
1984 current->thread.load_vec = 0; in start_thread()
1987 memset(current->thread.evr, 0, sizeof(current->thread.evr)); in start_thread()
1988 current->thread.acc = 0; in start_thread()
1989 current->thread.spefscr = 0; in start_thread()
1990 current->thread.used_spe = 0; in start_thread()
1993 current->thread.tm_tfhar = 0; in start_thread()
1994 current->thread.tm_texasr = 0; in start_thread()
1995 current->thread.tm_tfiar = 0; in start_thread()
1996 current->thread.load_tm = 0; in start_thread()
2000 current->thread.hashkeyr = get_random_long(); in start_thread()
2001 mtspr(SPRN_HASHKEYR, current->thread.hashkeyr); in start_thread()
2012 struct pt_regs *regs = tsk->thread.regs; in set_fpexc_mode()
2017 * mode (asyn, precise, disabled) for 'Classic' FP. */ in set_fpexc_mode()
2028 * floating-point environment need to do so in set_fpexc_mode()
2033 tsk->thread.spefscr_last = mfspr(SPRN_SPEFSCR); in set_fpexc_mode()
2034 tsk->thread.fpexc_mode = val & in set_fpexc_mode()
2039 return -EINVAL; in set_fpexc_mode()
2049 return -EINVAL; in set_fpexc_mode()
2050 tsk->thread.fpexc_mode = __pack_fe01(val); in set_fpexc_mode()
2051 if (regs != NULL && (regs->msr & MSR_FP) != 0) { in set_fpexc_mode()
2052 regs_set_return_msr(regs, (regs->msr & ~(MSR_FE0|MSR_FE1)) in set_fpexc_mode()
2053 | tsk->thread.fpexc_mode); in set_fpexc_mode()
2062 if (tsk->thread.fpexc_mode & PR_FP_EXC_SW_ENABLE) { in get_fpexc_mode()
2072 * floating-point environment need to do so in get_fpexc_mode()
2077 tsk->thread.spefscr_last = mfspr(SPRN_SPEFSCR); in get_fpexc_mode()
2078 val = tsk->thread.fpexc_mode; in get_fpexc_mode()
2081 return -EINVAL; in get_fpexc_mode()
2083 val = __unpack_fe01(tsk->thread.fpexc_mode); in get_fpexc_mode()
2090 struct pt_regs *regs = tsk->thread.regs; in set_endian()
2094 return -EINVAL; in set_endian()
2097 return -EINVAL; in set_endian()
2100 regs_set_return_msr(regs, regs->msr & ~MSR_LE); in set_endian()
2102 regs_set_return_msr(regs, regs->msr | MSR_LE); in set_endian()
2104 return -EINVAL; in set_endian()
2111 struct pt_regs *regs = tsk->thread.regs; in get_endian()
2116 return -EINVAL; in get_endian()
2119 return -EINVAL; in get_endian()
2121 if (regs->msr & MSR_LE) { in get_endian()
2134 tsk->thread.align_ctl = val; in set_unalign_ctl()
2140 return put_user(tsk->thread.align_ctl, (unsigned int __user *)adr); in get_unalign_ctl()
2153 if (sp >= stack_page && sp <= stack_page + THREAD_SIZE - nbytes) in valid_irq_stack()
2157 if (sp >= stack_page && sp <= stack_page + THREAD_SIZE - nbytes) in valid_irq_stack()
2173 if (!paca_ptrs[cpu]->emergency_sp) in valid_emergency_stack()
2177 if (!paca_ptrs[cpu]->nmi_emergency_sp || !paca_ptrs[cpu]->mc_emergency_sp) in valid_emergency_stack()
2181 stack_page = (unsigned long)paca_ptrs[cpu]->emergency_sp - THREAD_SIZE; in valid_emergency_stack()
2182 if (sp >= stack_page && sp <= stack_page + THREAD_SIZE - nbytes) in valid_emergency_stack()
2186 stack_page = (unsigned long)paca_ptrs[cpu]->nmi_emergency_sp - THREAD_SIZE; in valid_emergency_stack()
2187 if (sp >= stack_page && sp <= stack_page + THREAD_SIZE - nbytes) in valid_emergency_stack()
2190 stack_page = (unsigned long)paca_ptrs[cpu]->mc_emergency_sp - THREAD_SIZE; in valid_emergency_stack()
2191 if (sp >= stack_page && sp <= stack_page + THREAD_SIZE - nbytes) in valid_emergency_stack()
2211 if (sp >= stack_page && sp <= stack_page + THREAD_SIZE - nbytes) in validate_sp_size()
2230 sp = p->thread.ksp; in ___get_wchan()
2265 // A non-empty pt_regs should never have a zero MSR or TRAP value. in empty_user_regs()
2266 if (regs->msr || regs->trap) in empty_user_regs()
2300 sp = tsk->thread.ksp; in show_stack()
2338 lr = regs->link; in show_stack()
2339 printk("%s--- interrupt: %lx at %pS\n", in show_stack()
2340 loglvl, regs->trap, (void *)regs->nip); in show_stack()
2346 printk("%s--- interrupt: %lx\n", loglvl, regs->trap); in show_stack()
2376 * than RUN, so do the read-modify-write. in __ppc64_runlatch_on()
2383 ti->local_flags |= _TLF_RUNLATCH; in __ppc64_runlatch_on()
2391 ti->local_flags &= ~_TLF_RUNLATCH; in __ppc64_runlatch_off()
2407 if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space) in arch_align_stack()
2408 sp -= get_random_u32_below(PAGE_SIZE); in arch_align_stack()