Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 200091
b: refs/heads/master
c: 8a37f52
h: refs/heads/master
i:
  200089: dd8fe9f
  200087: 2d1f6ed
v: v3
  • Loading branch information
Paul Mundt committed May 25, 2010
1 parent fa77bdb commit fe1759f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e1f42ff4f06e5feaa57a22556ad977ef62164e14
refs/heads/master: 8a37f520523df971bd3f926d8bd45ead37e857e8
19 changes: 17 additions & 2 deletions trunk/arch/sh/kernel/dwarf.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ static DEFINE_SPINLOCK(dwarf_fde_lock);

static struct dwarf_cie *cached_cie;

static unsigned int dwarf_unwinder_ready;

/**
* dwarf_frame_alloc_reg - allocate memory for a DWARF register
* @frame: the DWARF frame whose list of registers we insert on
Expand Down Expand Up @@ -581,6 +583,13 @@ struct dwarf_frame *dwarf_unwind_stack(unsigned long pc,
struct dwarf_reg *reg;
unsigned long addr;

/*
* If we've been called in to before initialization has
* completed, bail out immediately.
*/
if (!dwarf_unwinder_ready)
return NULL;

/*
* If we're starting at the top of the stack we need get the
* contents of a physical register to get the CFA in order to
Expand Down Expand Up @@ -1167,7 +1176,7 @@ void module_dwarf_cleanup(struct module *mod)
*/
static int __init dwarf_unwinder_init(void)
{
int err;
int err = -ENOMEM;

dwarf_frame_cachep = kmem_cache_create("dwarf_frames",
sizeof(struct dwarf_frame), 0,
Expand All @@ -1181,11 +1190,15 @@ static int __init dwarf_unwinder_init(void)
mempool_alloc_slab,
mempool_free_slab,
dwarf_frame_cachep);
if (!dwarf_frame_pool)
goto out;

dwarf_reg_pool = mempool_create(DWARF_REG_MIN_REQ,
mempool_alloc_slab,
mempool_free_slab,
dwarf_reg_cachep);
if (!dwarf_reg_pool)
goto out;

err = dwarf_parse_section(__start_eh_frame, __stop_eh_frame, NULL);
if (err)
Expand All @@ -1195,11 +1208,13 @@ static int __init dwarf_unwinder_init(void)
if (err)
goto out;

dwarf_unwinder_ready = 1;

return 0;

out:
printk(KERN_ERR "Failed to initialise DWARF unwinder: %d\n", err);
dwarf_unwinder_cleanup();
return -EINVAL;
return err;
}
early_initcall(dwarf_unwinder_init);
2 changes: 2 additions & 0 deletions trunk/arch/sh/kernel/return_address.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ void *return_address(unsigned int depth)
struct dwarf_frame *tmp;

tmp = dwarf_unwind_stack(ra, frame);
if (!tmp)
return NULL;

if (frame)
dwarf_free_frame(frame);
Expand Down

0 comments on commit fe1759f

Please sign in to comment.