| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * arch/sh/kernel/process.c |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 8 | 9 | * SuperH version: Copyright (C) 1999, 2000 Niibe Yutaka & Kaz Kojima |
|---|
| 9 | 10 | * Copyright (C) 2006 Lineo Solutions Inc. support SH4A UBC |
|---|
| 10 | 11 | * Copyright (C) 2002 - 2008 Paul Mundt |
|---|
| 11 | | - * |
|---|
| 12 | | - * This file is subject to the terms and conditions of the GNU General Public |
|---|
| 13 | | - * License. See the file "COPYING" in the main directory of this archive |
|---|
| 14 | | - * for more details. |
|---|
| 15 | 12 | */ |
|---|
| 16 | 13 | #include <linux/module.h> |
|---|
| 17 | 14 | #include <linux/mm.h> |
|---|
| .. | .. |
|---|
| 33 | 30 | |
|---|
| 34 | 31 | void show_regs(struct pt_regs * regs) |
|---|
| 35 | 32 | { |
|---|
| 36 | | - printk("\n"); |
|---|
| 33 | + pr_info("\n"); |
|---|
| 37 | 34 | show_regs_print_info(KERN_DEFAULT); |
|---|
| 38 | 35 | |
|---|
| 39 | | - printk("PC is at %pS\n", (void *)instruction_pointer(regs)); |
|---|
| 40 | | - printk("PR is at %pS\n", (void *)regs->pr); |
|---|
| 36 | + pr_info("PC is at %pS\n", (void *)instruction_pointer(regs)); |
|---|
| 37 | + pr_info("PR is at %pS\n", (void *)regs->pr); |
|---|
| 41 | 38 | |
|---|
| 42 | | - printk("PC : %08lx SP : %08lx SR : %08lx ", |
|---|
| 43 | | - regs->pc, regs->regs[15], regs->sr); |
|---|
| 39 | + pr_info("PC : %08lx SP : %08lx SR : %08lx ", regs->pc, |
|---|
| 40 | + regs->regs[15], regs->sr); |
|---|
| 44 | 41 | #ifdef CONFIG_MMU |
|---|
| 45 | | - printk("TEA : %08x\n", __raw_readl(MMU_TEA)); |
|---|
| 42 | + pr_cont("TEA : %08x\n", __raw_readl(MMU_TEA)); |
|---|
| 46 | 43 | #else |
|---|
| 47 | | - printk("\n"); |
|---|
| 44 | + pr_cont("\n"); |
|---|
| 48 | 45 | #endif |
|---|
| 49 | 46 | |
|---|
| 50 | | - printk("R0 : %08lx R1 : %08lx R2 : %08lx R3 : %08lx\n", |
|---|
| 51 | | - regs->regs[0],regs->regs[1], |
|---|
| 52 | | - regs->regs[2],regs->regs[3]); |
|---|
| 53 | | - printk("R4 : %08lx R5 : %08lx R6 : %08lx R7 : %08lx\n", |
|---|
| 54 | | - regs->regs[4],regs->regs[5], |
|---|
| 55 | | - regs->regs[6],regs->regs[7]); |
|---|
| 56 | | - printk("R8 : %08lx R9 : %08lx R10 : %08lx R11 : %08lx\n", |
|---|
| 57 | | - regs->regs[8],regs->regs[9], |
|---|
| 58 | | - regs->regs[10],regs->regs[11]); |
|---|
| 59 | | - printk("R12 : %08lx R13 : %08lx R14 : %08lx\n", |
|---|
| 60 | | - regs->regs[12],regs->regs[13], |
|---|
| 61 | | - regs->regs[14]); |
|---|
| 62 | | - printk("MACH: %08lx MACL: %08lx GBR : %08lx PR : %08lx\n", |
|---|
| 63 | | - regs->mach, regs->macl, regs->gbr, regs->pr); |
|---|
| 47 | + pr_info("R0 : %08lx R1 : %08lx R2 : %08lx R3 : %08lx\n", |
|---|
| 48 | + regs->regs[0], regs->regs[1], regs->regs[2], regs->regs[3]); |
|---|
| 49 | + pr_info("R4 : %08lx R5 : %08lx R6 : %08lx R7 : %08lx\n", |
|---|
| 50 | + regs->regs[4], regs->regs[5], regs->regs[6], regs->regs[7]); |
|---|
| 51 | + pr_info("R8 : %08lx R9 : %08lx R10 : %08lx R11 : %08lx\n", |
|---|
| 52 | + regs->regs[8], regs->regs[9], regs->regs[10], regs->regs[11]); |
|---|
| 53 | + pr_info("R12 : %08lx R13 : %08lx R14 : %08lx\n", |
|---|
| 54 | + regs->regs[12], regs->regs[13], regs->regs[14]); |
|---|
| 55 | + pr_info("MACH: %08lx MACL: %08lx GBR : %08lx PR : %08lx\n", |
|---|
| 56 | + regs->mach, regs->macl, regs->gbr, regs->pr); |
|---|
| 64 | 57 | |
|---|
| 65 | | - show_trace(NULL, (unsigned long *)regs->regs[15], regs); |
|---|
| 58 | + show_trace(NULL, (unsigned long *)regs->regs[15], regs, KERN_DEFAULT); |
|---|
| 66 | 59 | show_code(regs); |
|---|
| 67 | 60 | } |
|---|
| 68 | 61 | |
|---|
| .. | .. |
|---|
| 96 | 89 | /* do nothing */ |
|---|
| 97 | 90 | } |
|---|
| 98 | 91 | |
|---|
| 99 | | -/* Fill in the fpu structure for a core dump.. */ |
|---|
| 100 | | -int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu) |
|---|
| 101 | | -{ |
|---|
| 102 | | - int fpvalid = 0; |
|---|
| 103 | | - |
|---|
| 104 | | -#if defined(CONFIG_SH_FPU) |
|---|
| 105 | | - struct task_struct *tsk = current; |
|---|
| 106 | | - |
|---|
| 107 | | - fpvalid = !!tsk_used_math(tsk); |
|---|
| 108 | | - if (fpvalid) |
|---|
| 109 | | - fpvalid = !fpregs_get(tsk, NULL, 0, |
|---|
| 110 | | - sizeof(struct user_fpu_struct), |
|---|
| 111 | | - fpu, NULL); |
|---|
| 112 | | -#endif |
|---|
| 113 | | - |
|---|
| 114 | | - return fpvalid; |
|---|
| 115 | | -} |
|---|
| 116 | | -EXPORT_SYMBOL(dump_fpu); |
|---|
| 117 | | - |
|---|
| 118 | 92 | asmlinkage void ret_from_fork(void); |
|---|
| 119 | 93 | asmlinkage void ret_from_kernel_thread(void); |
|---|
| 120 | 94 | |
|---|
| 121 | | -int copy_thread(unsigned long clone_flags, unsigned long usp, |
|---|
| 122 | | - unsigned long arg, struct task_struct *p) |
|---|
| 95 | +int copy_thread(unsigned long clone_flags, unsigned long usp, unsigned long arg, |
|---|
| 96 | + struct task_struct *p, unsigned long tls) |
|---|
| 123 | 97 | { |
|---|
| 124 | 98 | struct thread_info *ti = task_thread_info(p); |
|---|
| 125 | 99 | struct pt_regs *childregs; |
|---|
| .. | .. |
|---|
| 140 | 114 | |
|---|
| 141 | 115 | childregs = task_pt_regs(p); |
|---|
| 142 | 116 | p->thread.sp = (unsigned long) childregs; |
|---|
| 143 | | - if (unlikely(p->flags & PF_KTHREAD)) { |
|---|
| 117 | + if (unlikely(p->flags & (PF_KTHREAD | PF_IO_WORKER))) { |
|---|
| 144 | 118 | memset(childregs, 0, sizeof(struct pt_regs)); |
|---|
| 145 | 119 | p->thread.pc = (unsigned long) ret_from_kernel_thread; |
|---|
| 146 | 120 | childregs->regs[4] = arg; |
|---|
| .. | .. |
|---|
| 161 | 135 | ti->addr_limit = USER_DS; |
|---|
| 162 | 136 | |
|---|
| 163 | 137 | if (clone_flags & CLONE_SETTLS) |
|---|
| 164 | | - childregs->gbr = childregs->regs[0]; |
|---|
| 138 | + childregs->gbr = tls; |
|---|
| 165 | 139 | |
|---|
| 166 | 140 | childregs->regs[0] = 0; /* Set return value for child */ |
|---|
| 167 | 141 | p->thread.pc = (unsigned long) ret_from_fork; |
|---|