aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/sh/include/asm/dwarf.h2
-rw-r--r--arch/sh/kernel/dwarf.c32
-rw-r--r--arch/sh/kernel/irq.c4
3 files changed, 15 insertions, 23 deletions
diff --git a/arch/sh/include/asm/dwarf.h b/arch/sh/include/asm/dwarf.h
index d3d3837c5e1b..2fbe8720411e 100644
--- a/arch/sh/include/asm/dwarf.h
+++ b/arch/sh/include/asm/dwarf.h
@@ -370,8 +370,6 @@ static inline unsigned int DW_CFA_operand(unsigned long insn)
370#define DW_EXT_HI 0xffffffff 370#define DW_EXT_HI 0xffffffff
371#define DW_EXT_DWARF64 DW_EXT_HI 371#define DW_EXT_DWARF64 DW_EXT_HI
372 372
373extern void dwarf_unwinder_init(void);
374
375extern struct dwarf_frame *dwarf_unwind_stack(unsigned long, 373extern struct dwarf_frame *dwarf_unwind_stack(unsigned long,
376 struct dwarf_frame *); 374 struct dwarf_frame *);
377#endif /* __ASSEMBLY__ */ 375#endif /* __ASSEMBLY__ */
diff --git a/arch/sh/kernel/dwarf.c b/arch/sh/kernel/dwarf.c
index 5fd6e604816d..d0652153f576 100644
--- a/arch/sh/kernel/dwarf.c
+++ b/arch/sh/kernel/dwarf.c
@@ -26,10 +26,10 @@
26#include <asm/stacktrace.h> 26#include <asm/stacktrace.h>
27 27
28static LIST_HEAD(dwarf_cie_list); 28static LIST_HEAD(dwarf_cie_list);
29DEFINE_SPINLOCK(dwarf_cie_lock); 29static DEFINE_SPINLOCK(dwarf_cie_lock);
30 30
31static LIST_HEAD(dwarf_fde_list); 31static LIST_HEAD(dwarf_fde_list);
32DEFINE_SPINLOCK(dwarf_fde_lock); 32static DEFINE_SPINLOCK(dwarf_fde_lock);
33 33
34static struct dwarf_cie *cached_cie; 34static struct dwarf_cie *cached_cie;
35 35
@@ -264,7 +264,7 @@ static inline int dwarf_entry_len(char *addr, unsigned long *len)
264 */ 264 */
265static struct dwarf_cie *dwarf_lookup_cie(unsigned long cie_ptr) 265static struct dwarf_cie *dwarf_lookup_cie(unsigned long cie_ptr)
266{ 266{
267 struct dwarf_cie *cie, *n; 267 struct dwarf_cie *cie;
268 unsigned long flags; 268 unsigned long flags;
269 269
270 spin_lock_irqsave(&dwarf_cie_lock, flags); 270 spin_lock_irqsave(&dwarf_cie_lock, flags);
@@ -278,7 +278,7 @@ static struct dwarf_cie *dwarf_lookup_cie(unsigned long cie_ptr)
278 goto out; 278 goto out;
279 } 279 }
280 280
281 list_for_each_entry_safe(cie, n, &dwarf_cie_list, link) { 281 list_for_each_entry(cie, &dwarf_cie_list, link) {
282 if (cie->cie_pointer == cie_ptr) { 282 if (cie->cie_pointer == cie_ptr) {
283 cached_cie = cie; 283 cached_cie = cie;
284 break; 284 break;
@@ -299,11 +299,12 @@ out:
299 */ 299 */
300struct dwarf_fde *dwarf_lookup_fde(unsigned long pc) 300struct dwarf_fde *dwarf_lookup_fde(unsigned long pc)
301{ 301{
302 struct dwarf_fde *fde;
302 unsigned long flags; 303 unsigned long flags;
303 struct dwarf_fde *fde, *n;
304 304
305 spin_lock_irqsave(&dwarf_fde_lock, flags); 305 spin_lock_irqsave(&dwarf_fde_lock, flags);
306 list_for_each_entry_safe(fde, n, &dwarf_fde_list, link) { 306
307 list_for_each_entry(fde, &dwarf_fde_list, link) {
307 unsigned long start, end; 308 unsigned long start, end;
308 309
309 start = fde->initial_location; 310 start = fde->initial_location;
@@ -787,24 +788,19 @@ static struct unwinder dwarf_unwinder = {
787 788
788static void dwarf_unwinder_cleanup(void) 789static void dwarf_unwinder_cleanup(void)
789{ 790{
790 struct dwarf_cie *cie, *m; 791 struct dwarf_cie *cie;
791 struct dwarf_fde *fde, *n; 792 struct dwarf_fde *fde;
792 unsigned long flags;
793 793
794 /* 794 /*
795 * Deallocate all the memory allocated for the DWARF unwinder. 795 * Deallocate all the memory allocated for the DWARF unwinder.
796 * Traverse all the FDE/CIE lists and remove and free all the 796 * Traverse all the FDE/CIE lists and remove and free all the
797 * memory associated with those data structures. 797 * memory associated with those data structures.
798 */ 798 */
799 spin_lock_irqsave(&dwarf_cie_lock, flags); 799 list_for_each_entry(cie, &dwarf_cie_list, link)
800 list_for_each_entry_safe(cie, m, &dwarf_cie_list, link)
801 kfree(cie); 800 kfree(cie);
802 spin_unlock_irqrestore(&dwarf_cie_lock, flags);
803 801
804 spin_lock_irqsave(&dwarf_fde_lock, flags); 802 list_for_each_entry(fde, &dwarf_fde_list, link)
805 list_for_each_entry_safe(fde, n, &dwarf_fde_list, link)
806 kfree(fde); 803 kfree(fde);
807 spin_unlock_irqrestore(&dwarf_fde_lock, flags);
808} 804}
809 805
810/** 806/**
@@ -816,7 +812,7 @@ static void dwarf_unwinder_cleanup(void)
816 * easy to lookup the FDE for a given PC, so we build a list of FDE 812 * easy to lookup the FDE for a given PC, so we build a list of FDE
817 * and CIE entries that make it easier. 813 * and CIE entries that make it easier.
818 */ 814 */
819void dwarf_unwinder_init(void) 815static int __init dwarf_unwinder_init(void)
820{ 816{
821 u32 entry_type; 817 u32 entry_type;
822 void *p, *entry; 818 void *p, *entry;
@@ -877,9 +873,11 @@ void dwarf_unwinder_init(void)
877 if (err) 873 if (err)
878 goto out; 874 goto out;
879 875
880 return; 876 return 0;
881 877
882out: 878out:
883 printk(KERN_ERR "Failed to initialise DWARF unwinder: %d\n", err); 879 printk(KERN_ERR "Failed to initialise DWARF unwinder: %d\n", err);
884 dwarf_unwinder_cleanup(); 880 dwarf_unwinder_cleanup();
881 return -EINVAL;
885} 882}
883early_initcall(dwarf_unwinder_init);
diff --git a/arch/sh/kernel/irq.c b/arch/sh/kernel/irq.c
index 2bb43dc74f22..278c68c60488 100644
--- a/arch/sh/kernel/irq.c
+++ b/arch/sh/kernel/irq.c
@@ -14,7 +14,6 @@
14#include <asm/processor.h> 14#include <asm/processor.h>
15#include <asm/machvec.h> 15#include <asm/machvec.h>
16#include <asm/uaccess.h> 16#include <asm/uaccess.h>
17#include <asm/dwarf.h>
18#include <asm/thread_info.h> 17#include <asm/thread_info.h>
19#include <cpu/mmu_context.h> 18#include <cpu/mmu_context.h>
20 19
@@ -262,9 +261,6 @@ void __init init_IRQ(void)
262 sh_mv.mv_init_irq(); 261 sh_mv.mv_init_irq();
263 262
264 irq_ctx_init(smp_processor_id()); 263 irq_ctx_init(smp_processor_id());
265
266 /* This needs to be early, but not too early.. */
267 dwarf_unwinder_init();
268} 264}
269 265
270#ifdef CONFIG_SPARSE_IRQ 266#ifdef CONFIG_SPARSE_IRQ