hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/arch/openrisc/kernel/traps.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * OpenRISC traps.c
34 *
....@@ -9,15 +10,9 @@
910 * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
1011 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
1112 *
12
- * This program is free software; you can redistribute it and/or
13
- * modify it under the terms of the GNU General Public License
14
- * as published by the Free Software Foundation; either version
15
- * 2 of the License, or (at your option) any later version.
16
- *
1713 * Here we handle the break vectors not used by the system call
1814 * mechanism, as well as some general stack/register dumping
1915 * things.
20
- *
2116 */
2217
2318 #include <linux/init.h>
....@@ -35,9 +30,7 @@
3530 #include <linux/kallsyms.h>
3631 #include <linux/uaccess.h>
3732
38
-#include <asm/segment.h>
3933 #include <asm/io.h>
40
-#include <asm/pgtable.h>
4134 #include <asm/unwinder.h>
4235 #include <asm/sections.h>
4336
....@@ -47,25 +40,20 @@
4740
4841 void print_trace(void *data, unsigned long addr, int reliable)
4942 {
50
- pr_emerg("[<%p>] %s%pS\n", (void *) addr, reliable ? "" : "? ",
43
+ const char *loglvl = data;
44
+
45
+ printk("%s[<%p>] %s%pS\n", loglvl, (void *) addr, reliable ? "" : "? ",
5146 (void *) addr);
5247 }
5348
5449 /* displays a short stack trace */
55
-void show_stack(struct task_struct *task, unsigned long *esp)
50
+void show_stack(struct task_struct *task, unsigned long *esp, const char *loglvl)
5651 {
5752 if (esp == NULL)
5853 esp = (unsigned long *)&esp;
5954
60
- pr_emerg("Call trace:\n");
61
- unwind_stack(NULL, esp, print_trace);
62
-}
63
-
64
-void show_trace_task(struct task_struct *tsk)
65
-{
66
- /*
67
- * TODO: SysRq-T trace dump...
68
- */
55
+ printk("%sCall trace:\n", loglvl);
56
+ unwind_stack((void *)loglvl, esp, print_trace);
6957 }
7058
7159 void show_registers(struct pt_regs *regs)
....@@ -109,7 +97,7 @@
10997 if (in_kernel) {
11098
11199 printk("\nStack: ");
112
- show_stack(NULL, (unsigned long *)esp);
100
+ show_stack(NULL, (unsigned long *)esp, KERN_EMERG);
113101
114102 printk("\nCode: ");
115103 if (regs->pc < PAGE_OFFSET)
....@@ -224,7 +212,7 @@
224212 __asm__ __volatile__("l.nop 1");
225213 do {} while (1);
226214 #endif
227
- do_exit(SIGSEGV);
215
+ make_task_dead(SIGSEGV);
228216 }
229217
230218 /* This is normally the 'Oops' routine */
....@@ -250,7 +238,7 @@
250238
251239 asmlinkage void do_trap(struct pt_regs *regs, unsigned long address)
252240 {
253
- force_sig_fault(SIGTRAP, TRAP_TRACE, (void __user *)address, current);
241
+ force_sig_fault(SIGTRAP, TRAP_TRACE, (void __user *)address);
254242
255243 regs->pc += 4;
256244 }
....@@ -259,7 +247,7 @@
259247 {
260248 if (user_mode(regs)) {
261249 /* Send a SIGBUS */
262
- force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *)address, current);
250
+ force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *)address);
263251 } else {
264252 printk("KERNEL: Unaligned Access 0x%.8lx\n", address);
265253 show_registers(regs);
....@@ -272,7 +260,7 @@
272260 {
273261 if (user_mode(regs)) {
274262 /* Send a SIGBUS */
275
- force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address, current);
263
+ force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address);
276264 } else { /* Kernel mode */
277265 printk("KERNEL: Bus error (SIGBUS) 0x%.8lx\n", address);
278266 show_registers(regs);
....@@ -377,7 +365,7 @@
377365
378366 if (get_user(value, lwa_addr)) {
379367 if (user_mode(regs)) {
380
- force_sig(SIGSEGV, current);
368
+ force_sig(SIGSEGV);
381369 return;
382370 }
383371
....@@ -424,7 +412,7 @@
424412
425413 if (put_user(regs->gpr[rb], vaddr)) {
426414 if (user_mode(regs)) {
427
- force_sig(SIGSEGV, current);
415
+ force_sig(SIGSEGV);
428416 return;
429417 }
430418
....@@ -467,7 +455,7 @@
467455
468456 if (user_mode(regs)) {
469457 /* Send a SIGILL */
470
- force_sig_fault(SIGILL, ILL_ILLOPC, (void __user *)address, current);
458
+ force_sig_fault(SIGILL, ILL_ILLOPC, (void __user *)address);
471459 } else { /* Kernel mode */
472460 printk("KERNEL: Illegal instruction (SIGILL) 0x%.8lx\n",
473461 address);