forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/arch/sh/kernel/traps.c
....@@ -38,8 +38,8 @@
3838 task_pid_nr(current), task_stack_page(current) + 1);
3939
4040 if (!user_mode(regs) || in_interrupt())
41
- dump_mem("Stack: ", regs->regs[15], THREAD_SIZE +
42
- (unsigned long)task_stack_page(current));
41
+ dump_mem("Stack: ", KERN_DEFAULT, regs->regs[15],
42
+ THREAD_SIZE + (unsigned long)task_stack_page(current));
4343
4444 notify_die(DIE_OOPS, str, regs, err, 255, SIGSEGV);
4545
....@@ -118,7 +118,7 @@
118118
119119 if (addr < PAGE_OFFSET)
120120 return 0;
121
- if (probe_kernel_address((insn_size_t *)addr, opcode))
121
+ if (get_kernel_nofault(opcode, (insn_size_t *)addr))
122122 return 0;
123123 if (opcode == TRAPA_BUG_OPCODE)
124124 return 1;
....@@ -141,7 +141,7 @@
141141 SIGTRAP) == NOTIFY_STOP)
142142 return;
143143
144
- force_sig(SIGTRAP, current);
144
+ force_sig(SIGTRAP);
145145 }
146146
147147 /*
....@@ -167,16 +167,26 @@
167167 }
168168 #endif
169169
170
- force_sig(SIGTRAP, current);
170
+ force_sig(SIGTRAP);
171171 }
172
+
173
+#ifdef CONFIG_DYNAMIC_FTRACE
174
+extern void arch_ftrace_nmi_enter(void);
175
+extern void arch_ftrace_nmi_exit(void);
176
+#else
177
+static inline void arch_ftrace_nmi_enter(void) { }
178
+static inline void arch_ftrace_nmi_exit(void) { }
179
+#endif
172180
173181 BUILD_TRAP_HANDLER(nmi)
174182 {
175183 unsigned int cpu = smp_processor_id();
176184 TRAP_HANDLER_DECL;
177185
186
+ arch_ftrace_nmi_enter();
187
+
178188 nmi_enter();
179
- nmi_count(cpu)++;
189
+ this_cpu_inc(irq_stat.__nmi_count);
180190
181191 switch (notify_die(DIE_NMI, "NMI", regs, 0, vec & 0xff, SIGINT)) {
182192 case NOTIFY_OK:
....@@ -190,4 +200,6 @@
190200 }
191201
192202 nmi_exit();
203
+
204
+ arch_ftrace_nmi_exit();
193205 }