diff options
Diffstat (limited to 'arch/sh/include')
-rw-r--r-- | arch/sh/include/asm/bug.h | 31 | ||||
-rw-r--r-- | arch/sh/include/asm/dwarf.h | 28 | ||||
-rw-r--r-- | arch/sh/include/asm/system.h | 5 | ||||
-rw-r--r-- | arch/sh/include/asm/unwinder.h | 6 |
4 files changed, 52 insertions, 18 deletions
diff --git a/arch/sh/include/asm/bug.h b/arch/sh/include/asm/bug.h index c01718040166..d02c01b3e6b9 100644 --- a/arch/sh/include/asm/bug.h +++ b/arch/sh/include/asm/bug.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define __ASM_SH_BUG_H | 2 | #define __ASM_SH_BUG_H |
3 | 3 | ||
4 | #define TRAPA_BUG_OPCODE 0xc33e /* trapa #0x3e */ | 4 | #define TRAPA_BUG_OPCODE 0xc33e /* trapa #0x3e */ |
5 | #define BUGFLAG_UNWINDER (1 << 1) | ||
5 | 6 | ||
6 | #ifdef CONFIG_GENERIC_BUG | 7 | #ifdef CONFIG_GENERIC_BUG |
7 | #define HAVE_ARCH_BUG | 8 | #define HAVE_ARCH_BUG |
@@ -72,6 +73,36 @@ do { \ | |||
72 | unlikely(__ret_warn_on); \ | 73 | unlikely(__ret_warn_on); \ |
73 | }) | 74 | }) |
74 | 75 | ||
76 | #define UNWINDER_BUG() \ | ||
77 | do { \ | ||
78 | __asm__ __volatile__ ( \ | ||
79 | "1:\t.short %O0\n" \ | ||
80 | _EMIT_BUG_ENTRY \ | ||
81 | : \ | ||
82 | : "n" (TRAPA_BUG_OPCODE), \ | ||
83 | "i" (__FILE__), \ | ||
84 | "i" (__LINE__), \ | ||
85 | "i" (BUGFLAG_UNWINDER), \ | ||
86 | "i" (sizeof(struct bug_entry))); \ | ||
87 | } while (0) | ||
88 | |||
89 | #define UNWINDER_BUG_ON(x) ({ \ | ||
90 | int __ret_unwinder_on = !!(x); \ | ||
91 | if (__builtin_constant_p(__ret_unwinder_on)) { \ | ||
92 | if (__ret_unwinder_on) \ | ||
93 | UNWINDER_BUG(); \ | ||
94 | } else { \ | ||
95 | if (unlikely(__ret_unwinder_on)) \ | ||
96 | UNWINDER_BUG(); \ | ||
97 | } \ | ||
98 | unlikely(__ret_unwinder_on); \ | ||
99 | }) | ||
100 | |||
101 | #else | ||
102 | |||
103 | #define UNWINDER_BUG BUG | ||
104 | #define UNWINDER_BUG_ON BUG_ON | ||
105 | |||
75 | #endif /* CONFIG_GENERIC_BUG */ | 106 | #endif /* CONFIG_GENERIC_BUG */ |
76 | 107 | ||
77 | #include <asm-generic/bug.h> | 108 | #include <asm-generic/bug.h> |
diff --git a/arch/sh/include/asm/dwarf.h b/arch/sh/include/asm/dwarf.h index d3d3837c5e1b..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 | */ |
294 | struct dwarf_reg { | 291 | struct 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 | */ | ||
306 | struct dwarf_stack { | ||
307 | unsigned int depth; | ||
308 | struct dwarf_frame **level; | ||
309 | }; | 301 | }; |
310 | 302 | ||
311 | /* | 303 | /* |
@@ -370,17 +362,16 @@ static inline unsigned int DW_CFA_operand(unsigned long insn) | |||
370 | #define DW_EXT_HI 0xffffffff | 362 | #define DW_EXT_HI 0xffffffff |
371 | #define DW_EXT_DWARF64 DW_EXT_HI | 363 | #define DW_EXT_DWARF64 DW_EXT_HI |
372 | 364 | ||
373 | extern void dwarf_unwinder_init(void); | ||
374 | |||
375 | extern struct dwarf_frame *dwarf_unwind_stack(unsigned long, | 365 | extern struct dwarf_frame *dwarf_unwind_stack(unsigned long, |
376 | struct dwarf_frame *); | 366 | struct dwarf_frame *); |
377 | #endif /* __ASSEMBLY__ */ | 367 | #endif /* !__ASSEMBLY__ */ |
378 | 368 | ||
379 | #define CFI_STARTPROC .cfi_startproc | 369 | #define CFI_STARTPROC .cfi_startproc |
380 | #define CFI_ENDPROC .cfi_endproc | 370 | #define CFI_ENDPROC .cfi_endproc |
381 | #define CFI_DEF_CFA .cfi_def_cfa | 371 | #define CFI_DEF_CFA .cfi_def_cfa |
382 | #define CFI_REGISTER .cfi_register | 372 | #define CFI_REGISTER .cfi_register |
383 | #define CFI_REL_OFFSET .cfi_rel_offset | 373 | #define CFI_REL_OFFSET .cfi_rel_offset |
374 | #define CFI_UNDEFINED .cfi_undefined | ||
384 | 375 | ||
385 | #else | 376 | #else |
386 | 377 | ||
@@ -394,6 +385,7 @@ extern struct dwarf_frame *dwarf_unwind_stack(unsigned long, | |||
394 | #define CFI_DEF_CFA CFI_IGNORE | 385 | #define CFI_DEF_CFA CFI_IGNORE |
395 | #define CFI_REGISTER CFI_IGNORE | 386 | #define CFI_REGISTER CFI_IGNORE |
396 | #define CFI_REL_OFFSET CFI_IGNORE | 387 | #define CFI_REL_OFFSET CFI_IGNORE |
388 | #define CFI_UNDEFINED CFI_IGNORE | ||
397 | 389 | ||
398 | #ifndef __ASSEMBLY__ | 390 | #ifndef __ASSEMBLY__ |
399 | static inline void dwarf_unwinder_init(void) | 391 | static 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); | |||
181 | BUILD_TRAP_HANDLER(singlestep); | 181 | BUILD_TRAP_HANDLER(singlestep); |
182 | BUILD_TRAP_HANDLER(fpu_error); | 182 | BUILD_TRAP_HANDLER(fpu_error); |
183 | BUILD_TRAP_HANDLER(fpu_state_restore); | 183 | BUILD_TRAP_HANDLER(fpu_state_restore); |
184 | BUILD_TRAP_HANDLER(unwinder); | ||
185 | |||
186 | #ifdef CONFIG_BUG | ||
187 | extern 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 | */ | ||
29 | extern int unwinder_faulted; | ||
30 | |||
25 | #endif /* _LINUX_UNWINDER_H */ | 31 | #endif /* _LINUX_UNWINDER_H */ |