Lines Matching refs:ctrl
211 static unsigned long unwind_get_byte(struct unwind_ctrl_block *ctrl) in unwind_get_byte() argument
215 if (ctrl->entries <= 0) { in unwind_get_byte()
220 ret = (*ctrl->insn >> (ctrl->byte * 8)) & 0xff; in unwind_get_byte()
222 if (ctrl->byte == 0) { in unwind_get_byte()
223 ctrl->insn++; in unwind_get_byte()
224 ctrl->entries--; in unwind_get_byte()
225 ctrl->byte = 3; in unwind_get_byte()
227 ctrl->byte--; in unwind_get_byte()
233 static int unwind_pop_register(struct unwind_ctrl_block *ctrl, in unwind_pop_register() argument
236 if (unlikely(ctrl->check_each_pop)) in unwind_pop_register()
237 if (*vsp >= (unsigned long *)ctrl->sp_high) in unwind_pop_register()
243 ctrl->vrs[reg] = READ_ONCE_NOCHECK(*(*vsp)); in unwind_pop_register()
245 ctrl->lr_addr = *vsp; in unwind_pop_register()
251 static int unwind_exec_pop_subset_r4_to_r13(struct unwind_ctrl_block *ctrl, in unwind_exec_pop_subset_r4_to_r13() argument
254 unsigned long *vsp = (unsigned long *)ctrl->vrs[SP]; in unwind_exec_pop_subset_r4_to_r13()
260 if (unwind_pop_register(ctrl, &vsp, reg)) in unwind_exec_pop_subset_r4_to_r13()
266 ctrl->vrs[SP] = (unsigned long)vsp; in unwind_exec_pop_subset_r4_to_r13()
272 static int unwind_exec_pop_r4_to_rN(struct unwind_ctrl_block *ctrl, in unwind_exec_pop_r4_to_rN() argument
275 unsigned long *vsp = (unsigned long *)ctrl->vrs[SP]; in unwind_exec_pop_r4_to_rN()
280 if (unwind_pop_register(ctrl, &vsp, reg)) in unwind_exec_pop_r4_to_rN()
284 if (unwind_pop_register(ctrl, &vsp, 14)) in unwind_exec_pop_r4_to_rN()
287 ctrl->vrs[SP] = (unsigned long)vsp; in unwind_exec_pop_r4_to_rN()
292 static int unwind_exec_pop_subset_r0_to_r3(struct unwind_ctrl_block *ctrl, in unwind_exec_pop_subset_r0_to_r3() argument
295 unsigned long *vsp = (unsigned long *)ctrl->vrs[SP]; in unwind_exec_pop_subset_r0_to_r3()
301 if (unwind_pop_register(ctrl, &vsp, reg)) in unwind_exec_pop_subset_r0_to_r3()
306 ctrl->vrs[SP] = (unsigned long)vsp; in unwind_exec_pop_subset_r0_to_r3()
311 static unsigned long unwind_decode_uleb128(struct unwind_ctrl_block *ctrl) in unwind_decode_uleb128() argument
326 insn = unwind_get_byte(ctrl); in unwind_decode_uleb128()
337 static int unwind_exec_insn(struct unwind_ctrl_block *ctrl) in unwind_exec_insn() argument
339 unsigned long insn = unwind_get_byte(ctrl); in unwind_exec_insn()
345 ctrl->vrs[SP] += ((insn & 0x3f) << 2) + 4; in unwind_exec_insn()
347 ctrl->vrs[SP] -= ((insn & 0x3f) << 2) + 4; in unwind_exec_insn()
351 insn = (insn << 8) | unwind_get_byte(ctrl); in unwind_exec_insn()
359 ret = unwind_exec_pop_subset_r4_to_r13(ctrl, mask); in unwind_exec_insn()
364 ctrl->vrs[SP] = ctrl->vrs[insn & 0x0f]; in unwind_exec_insn()
366 ret = unwind_exec_pop_r4_to_rN(ctrl, insn); in unwind_exec_insn()
370 if (ctrl->vrs[PC] == 0) in unwind_exec_insn()
371 ctrl->vrs[PC] = ctrl->vrs[LR]; in unwind_exec_insn()
373 ctrl->entries = 0; in unwind_exec_insn()
375 unsigned long mask = unwind_get_byte(ctrl); in unwind_exec_insn()
383 ret = unwind_exec_pop_subset_r0_to_r3(ctrl, mask); in unwind_exec_insn()
387 unsigned long uleb128 = unwind_decode_uleb128(ctrl); in unwind_exec_insn()
389 ctrl->vrs[SP] += 0x204 + (uleb128 << 2); in unwind_exec_insn()
396 ctrl->vrs[FP], ctrl->vrs[SP], ctrl->vrs[LR], ctrl->vrs[PC]); in unwind_exec_insn()
409 struct unwind_ctrl_block ctrl; in unwind_frame() local
414 ctrl.sp_high = ALIGN(sp_low - THREAD_SIZE, THREAD_ALIGN) in unwind_frame()
437 ctrl.vrs[FP] = frame->fp; in unwind_frame()
438 ctrl.vrs[SP] = frame->sp; in unwind_frame()
439 ctrl.vrs[LR] = frame->lr; in unwind_frame()
440 ctrl.vrs[PC] = 0; in unwind_frame()
460 ctrl.insn = (unsigned long *)prel31_to_addr(&idx->insn); in unwind_frame()
463 ctrl.insn = &idx->insn; in unwind_frame()
471 if ((*ctrl.insn & 0xff000000) == 0x80000000) { in unwind_frame()
472 ctrl.byte = 2; in unwind_frame()
473 ctrl.entries = 1; in unwind_frame()
474 } else if ((*ctrl.insn & 0xff000000) == 0x81000000) { in unwind_frame()
475 ctrl.byte = 1; in unwind_frame()
476 ctrl.entries = 1 + ((*ctrl.insn & 0x00ff0000) >> 16); in unwind_frame()
479 *ctrl.insn, ctrl.insn); in unwind_frame()
483 ctrl.check_each_pop = 0; in unwind_frame()
492 ctrl.sp_high = ALIGN(frame->fp, THREAD_SIZE); in unwind_frame()
495 while (ctrl.entries > 0) { in unwind_frame()
497 if ((ctrl.sp_high - ctrl.vrs[SP]) < sizeof(ctrl.vrs)) in unwind_frame()
498 ctrl.check_each_pop = 1; in unwind_frame()
499 urc = unwind_exec_insn(&ctrl); in unwind_frame()
502 if (ctrl.vrs[SP] < sp_low || ctrl.vrs[SP] > ctrl.sp_high) in unwind_frame()
506 if (ctrl.vrs[PC] == 0) in unwind_frame()
507 ctrl.vrs[PC] = ctrl.vrs[LR]; in unwind_frame()
510 if (frame->pc == ctrl.vrs[PC] && frame->sp == ctrl.vrs[SP]) in unwind_frame()
513 frame->fp = ctrl.vrs[FP]; in unwind_frame()
514 frame->sp = ctrl.vrs[SP]; in unwind_frame()
515 frame->lr = ctrl.vrs[LR]; in unwind_frame()
516 frame->pc = ctrl.vrs[PC]; in unwind_frame()
517 frame->lr_addr = ctrl.lr_addr; in unwind_frame()