44 #define clib_backtrace_defined 51 uword n_frames_to_skip)
58 asm volatile (
".set push\n" 60 "move %[saved_pc], $31\n" 69 [saved_pc]
"=r" (saved_pc),
73 n_frames_to_skip += 1;
75 for (i = 0; i < max_callers + n_frames_to_skip; i++)
79 i32 insn, rs, rt, rd, immediate, found_saved_pc;
106 void * addr = sp + immediate;
113 ASSERT (immediate % 4 == 0);
114 if (op == MIPS_OPCODE_sw)
115 saved_pc = ((
u32 *) addr)[0];
117 saved_pc = ((
u64 *) addr)[0];
122 case MIPS_OPCODE_addiu:
123 case MIPS_OPCODE_daddiu:
124 case MIPS_OPCODE_addi:
125 case MIPS_OPCODE_daddi:
131 ASSERT (immediate % 4 == 0);
157 case MIPS_OPCODE_slti:
158 case MIPS_OPCODE_sltiu:
159 case MIPS_OPCODE_andi:
160 case MIPS_OPCODE_ori:
161 case MIPS_OPCODE_xori:
162 case MIPS_OPCODE_lui:
163 case MIPS_OPCODE_ldl:
164 case MIPS_OPCODE_ldr:
167 case MIPS_OPCODE_lwl:
169 case MIPS_OPCODE_lbu:
170 case MIPS_OPCODE_lhu:
171 case MIPS_OPCODE_lwr:
172 case MIPS_OPCODE_lwu:
179 case MIPS_OPCODE_SPECIAL:
186 case MIPS_SPECIAL_FUNCT_break:
187 case MIPS_SPECIAL_FUNCT_jr:
188 case MIPS_SPECIAL_FUNCT_sync:
189 case MIPS_SPECIAL_FUNCT_syscall:
190 case MIPS_SPECIAL_FUNCT_tge:
191 case MIPS_SPECIAL_FUNCT_tgeu:
192 case MIPS_SPECIAL_FUNCT_tlt:
193 case MIPS_SPECIAL_FUNCT_tltu:
194 case MIPS_SPECIAL_FUNCT_teq:
195 case MIPS_SPECIAL_FUNCT_tne:
210 if (i >= n_frames_to_skip)
211 callers[i - n_frames_to_skip] = saved_pc;
216 if (i < n_frames_to_skip)
219 return i - n_frames_to_skip;
223 #ifndef clib_backtrace_defined 224 #define clib_backtrace_defined 237 uword n_frames_to_skip)
242 f = __builtin_frame_address (0);
245 n_frames_to_skip += 1;
247 for (i = 0; i < max_callers + n_frames_to_skip; i++)
252 if (
clib_abs ((
void *) f - (
void *) f->
prev) > (64*1024))
254 if (i >= n_frames_to_skip)
259 if (i < n_frames_to_skip)
262 return i - n_frames_to_skip;
sll srl srl sll sra u16x4 i
struct clib_generic_stack_frame_t clib_generic_stack_frame_t
uword clib_backtrace(uword *callers, uword max_callers, uword n_frames_to_skip)
always_inline u32 mips_insn_get_funct(u32 insn)
always_inline u32 mips_insn_get_rs(u32 insn)
struct clib_generic_stack_frame_t * prev
always_inline mips_insn_opcode_t mips_insn_get_op(u32 insn)
static uword pointer_to_uword(const void *p)
always_inline u32 mips_insn_get_rt(u32 insn)
#define uword_to_pointer(u, type)
mips_insn_special_funct_t
always_inline i32 mips_insn_get_immediate(u32 insn)
always_inline u32 mips_insn_get_rd(u32 insn)