Lines Matching refs:ctrl

223 static unsigned long unwind_get_byte(struct unwind_ctrl_block *ctrl)  in unwind_get_byte()  argument
227 if (ctrl->entries <= 0) { in unwind_get_byte()
232 ret = (*ctrl->insn >> (ctrl->byte * 8)) & 0xff; in unwind_get_byte()
234 if (ctrl->byte == 0) { in unwind_get_byte()
235 ctrl->insn++; in unwind_get_byte()
236 ctrl->entries--; in unwind_get_byte()
237 ctrl->byte = 3; in unwind_get_byte()
239 ctrl->byte--; in unwind_get_byte()
245 static int unwind_pop_register(struct unwind_ctrl_block *ctrl, in unwind_pop_register() argument
248 if (unlikely(ctrl->check_each_pop)) in unwind_pop_register()
249 if (*vsp >= (unsigned long *)ctrl->sp_high) in unwind_pop_register()
252 ctrl->vrs[reg] = *(*vsp)++; in unwind_pop_register()
257 static int unwind_exec_pop_subset_r4_to_r13(struct unwind_ctrl_block *ctrl, in unwind_exec_pop_subset_r4_to_r13() argument
260 unsigned long *vsp = (unsigned long *)ctrl->vrs[SP]; in unwind_exec_pop_subset_r4_to_r13()
266 if (unwind_pop_register(ctrl, &vsp, reg)) in unwind_exec_pop_subset_r4_to_r13()
272 ctrl->vrs[SP] = (unsigned long)vsp; in unwind_exec_pop_subset_r4_to_r13()
277 static int unwind_exec_pop_r4_to_rN(struct unwind_ctrl_block *ctrl, in unwind_exec_pop_r4_to_rN() argument
280 unsigned long *vsp = (unsigned long *)ctrl->vrs[SP]; in unwind_exec_pop_r4_to_rN()
285 if (unwind_pop_register(ctrl, &vsp, reg)) in unwind_exec_pop_r4_to_rN()
289 if (unwind_pop_register(ctrl, &vsp, 14)) in unwind_exec_pop_r4_to_rN()
292 ctrl->vrs[SP] = (unsigned long)vsp; in unwind_exec_pop_r4_to_rN()
297 static int unwind_exec_pop_subset_r0_to_r3(struct unwind_ctrl_block *ctrl, in unwind_exec_pop_subset_r0_to_r3() argument
300 unsigned long *vsp = (unsigned long *)ctrl->vrs[SP]; in unwind_exec_pop_subset_r0_to_r3()
306 if (unwind_pop_register(ctrl, &vsp, reg)) in unwind_exec_pop_subset_r0_to_r3()
311 ctrl->vrs[SP] = (unsigned long)vsp; in unwind_exec_pop_subset_r0_to_r3()
319 static int unwind_exec_insn(struct unwind_ctrl_block *ctrl) in unwind_exec_insn() argument
321 unsigned long insn = unwind_get_byte(ctrl); in unwind_exec_insn()
327 ctrl->vrs[SP] += ((insn & 0x3f) << 2) + 4; in unwind_exec_insn()
329 ctrl->vrs[SP] -= ((insn & 0x3f) << 2) + 4; in unwind_exec_insn()
333 insn = (insn << 8) | unwind_get_byte(ctrl); in unwind_exec_insn()
341 ret = unwind_exec_pop_subset_r4_to_r13(ctrl, mask); in unwind_exec_insn()
346 ctrl->vrs[SP] = ctrl->vrs[insn & 0x0f]; in unwind_exec_insn()
348 ret = unwind_exec_pop_r4_to_rN(ctrl, insn); in unwind_exec_insn()
352 if (ctrl->vrs[PC] == 0) in unwind_exec_insn()
353 ctrl->vrs[PC] = ctrl->vrs[LR]; in unwind_exec_insn()
355 ctrl->entries = 0; in unwind_exec_insn()
357 unsigned long mask = unwind_get_byte(ctrl); in unwind_exec_insn()
365 ret = unwind_exec_pop_subset_r0_to_r3(ctrl, mask); in unwind_exec_insn()
369 unsigned long uleb128 = unwind_get_byte(ctrl); in unwind_exec_insn()
371 ctrl->vrs[SP] += 0x204 + (uleb128 << 2); in unwind_exec_insn()
378 ctrl->vrs[FP], ctrl->vrs[SP], ctrl->vrs[LR], ctrl->vrs[PC]); in unwind_exec_insn()
392 struct unwind_ctrl_block ctrl; in unwind_frame() local
396 ctrl.sp_high = ALIGN(low, THREAD_SIZE); in unwind_frame()
410 ctrl.vrs[FP] = frame->fp; in unwind_frame()
411 ctrl.vrs[SP] = frame->sp; in unwind_frame()
412 ctrl.vrs[LR] = frame->lr; in unwind_frame()
413 ctrl.vrs[PC] = 0; in unwind_frame()
420 ctrl.insn = (unsigned long *)prel31_to_addr(&idx->insn); in unwind_frame()
423 ctrl.insn = &idx->insn; in unwind_frame()
431 if ((*ctrl.insn & 0xff000000) == 0x80000000) { in unwind_frame()
432 ctrl.byte = 2; in unwind_frame()
433 ctrl.entries = 1; in unwind_frame()
434 } else if ((*ctrl.insn & 0xff000000) == 0x81000000) { in unwind_frame()
435 ctrl.byte = 1; in unwind_frame()
436 ctrl.entries = 1 + ((*ctrl.insn & 0x00ff0000) >> 16); in unwind_frame()
439 *ctrl.insn, ctrl.insn); in unwind_frame()
443 ctrl.check_each_pop = 0; in unwind_frame()
445 while (ctrl.entries > 0) { in unwind_frame()
447 if ((ctrl.sp_high - ctrl.vrs[SP]) < sizeof(ctrl.vrs)) in unwind_frame()
448 ctrl.check_each_pop = 1; in unwind_frame()
449 urc = unwind_exec_insn(&ctrl); in unwind_frame()
452 if (ctrl.vrs[SP] < low || ctrl.vrs[SP] >= ctrl.sp_high) in unwind_frame()
456 if (ctrl.vrs[PC] == 0) in unwind_frame()
457 ctrl.vrs[PC] = ctrl.vrs[LR]; in unwind_frame()
460 if (frame->pc == ctrl.vrs[PC]) in unwind_frame()
463 frame->fp = ctrl.vrs[FP]; in unwind_frame()
464 frame->sp = ctrl.vrs[SP]; in unwind_frame()
465 frame->lr = ctrl.vrs[LR]; in unwind_frame()
466 frame->pc = ctrl.vrs[PC]; in unwind_frame()