44 #define clib_backtrace_defined 56 asm volatile (
".set push\n" 57 ".set noat\n" "move %[saved_pc], $31\n" "move %[sp], $29\n" 63 ".set pop\n":[pc]
"=r" (pc),
64 [saved_pc]
"=r" (saved_pc),[sp]
"=r" (sp));
67 n_frames_to_skip += 1;
69 for (i = 0; i < max_callers + n_frames_to_skip; i++)
73 i32 insn, rs, rt, rd, immediate, found_saved_pc;
101 void *addr = sp + immediate;
108 ASSERT (immediate % 4 == 0);
109 if (op == MIPS_OPCODE_sw)
110 saved_pc = ((
u32 *) addr)[0];
112 saved_pc = ((
u64 *) addr)[0];
117 case MIPS_OPCODE_addiu:
118 case MIPS_OPCODE_daddiu:
119 case MIPS_OPCODE_addi:
120 case MIPS_OPCODE_daddi:
126 ASSERT (immediate % 4 == 0);
152 case MIPS_OPCODE_slti:
153 case MIPS_OPCODE_sltiu:
154 case MIPS_OPCODE_andi:
155 case MIPS_OPCODE_ori:
156 case MIPS_OPCODE_xori:
157 case MIPS_OPCODE_lui:
158 case MIPS_OPCODE_ldl:
159 case MIPS_OPCODE_ldr:
162 case MIPS_OPCODE_lwl:
164 case MIPS_OPCODE_lbu:
165 case MIPS_OPCODE_lhu:
166 case MIPS_OPCODE_lwr:
167 case MIPS_OPCODE_lwu:
174 case MIPS_OPCODE_SPECIAL:
182 case MIPS_SPECIAL_FUNCT_break:
183 case MIPS_SPECIAL_FUNCT_jr:
184 case MIPS_SPECIAL_FUNCT_sync:
185 case MIPS_SPECIAL_FUNCT_syscall:
186 case MIPS_SPECIAL_FUNCT_tge:
187 case MIPS_SPECIAL_FUNCT_tgeu:
188 case MIPS_SPECIAL_FUNCT_tlt:
189 case MIPS_SPECIAL_FUNCT_tltu:
190 case MIPS_SPECIAL_FUNCT_teq:
191 case MIPS_SPECIAL_FUNCT_tne:
206 if (i >= n_frames_to_skip)
207 callers[i - n_frames_to_skip] = saved_pc;
212 if (i < n_frames_to_skip)
215 return i - n_frames_to_skip;
219 #ifndef clib_backtrace_defined 220 #define clib_backtrace_defined 223 #include <execinfo.h> 231 n_frames_to_skip += 1;
235 size = backtrace (array, size);
239 for (i = 0; i < max_callers + n_frames_to_skip && i <
size; i++)
241 if (i >= n_frames_to_skip)
245 if (i < n_frames_to_skip)
248 return i - n_frames_to_skip;
static u32 mips_insn_get_rt(u32 insn)
uword clib_backtrace(uword *callers, uword max_callers, uword n_frames_to_skip)
static u32 mips_insn_get_funct(u32 insn)
static u32 mips_insn_get_rd(u32 insn)
static i32 mips_insn_get_immediate(u32 insn)
static u32 mips_insn_get_rs(u32 insn)
static mips_insn_opcode_t mips_insn_get_op(u32 insn)
#define uword_to_pointer(u, type)
mips_insn_special_funct_t
static uword pointer_to_uword(const void *p)