aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/include
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/include')
-rw-r--r--arch/sh/include/asm/bug.h25
-rw-r--r--arch/sh/include/asm/dwarf.h26
-rw-r--r--arch/sh/include/asm/system.h5
-rw-r--r--arch/sh/include/asm/unwinder.h6
4 files changed, 46 insertions, 16 deletions
diff --git a/arch/sh/include/asm/bug.h b/arch/sh/include/asm/bug.h
index c01718040166..b7d9822fd6c2 100644
--- a/arch/sh/include/asm/bug.h
+++ b/arch/sh/include/asm/bug.h
@@ -1,6 +1,7 @@
1#ifndef __ASM_SH_BUG_H 1#ifndef __ASM_SH_BUG_H
2#define __ASM_SH_BUG_H 2#define __ASM_SH_BUG_H
3 3
4#define TRAPA_UNWINDER_BUG_OPCODE 0xc33b /* trapa #0x3b */
4#define TRAPA_BUG_OPCODE 0xc33e /* trapa #0x3e */ 5#define TRAPA_BUG_OPCODE 0xc33e /* trapa #0x3e */
5 6
6#ifdef CONFIG_GENERIC_BUG 7#ifdef CONFIG_GENERIC_BUG
@@ -72,6 +73,30 @@ do { \
72 unlikely(__ret_warn_on); \ 73 unlikely(__ret_warn_on); \
73}) 74})
74 75
76#define UNWINDER_BUG() \
77do { \
78 __asm__ __volatile__ ( \
79 "1:\t.short %O0\n" \
80 _EMIT_BUG_ENTRY \
81 : \
82 : "n" (TRAPA_UNWINDER_BUG_OPCODE), \
83 "i" (__FILE__), \
84 "i" (__LINE__), "i" (0), \
85 "i" (sizeof(struct bug_entry))); \
86} while (0)
87
88#define UNWINDER_BUG_ON(x) ({ \
89 int __ret_unwinder_on = !!(x); \
90 if (__builtin_constant_p(__ret_unwinder_on)) { \
91 if (__ret_unwinder_on) \
92 UNWINDER_BUG(); \
93 } else { \
94 if (unlikely(__ret_unwinder_on)) \
95 UNWINDER_BUG(); \
96 } \
97 unlikely(__ret_unwinder_on); \
98})
99
75#endif /* CONFIG_GENERIC_BUG */ 100#endif /* CONFIG_GENERIC_BUG */
76 101
77#include <asm-generic/bug.h> 102#include <asm-generic/bug.h>
diff --git a/arch/sh/include/asm/dwarf.h b/arch/sh/include/asm/dwarf.h
index 2fbe8720411e..c367ed3373c5 100644
--- a/arch/sh/include/asm/dwarf.h
+++ b/arch/sh/include/asm/dwarf.h
@@ -265,10 +265,7 @@ struct dwarf_frame {
265 265
266 unsigned long pc; 266 unsigned long pc;
267 267
268 struct dwarf_reg *regs; 268 struct list_head reg_list;
269 unsigned int num_regs; /* how many regs are allocated? */
270
271 unsigned int depth; /* what level are we in the callstack? */
272 269
273 unsigned long cfa; 270 unsigned long cfa;
274 271
@@ -292,20 +289,15 @@ struct dwarf_frame {
292 * @flags: Describes how to calculate the value of this register 289 * @flags: Describes how to calculate the value of this register
293 */ 290 */
294struct dwarf_reg { 291struct dwarf_reg {
292 struct list_head link;
293
294 unsigned int number;
295
295 unsigned long addr; 296 unsigned long addr;
296 unsigned long flags; 297 unsigned long flags;
297#define DWARF_REG_OFFSET (1 << 0) 298#define DWARF_REG_OFFSET (1 << 0)
298}; 299#define DWARF_VAL_OFFSET (1 << 1)
299 300#define DWARF_UNDEFINED (1 << 2)
300/**
301 * dwarf_stack - a DWARF stack contains a collection of DWARF frames
302 * @depth: the number of frames in the stack
303 * @level: an array of DWARF frames, indexed by stack level
304 *
305 */
306struct dwarf_stack {
307 unsigned int depth;
308 struct dwarf_frame **level;
309}; 301};
310 302
311/* 303/*
@@ -372,13 +364,14 @@ static inline unsigned int DW_CFA_operand(unsigned long insn)
372 364
373extern struct dwarf_frame *dwarf_unwind_stack(unsigned long, 365extern struct dwarf_frame *dwarf_unwind_stack(unsigned long,
374 struct dwarf_frame *); 366 struct dwarf_frame *);
375#endif /* __ASSEMBLY__ */ 367#endif /* !__ASSEMBLY__ */
376 368
377#define CFI_STARTPROC .cfi_startproc 369#define CFI_STARTPROC .cfi_startproc
378#define CFI_ENDPROC .cfi_endproc 370#define CFI_ENDPROC .cfi_endproc
379#define CFI_DEF_CFA .cfi_def_cfa 371#define CFI_DEF_CFA .cfi_def_cfa
380#define CFI_REGISTER .cfi_register 372#define CFI_REGISTER .cfi_register
381#define CFI_REL_OFFSET .cfi_rel_offset 373#define CFI_REL_OFFSET .cfi_rel_offset
374#define CFI_UNDEFINED .cfi_undefined
382 375
383#else 376#else
384 377
@@ -392,6 +385,7 @@ extern struct dwarf_frame *dwarf_unwind_stack(unsigned long,
392#define CFI_DEF_CFA CFI_IGNORE 385#define CFI_DEF_CFA CFI_IGNORE
393#define CFI_REGISTER CFI_IGNORE 386#define CFI_REGISTER CFI_IGNORE
394#define CFI_REL_OFFSET CFI_IGNORE 387#define CFI_REL_OFFSET CFI_IGNORE
388#define CFI_UNDEFINED CFI_IGNORE
395 389
396#ifndef __ASSEMBLY__ 390#ifndef __ASSEMBLY__
397static inline void dwarf_unwinder_init(void) 391static inline void dwarf_unwinder_init(void)
diff --git a/arch/sh/include/asm/system.h b/arch/sh/include/asm/system.h
index ab79e1f4fbe0..f9e2ceb94d9b 100644
--- a/arch/sh/include/asm/system.h
+++ b/arch/sh/include/asm/system.h
@@ -181,6 +181,11 @@ BUILD_TRAP_HANDLER(breakpoint);
181BUILD_TRAP_HANDLER(singlestep); 181BUILD_TRAP_HANDLER(singlestep);
182BUILD_TRAP_HANDLER(fpu_error); 182BUILD_TRAP_HANDLER(fpu_error);
183BUILD_TRAP_HANDLER(fpu_state_restore); 183BUILD_TRAP_HANDLER(fpu_state_restore);
184BUILD_TRAP_HANDLER(unwinder);
185
186#ifdef CONFIG_BUG
187extern void handle_BUG(struct pt_regs *);
188#endif
184 189
185#define arch_align_stack(x) (x) 190#define arch_align_stack(x) (x)
186 191
diff --git a/arch/sh/include/asm/unwinder.h b/arch/sh/include/asm/unwinder.h
index 3dc551453e28..1e65c07b3e18 100644
--- a/arch/sh/include/asm/unwinder.h
+++ b/arch/sh/include/asm/unwinder.h
@@ -22,4 +22,10 @@ extern void stack_reader_dump(struct task_struct *, struct pt_regs *,
22 unsigned long *, const struct stacktrace_ops *, 22 unsigned long *, const struct stacktrace_ops *,
23 void *); 23 void *);
24 24
25/*
26 * Used by fault handling code to signal to the unwinder code that it
27 * should switch to a different unwinder.
28 */
29extern int unwinder_faulted;
30
25#endif /* _LINUX_UNWINDER_H */ 31#endif /* _LINUX_UNWINDER_H */