Lines Matching refs:ctrl

210 static unsigned long unwind_get_byte(struct unwind_ctrl_block *ctrl)  in unwind_get_byte()  argument
214 if (ctrl->entries <= 0) { in unwind_get_byte()
219 ret = (*ctrl->insn >> (ctrl->byte * 8)) & 0xff; in unwind_get_byte()
221 if (ctrl->byte == 0) { in unwind_get_byte()
222 ctrl->insn++; in unwind_get_byte()
223 ctrl->entries--; in unwind_get_byte()
224 ctrl->byte = 3; in unwind_get_byte()
226 ctrl->byte--; in unwind_get_byte()
232 static int unwind_pop_register(struct unwind_ctrl_block *ctrl, in unwind_pop_register() argument
235 if (unlikely(ctrl->check_each_pop)) in unwind_pop_register()
236 if (*vsp >= (unsigned long *)ctrl->sp_high) in unwind_pop_register()
242 ctrl->vrs[reg] = READ_ONCE_NOCHECK(*(*vsp)); in unwind_pop_register()
244 ctrl->lr_addr = *vsp; in unwind_pop_register()
250 static int unwind_exec_pop_subset_r4_to_r13(struct unwind_ctrl_block *ctrl, in unwind_exec_pop_subset_r4_to_r13() argument
253 unsigned long *vsp = (unsigned long *)ctrl->vrs[SP]; in unwind_exec_pop_subset_r4_to_r13()
259 if (unwind_pop_register(ctrl, &vsp, reg)) in unwind_exec_pop_subset_r4_to_r13()
265 ctrl->vrs[SP] = (unsigned long)vsp; in unwind_exec_pop_subset_r4_to_r13()
271 static int unwind_exec_pop_r4_to_rN(struct unwind_ctrl_block *ctrl, in unwind_exec_pop_r4_to_rN() argument
274 unsigned long *vsp = (unsigned long *)ctrl->vrs[SP]; in unwind_exec_pop_r4_to_rN()
279 if (unwind_pop_register(ctrl, &vsp, reg)) in unwind_exec_pop_r4_to_rN()
283 if (unwind_pop_register(ctrl, &vsp, 14)) in unwind_exec_pop_r4_to_rN()
286 ctrl->vrs[SP] = (unsigned long)vsp; in unwind_exec_pop_r4_to_rN()
291 static int unwind_exec_pop_subset_r0_to_r3(struct unwind_ctrl_block *ctrl, in unwind_exec_pop_subset_r0_to_r3() argument
294 unsigned long *vsp = (unsigned long *)ctrl->vrs[SP]; in unwind_exec_pop_subset_r0_to_r3()
300 if (unwind_pop_register(ctrl, &vsp, reg)) in unwind_exec_pop_subset_r0_to_r3()
305 ctrl->vrs[SP] = (unsigned long)vsp; in unwind_exec_pop_subset_r0_to_r3()
313 static int unwind_exec_insn(struct unwind_ctrl_block *ctrl) in unwind_exec_insn() argument
315 unsigned long insn = unwind_get_byte(ctrl); in unwind_exec_insn()
321 ctrl->vrs[SP] += ((insn & 0x3f) << 2) + 4; in unwind_exec_insn()
323 ctrl->vrs[SP] -= ((insn & 0x3f) << 2) + 4; in unwind_exec_insn()
327 insn = (insn << 8) | unwind_get_byte(ctrl); in unwind_exec_insn()
335 ret = unwind_exec_pop_subset_r4_to_r13(ctrl, mask); in unwind_exec_insn()
340 ctrl->vrs[SP] = ctrl->vrs[insn & 0x0f]; in unwind_exec_insn()
342 ret = unwind_exec_pop_r4_to_rN(ctrl, insn); in unwind_exec_insn()
346 if (ctrl->vrs[PC] == 0) in unwind_exec_insn()
347 ctrl->vrs[PC] = ctrl->vrs[LR]; in unwind_exec_insn()
349 ctrl->entries = 0; in unwind_exec_insn()
351 unsigned long mask = unwind_get_byte(ctrl); in unwind_exec_insn()
359 ret = unwind_exec_pop_subset_r0_to_r3(ctrl, mask); in unwind_exec_insn()
363 unsigned long uleb128 = unwind_get_byte(ctrl); in unwind_exec_insn()
365 ctrl->vrs[SP] += 0x204 + (uleb128 << 2); in unwind_exec_insn()
372 ctrl->vrs[FP], ctrl->vrs[SP], ctrl->vrs[LR], ctrl->vrs[PC]); in unwind_exec_insn()
385 struct unwind_ctrl_block ctrl; in unwind_frame() local
390 ctrl.sp_high = ALIGN(sp_low - THREAD_SIZE, THREAD_ALIGN) in unwind_frame()
403 ctrl.vrs[FP] = frame->fp; in unwind_frame()
404 ctrl.vrs[SP] = frame->sp; in unwind_frame()
405 ctrl.vrs[LR] = frame->lr; in unwind_frame()
406 ctrl.vrs[PC] = 0; in unwind_frame()
426 ctrl.insn = (unsigned long *)prel31_to_addr(&idx->insn); in unwind_frame()
429 ctrl.insn = &idx->insn; in unwind_frame()
437 if ((*ctrl.insn & 0xff000000) == 0x80000000) { in unwind_frame()
438 ctrl.byte = 2; in unwind_frame()
439 ctrl.entries = 1; in unwind_frame()
440 } else if ((*ctrl.insn & 0xff000000) == 0x81000000) { in unwind_frame()
441 ctrl.byte = 1; in unwind_frame()
442 ctrl.entries = 1 + ((*ctrl.insn & 0x00ff0000) >> 16); in unwind_frame()
445 *ctrl.insn, ctrl.insn); in unwind_frame()
449 ctrl.check_each_pop = 0; in unwind_frame()
458 ctrl.sp_high = ALIGN(frame->fp, THREAD_SIZE); in unwind_frame()
461 while (ctrl.entries > 0) { in unwind_frame()
463 if ((ctrl.sp_high - ctrl.vrs[SP]) < sizeof(ctrl.vrs)) in unwind_frame()
464 ctrl.check_each_pop = 1; in unwind_frame()
465 urc = unwind_exec_insn(&ctrl); in unwind_frame()
468 if (ctrl.vrs[SP] < sp_low || ctrl.vrs[SP] > ctrl.sp_high) in unwind_frame()
472 if (ctrl.vrs[PC] == 0) in unwind_frame()
473 ctrl.vrs[PC] = ctrl.vrs[LR]; in unwind_frame()
476 if (frame->pc == ctrl.vrs[PC] && frame->sp == ctrl.vrs[SP]) in unwind_frame()
479 frame->fp = ctrl.vrs[FP]; in unwind_frame()
480 frame->sp = ctrl.vrs[SP]; in unwind_frame()
481 frame->lr = ctrl.vrs[LR]; in unwind_frame()
482 frame->pc = ctrl.vrs[PC]; in unwind_frame()
483 frame->lr_addr = ctrl.lr_addr; in unwind_frame()