Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Typedefs | Functions
unwind.c File Reference
#include <linux/module.h>
#include <linux/bootmem.h>
#include <linux/elf.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <asm/unwind.h>
#include <asm/delay.h>
#include <asm/page.h>
#include <asm/ptrace.h>
#include <asm/ptrace_offsets.h>
#include <asm/rse.h>
#include <asm/sections.h>
#include <asm/uaccess.h>
#include "entry.h"
#include "unwind_i.h"
#include "unwind_decoder.c"

Go to the source code of this file.

Macros

#define UNW_LOG_CACHE_SIZE   7 /* each unw_script is ~256 bytes in size */
 
#define UNW_CACHE_SIZE   (1 << UNW_LOG_CACHE_SIZE)
 
#define UNW_LOG_HASH_SIZE   (UNW_LOG_CACHE_SIZE + 1)
 
#define UNW_HASH_SIZE   (1 << UNW_LOG_HASH_SIZE)
 
#define UNW_STATS   0 /* WARNING: this disabled interrupts for long time-spans!! */
 
#define UNW_DEBUG_ON(n)   0
 
#define UNW_DPRINT(n,...)
 
#define STAT(x...)
 
#define alloc_reg_state()   kmalloc(sizeof(struct unw_reg_state), GFP_ATOMIC)
 
#define free_reg_state(usr)   kfree(usr)
 
#define alloc_labeled_state()   kmalloc(sizeof(struct unw_labeled_state), GFP_ATOMIC)
 
#define free_labeled_state(usr)   kfree(usr)
 
#define UNW_DEC_BAD_CODE(code)
 
#define UNW_DEC_PROLOGUE_GR(fmt, r, m, gr, arg)   desc_prologue(0,r,m,gr,arg)
 
#define UNW_DEC_PROLOGUE(fmt, b, r, arg)   desc_prologue(b,r,0,32,arg)
 
#define UNW_DEC_ABI(fmt, a, c, arg)   desc_abi(a,c,arg)
 
#define UNW_DEC_BR_GR(fmt, b, g, arg)   desc_br_gr(b,g,arg)
 
#define UNW_DEC_BR_MEM(fmt, b, arg)   desc_br_mem(b,arg)
 
#define UNW_DEC_FRGR_MEM(fmt, g, f, arg)   desc_frgr_mem(g,f,arg)
 
#define UNW_DEC_FR_MEM(fmt, f, arg)   desc_fr_mem(f,arg)
 
#define UNW_DEC_GR_GR(fmt, m, g, arg)   desc_gr_gr(m,g,arg)
 
#define UNW_DEC_GR_MEM(fmt, m, arg)   desc_gr_mem(m,arg)
 
#define UNW_DEC_MEM_STACK_F(fmt, t, s, arg)   desc_mem_stack_f(t,s,arg)
 
#define UNW_DEC_MEM_STACK_V(fmt, t, arg)   desc_mem_stack_v(t,arg)
 
#define UNW_DEC_REG_GR(fmt, r, d, arg)   desc_reg_gr(r,d,arg)
 
#define UNW_DEC_REG_PSPREL(fmt, r, o, arg)   desc_reg_psprel(r,o,arg)
 
#define UNW_DEC_REG_SPREL(fmt, r, o, arg)   desc_reg_sprel(r,o,arg)
 
#define UNW_DEC_REG_WHEN(fmt, r, t, arg)   desc_reg_when(r,t,arg)
 
#define UNW_DEC_PRIUNAT_WHEN_GR(fmt, t, arg)   desc_reg_when(UNW_REG_PRI_UNAT_GR,t,arg)
 
#define UNW_DEC_PRIUNAT_WHEN_MEM(fmt, t, arg)   desc_reg_when(UNW_REG_PRI_UNAT_MEM,t,arg)
 
#define UNW_DEC_PRIUNAT_GR(fmt, r, arg)   desc_reg_gr(UNW_REG_PRI_UNAT_GR,r,arg)
 
#define UNW_DEC_PRIUNAT_PSPREL(fmt, o, arg)   desc_reg_psprel(UNW_REG_PRI_UNAT_MEM,o,arg)
 
#define UNW_DEC_PRIUNAT_SPREL(fmt, o, arg)   desc_reg_sprel(UNW_REG_PRI_UNAT_MEM,o,arg)
 
#define UNW_DEC_RP_BR(fmt, d, arg)   desc_rp_br(d,arg)
 
#define UNW_DEC_SPILL_BASE(fmt, o, arg)   desc_spill_base(o,arg)
 
#define UNW_DEC_SPILL_MASK(fmt, m, arg)   (m = desc_spill_mask(m,arg))
 
#define UNW_DEC_EPILOGUE(fmt, t, c, arg)   desc_epilogue(t,c,arg)
 
#define UNW_DEC_COPY_STATE(fmt, l, arg)   desc_copy_state(l,arg)
 
#define UNW_DEC_LABEL_STATE(fmt, l, arg)   desc_label_state(l,arg)
 
#define UNW_DEC_SPILL_REG_P(f, p, t, a, x, y, arg)   desc_spill_reg_p(p,t,a,x,y,arg)
 
#define UNW_DEC_SPILL_REG(f, t, a, x, y, arg)   desc_spill_reg_p(0,t,a,x,y,arg)
 
#define UNW_DEC_SPILL_PSPREL_P(f, p, t, a, o, arg)   desc_spill_psprel_p(p,t,a,o,arg)
 
#define UNW_DEC_SPILL_PSPREL(f, t, a, o, arg)   desc_spill_psprel_p(0,t,a,o,arg)
 
#define UNW_DEC_SPILL_SPREL_P(f, p, t, a, o, arg)   desc_spill_sprel_p(p,t,a,o,arg)
 
#define UNW_DEC_SPILL_SPREL(f, t, a, o, arg)   desc_spill_sprel_p(0,t,a,o,arg)
 
#define UNW_DEC_RESTORE_P(f, p, t, a, arg)   desc_restore_p(p,t,a,arg)
 
#define UNW_DEC_RESTORE(f, t, a, arg)   desc_restore_p(0,t,a,arg)
 

Typedefs

typedef unsigned long unw_word
 
typedef unsigned char unw_hash_index_t
 

Functions

int unw_access_gr (struct unw_frame_info *info, int regnum, unsigned long *val, char *nat, int write)
 
 EXPORT_SYMBOL (unw_access_gr)
 
int unw_access_br (struct unw_frame_info *info, int regnum, unsigned long *val, int write)
 
 EXPORT_SYMBOL (unw_access_br)
 
int unw_access_fr (struct unw_frame_info *info, int regnum, struct ia64_fpreg *val, int write)
 
 EXPORT_SYMBOL (unw_access_fr)
 
int unw_access_ar (struct unw_frame_info *info, int regnum, unsigned long *val, int write)
 
 EXPORT_SYMBOL (unw_access_ar)
 
int unw_access_pr (struct unw_frame_info *info, unsigned long *val, int write)
 
 EXPORT_SYMBOL (unw_access_pr)
 
int unw_unwind (struct unw_frame_info *info)
 
 EXPORT_SYMBOL (unw_unwind)
 
int unw_unwind_to_user (struct unw_frame_info *info)
 
 EXPORT_SYMBOL (unw_unwind_to_user)
 
void unw_init_frame_info (struct unw_frame_info *info, struct task_struct *t, struct switch_stack *sw)
 
 EXPORT_SYMBOL (unw_init_frame_info)
 
void unw_init_from_blocked_task (struct unw_frame_info *info, struct task_struct *t)
 
 EXPORT_SYMBOL (unw_init_from_blocked_task)
 
voidunw_add_unwind_table (const char *name, unsigned long segment_base, unsigned long gp, const void *table_start, const void *table_end)
 
void unw_remove_unwind_table (void *handle)
 
 __initcall (create_gate_table)
 
void __init unw_init (void)
 
asmlinkage long sys_getunwind (void __user *buf, size_t buf_size)
 

Macro Definition Documentation

#define alloc_labeled_state ( )    kmalloc(sizeof(struct unw_labeled_state), GFP_ATOMIC)

Definition at line 77 of file unwind.c.

#define alloc_reg_state ( )    kmalloc(sizeof(struct unw_reg_state), GFP_ATOMIC)

Definition at line 75 of file unwind.c.

#define free_labeled_state (   usr)    kfree(usr)

Definition at line 78 of file unwind.c.

#define free_reg_state (   usr)    kfree(usr)

Definition at line 76 of file unwind.c.

#define STAT (   x...)

Definition at line 72 of file unwind.c.

#define UNW_CACHE_SIZE   (1 << UNW_LOG_CACHE_SIZE)

Definition at line 50 of file unwind.c.

#define UNW_DEBUG_ON (   n)    0

Definition at line 65 of file unwind.c.

#define UNW_DEC_ABI (   fmt,
  a,
  c,
  arg 
)    desc_abi(a,c,arg)

Definition at line 1159 of file unwind.c.

#define UNW_DEC_BAD_CODE (   code)
Value:
printk(KERN_ERR "unwind: unknown code 0x%02x\n", \
code);

Definition at line 1148 of file unwind.c.

#define UNW_DEC_BR_GR (   fmt,
  b,
  g,
  arg 
)    desc_br_gr(b,g,arg)

Definition at line 1160 of file unwind.c.

#define UNW_DEC_BR_MEM (   fmt,
  b,
  arg 
)    desc_br_mem(b,arg)

Definition at line 1161 of file unwind.c.

#define UNW_DEC_COPY_STATE (   fmt,
  l,
  arg 
)    desc_copy_state(l,arg)

Definition at line 1184 of file unwind.c.

#define UNW_DEC_EPILOGUE (   fmt,
  t,
  c,
  arg 
)    desc_epilogue(t,c,arg)

Definition at line 1183 of file unwind.c.

#define UNW_DEC_FR_MEM (   fmt,
  f,
  arg 
)    desc_fr_mem(f,arg)

Definition at line 1163 of file unwind.c.

#define UNW_DEC_FRGR_MEM (   fmt,
  g,
  f,
  arg 
)    desc_frgr_mem(g,f,arg)

Definition at line 1162 of file unwind.c.

#define UNW_DEC_GR_GR (   fmt,
  m,
  g,
  arg 
)    desc_gr_gr(m,g,arg)

Definition at line 1164 of file unwind.c.

#define UNW_DEC_GR_MEM (   fmt,
  m,
  arg 
)    desc_gr_mem(m,arg)

Definition at line 1165 of file unwind.c.

#define UNW_DEC_LABEL_STATE (   fmt,
  l,
  arg 
)    desc_label_state(l,arg)

Definition at line 1185 of file unwind.c.

#define UNW_DEC_MEM_STACK_F (   fmt,
  t,
  s,
  arg 
)    desc_mem_stack_f(t,s,arg)

Definition at line 1166 of file unwind.c.

#define UNW_DEC_MEM_STACK_V (   fmt,
  t,
  arg 
)    desc_mem_stack_v(t,arg)

Definition at line 1167 of file unwind.c.

#define UNW_DEC_PRIUNAT_GR (   fmt,
  r,
  arg 
)    desc_reg_gr(UNW_REG_PRI_UNAT_GR,r,arg)

Definition at line 1174 of file unwind.c.

#define UNW_DEC_PRIUNAT_PSPREL (   fmt,
  o,
  arg 
)    desc_reg_psprel(UNW_REG_PRI_UNAT_MEM,o,arg)

Definition at line 1175 of file unwind.c.

#define UNW_DEC_PRIUNAT_SPREL (   fmt,
  o,
  arg 
)    desc_reg_sprel(UNW_REG_PRI_UNAT_MEM,o,arg)

Definition at line 1176 of file unwind.c.

#define UNW_DEC_PRIUNAT_WHEN_GR (   fmt,
  t,
  arg 
)    desc_reg_when(UNW_REG_PRI_UNAT_GR,t,arg)

Definition at line 1172 of file unwind.c.

#define UNW_DEC_PRIUNAT_WHEN_MEM (   fmt,
  t,
  arg 
)    desc_reg_when(UNW_REG_PRI_UNAT_MEM,t,arg)

Definition at line 1173 of file unwind.c.

#define UNW_DEC_PROLOGUE (   fmt,
  b,
  r,
  arg 
)    desc_prologue(b,r,0,32,arg)

Definition at line 1155 of file unwind.c.

#define UNW_DEC_PROLOGUE_GR (   fmt,
  r,
  m,
  gr,
  arg 
)    desc_prologue(0,r,m,gr,arg)

Definition at line 1154 of file unwind.c.

#define UNW_DEC_REG_GR (   fmt,
  r,
  d,
  arg 
)    desc_reg_gr(r,d,arg)

Definition at line 1168 of file unwind.c.

#define UNW_DEC_REG_PSPREL (   fmt,
  r,
  o,
  arg 
)    desc_reg_psprel(r,o,arg)

Definition at line 1169 of file unwind.c.

#define UNW_DEC_REG_SPREL (   fmt,
  r,
  o,
  arg 
)    desc_reg_sprel(r,o,arg)

Definition at line 1170 of file unwind.c.

#define UNW_DEC_REG_WHEN (   fmt,
  r,
  t,
  arg 
)    desc_reg_when(r,t,arg)

Definition at line 1171 of file unwind.c.

#define UNW_DEC_RESTORE (   f,
  t,
  a,
  arg 
)    desc_restore_p(0,t,a,arg)

Definition at line 1196 of file unwind.c.

#define UNW_DEC_RESTORE_P (   f,
  p,
  t,
  a,
  arg 
)    desc_restore_p(p,t,a,arg)

Definition at line 1195 of file unwind.c.

#define UNW_DEC_RP_BR (   fmt,
  d,
  arg 
)    desc_rp_br(d,arg)

Definition at line 1177 of file unwind.c.

#define UNW_DEC_SPILL_BASE (   fmt,
  o,
  arg 
)    desc_spill_base(o,arg)

Definition at line 1178 of file unwind.c.

#define UNW_DEC_SPILL_MASK (   fmt,
  m,
  arg 
)    (m = desc_spill_mask(m,arg))

Definition at line 1179 of file unwind.c.

#define UNW_DEC_SPILL_PSPREL (   f,
  t,
  a,
  o,
  arg 
)    desc_spill_psprel_p(0,t,a,o,arg)

Definition at line 1192 of file unwind.c.

#define UNW_DEC_SPILL_PSPREL_P (   f,
  p,
  t,
  a,
  o,
  arg 
)    desc_spill_psprel_p(p,t,a,o,arg)

Definition at line 1191 of file unwind.c.

#define UNW_DEC_SPILL_REG (   f,
  t,
  a,
  x,
  y,
  arg 
)    desc_spill_reg_p(0,t,a,x,y,arg)

Definition at line 1190 of file unwind.c.

#define UNW_DEC_SPILL_REG_P (   f,
  p,
  t,
  a,
  x,
  y,
  arg 
)    desc_spill_reg_p(p,t,a,x,y,arg)

Definition at line 1189 of file unwind.c.

#define UNW_DEC_SPILL_SPREL (   f,
  t,
  a,
  o,
  arg 
)    desc_spill_sprel_p(0,t,a,o,arg)

Definition at line 1194 of file unwind.c.

#define UNW_DEC_SPILL_SPREL_P (   f,
  p,
  t,
  a,
  o,
  arg 
)    desc_spill_sprel_p(p,t,a,o,arg)

Definition at line 1193 of file unwind.c.

#define UNW_DPRINT (   n,
  ... 
)

Definition at line 66 of file unwind.c.

#define UNW_HASH_SIZE   (1 << UNW_LOG_HASH_SIZE)

Definition at line 53 of file unwind.c.

#define UNW_LOG_CACHE_SIZE   7 /* each unw_script is ~256 bytes in size */

Definition at line 49 of file unwind.c.

#define UNW_LOG_HASH_SIZE   (UNW_LOG_CACHE_SIZE + 1)

Definition at line 52 of file unwind.c.

#define UNW_STATS   0 /* WARNING: this disabled interrupts for long time-spans!! */

Definition at line 55 of file unwind.c.

Typedef Documentation

typedef unsigned char unw_hash_index_t

Definition at line 81 of file unwind.c.

typedef unsigned long unw_word

Definition at line 80 of file unwind.c.

Function Documentation

__initcall ( create_gate_table  )
EXPORT_SYMBOL ( unw_access_gr  )
EXPORT_SYMBOL ( unw_access_br  )
EXPORT_SYMBOL ( unw_access_fr  )
EXPORT_SYMBOL ( unw_access_ar  )
EXPORT_SYMBOL ( unw_access_pr  )
EXPORT_SYMBOL ( unw_unwind  )
EXPORT_SYMBOL ( unw_unwind_to_user  )
EXPORT_SYMBOL ( unw_init_frame_info  )
EXPORT_SYMBOL ( unw_init_from_blocked_task  )
asmlinkage long sys_getunwind ( void __user buf,
size_t  buf_size 
)

Definition at line 2313 of file unwind.c.

int unw_access_ar ( struct unw_frame_info info,
int  regnum,
unsigned long val,
int  write 
)

Definition at line 494 of file unwind.c.

int unw_access_br ( struct unw_frame_info info,
int  regnum,
unsigned long val,
int  write 
)

Definition at line 409 of file unwind.c.

int unw_access_fr ( struct unw_frame_info info,
int  regnum,
struct ia64_fpreg val,
int  write 
)

Definition at line 445 of file unwind.c.

int unw_access_gr ( struct unw_frame_info info,
int  regnum,
unsigned long val,
char nat,
int  write 
)

Definition at line 283 of file unwind.c.

int unw_access_pr ( struct unw_frame_info info,
unsigned long val,
int  write 
)

Definition at line 591 of file unwind.c.

void* unw_add_unwind_table ( const char name,
unsigned long  segment_base,
unsigned long  gp,
const void table_start,
const void table_end 
)

Definition at line 2096 of file unwind.c.

void __init unw_init ( void  )

Definition at line 2243 of file unwind.c.

void unw_init_frame_info ( struct unw_frame_info info,
struct task_struct t,
struct switch_stack sw 
)

Definition at line 2051 of file unwind.c.

void unw_init_from_blocked_task ( struct unw_frame_info info,
struct task_struct t 
)

Definition at line 2071 of file unwind.c.

void unw_remove_unwind_table ( void handle)

Definition at line 2127 of file unwind.c.

int unw_unwind ( struct unw_frame_info info)

Definition at line 1882 of file unwind.c.

int unw_unwind_to_user ( struct unw_frame_info info)

Definition at line 1969 of file unwind.c.

Variable Documentation

unsigned char cache

Definition at line 116 of file unwind.c.

unsigned long* gate_table

Definition at line 110 of file unwind.c.

size_t gate_table_size

Definition at line 109 of file unwind.c.

unsigned short hash[UNW_HASH_SIZE]

Definition at line 113 of file unwind.c.

struct unw_table kernel_table

Definition at line 106 of file unwind.c.

spinlock_t lock

Definition at line 84 of file unwind.c.

unsigned short lru_head

Definition at line 97 of file unwind.c.

unsigned short lru_tail

Definition at line 98 of file unwind.c.

unsigned short preg_index[UNW_NUM_REGS]

Definition at line 101 of file unwind.c.

short pt_regs_offsets[32]

Definition at line 103 of file unwind.c.

unsigned long r0

Definition at line 89 of file unwind.c.

const unsigned char save_order[8]

Definition at line 92 of file unwind.c.

unsigned short sw_off[sizeof(struct unw_frame_info)/8]

Definition at line 95 of file unwind.c.

struct unw_table* tables

Definition at line 87 of file unwind.c.