diff options
Diffstat (limited to 'arch/sh/kernel/dwarf.c')
-rw-r--r-- | arch/sh/kernel/dwarf.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/arch/sh/kernel/dwarf.c b/arch/sh/kernel/dwarf.c index 03b3616c80a5..2d07084e4882 100644 --- a/arch/sh/kernel/dwarf.c +++ b/arch/sh/kernel/dwarf.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/list.h> | 20 | #include <linux/list.h> |
21 | #include <linux/mempool.h> | 21 | #include <linux/mempool.h> |
22 | #include <linux/mm.h> | 22 | #include <linux/mm.h> |
23 | #include <linux/ftrace.h> | ||
23 | #include <asm/dwarf.h> | 24 | #include <asm/dwarf.h> |
24 | #include <asm/unwinder.h> | 25 | #include <asm/unwinder.h> |
25 | #include <asm/sections.h> | 26 | #include <asm/sections.h> |
@@ -557,6 +558,27 @@ struct dwarf_frame * dwarf_unwind_stack(unsigned long pc, | |||
557 | if (!pc && !prev) | 558 | if (!pc && !prev) |
558 | pc = (unsigned long)current_text_addr(); | 559 | pc = (unsigned long)current_text_addr(); |
559 | 560 | ||
561 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | ||
562 | /* | ||
563 | * If our stack has been patched by the function graph tracer | ||
564 | * then we might see the address of return_to_handler() where we | ||
565 | * expected to find the real return address. | ||
566 | */ | ||
567 | if (pc == (unsigned long)&return_to_handler) { | ||
568 | int index = current->curr_ret_stack; | ||
569 | |||
570 | /* | ||
571 | * We currently have no way of tracking how many | ||
572 | * return_to_handler()'s we've seen. If there is more | ||
573 | * than one patched return address on our stack, | ||
574 | * complain loudly. | ||
575 | */ | ||
576 | WARN_ON(index > 0); | ||
577 | |||
578 | pc = current->ret_stack[index].ret; | ||
579 | } | ||
580 | #endif | ||
581 | |||
560 | frame = mempool_alloc(dwarf_frame_pool, GFP_ATOMIC); | 582 | frame = mempool_alloc(dwarf_frame_pool, GFP_ATOMIC); |
561 | if (!frame) { | 583 | if (!frame) { |
562 | printk(KERN_ERR "Unable to allocate a dwarf frame\n"); | 584 | printk(KERN_ERR "Unable to allocate a dwarf frame\n"); |