Lines Matching refs:ctrl

207 static unsigned long unwind_get_byte(struct unwind_ctrl_block *ctrl)  in unwind_get_byte()  argument
211 if (ctrl->entries <= 0) { in unwind_get_byte()
216 ret = (*ctrl->insn >> (ctrl->byte * 8)) & 0xff; in unwind_get_byte()
218 if (ctrl->byte == 0) { in unwind_get_byte()
219 ctrl->insn++; in unwind_get_byte()
220 ctrl->entries--; in unwind_get_byte()
221 ctrl->byte = 3; in unwind_get_byte()
223 ctrl->byte--; in unwind_get_byte()
229 static int unwind_pop_register(struct unwind_ctrl_block *ctrl, in unwind_pop_register() argument
232 if (unlikely(ctrl->check_each_pop)) in unwind_pop_register()
233 if (*vsp >= (unsigned long *)ctrl->sp_high) in unwind_pop_register()
239 ctrl->vrs[reg] = READ_ONCE_NOCHECK(*(*vsp)); in unwind_pop_register()
245 static int unwind_exec_pop_subset_r4_to_r13(struct unwind_ctrl_block *ctrl, in unwind_exec_pop_subset_r4_to_r13() argument
248 unsigned long *vsp = (unsigned long *)ctrl->vrs[SP]; in unwind_exec_pop_subset_r4_to_r13()
254 if (unwind_pop_register(ctrl, &vsp, reg)) in unwind_exec_pop_subset_r4_to_r13()
260 ctrl->vrs[SP] = (unsigned long)vsp; in unwind_exec_pop_subset_r4_to_r13()
265 static int unwind_exec_pop_r4_to_rN(struct unwind_ctrl_block *ctrl, in unwind_exec_pop_r4_to_rN() argument
268 unsigned long *vsp = (unsigned long *)ctrl->vrs[SP]; in unwind_exec_pop_r4_to_rN()
273 if (unwind_pop_register(ctrl, &vsp, reg)) in unwind_exec_pop_r4_to_rN()
277 if (unwind_pop_register(ctrl, &vsp, 14)) in unwind_exec_pop_r4_to_rN()
280 ctrl->vrs[SP] = (unsigned long)vsp; in unwind_exec_pop_r4_to_rN()
285 static int unwind_exec_pop_subset_r0_to_r3(struct unwind_ctrl_block *ctrl, in unwind_exec_pop_subset_r0_to_r3() argument
288 unsigned long *vsp = (unsigned long *)ctrl->vrs[SP]; in unwind_exec_pop_subset_r0_to_r3()
294 if (unwind_pop_register(ctrl, &vsp, reg)) in unwind_exec_pop_subset_r0_to_r3()
299 ctrl->vrs[SP] = (unsigned long)vsp; in unwind_exec_pop_subset_r0_to_r3()
307 static int unwind_exec_insn(struct unwind_ctrl_block *ctrl) in unwind_exec_insn() argument
309 unsigned long insn = unwind_get_byte(ctrl); in unwind_exec_insn()
315 ctrl->vrs[SP] += ((insn & 0x3f) << 2) + 4; in unwind_exec_insn()
317 ctrl->vrs[SP] -= ((insn & 0x3f) << 2) + 4; in unwind_exec_insn()
321 insn = (insn << 8) | unwind_get_byte(ctrl); in unwind_exec_insn()
329 ret = unwind_exec_pop_subset_r4_to_r13(ctrl, mask); in unwind_exec_insn()
334 ctrl->vrs[SP] = ctrl->vrs[insn & 0x0f]; in unwind_exec_insn()
336 ret = unwind_exec_pop_r4_to_rN(ctrl, insn); in unwind_exec_insn()
340 if (ctrl->vrs[PC] == 0) in unwind_exec_insn()
341 ctrl->vrs[PC] = ctrl->vrs[LR]; in unwind_exec_insn()
343 ctrl->entries = 0; in unwind_exec_insn()
345 unsigned long mask = unwind_get_byte(ctrl); in unwind_exec_insn()
353 ret = unwind_exec_pop_subset_r0_to_r3(ctrl, mask); in unwind_exec_insn()
357 unsigned long uleb128 = unwind_get_byte(ctrl); in unwind_exec_insn()
359 ctrl->vrs[SP] += 0x204 + (uleb128 << 2); in unwind_exec_insn()
366 ctrl->vrs[FP], ctrl->vrs[SP], ctrl->vrs[LR], ctrl->vrs[PC]); in unwind_exec_insn()
380 struct unwind_ctrl_block ctrl; in unwind_frame() local
384 ctrl.sp_high = ALIGN(low, THREAD_SIZE); in unwind_frame()
398 ctrl.vrs[FP] = frame->fp; in unwind_frame()
399 ctrl.vrs[SP] = frame->sp; in unwind_frame()
400 ctrl.vrs[LR] = frame->lr; in unwind_frame()
401 ctrl.vrs[PC] = 0; in unwind_frame()
408 ctrl.insn = (unsigned long *)prel31_to_addr(&idx->insn); in unwind_frame()
411 ctrl.insn = &idx->insn; in unwind_frame()
419 if ((*ctrl.insn & 0xff000000) == 0x80000000) { in unwind_frame()
420 ctrl.byte = 2; in unwind_frame()
421 ctrl.entries = 1; in unwind_frame()
422 } else if ((*ctrl.insn & 0xff000000) == 0x81000000) { in unwind_frame()
423 ctrl.byte = 1; in unwind_frame()
424 ctrl.entries = 1 + ((*ctrl.insn & 0x00ff0000) >> 16); in unwind_frame()
427 *ctrl.insn, ctrl.insn); in unwind_frame()
431 ctrl.check_each_pop = 0; in unwind_frame()
433 while (ctrl.entries > 0) { in unwind_frame()
435 if ((ctrl.sp_high - ctrl.vrs[SP]) < sizeof(ctrl.vrs)) in unwind_frame()
436 ctrl.check_each_pop = 1; in unwind_frame()
437 urc = unwind_exec_insn(&ctrl); in unwind_frame()
440 if (ctrl.vrs[SP] < low || ctrl.vrs[SP] >= ctrl.sp_high) in unwind_frame()
444 if (ctrl.vrs[PC] == 0) in unwind_frame()
445 ctrl.vrs[PC] = ctrl.vrs[LR]; in unwind_frame()
448 if (frame->pc == ctrl.vrs[PC] && frame->sp == ctrl.vrs[SP]) in unwind_frame()
451 frame->fp = ctrl.vrs[FP]; in unwind_frame()
452 frame->sp = ctrl.vrs[SP]; in unwind_frame()
453 frame->lr = ctrl.vrs[LR]; in unwind_frame()
454 frame->pc = ctrl.vrs[PC]; in unwind_frame()