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()
239 ctrl->vrs[reg] = *(*vsp)++; in unwind_pop_register()
244 static int unwind_exec_pop_subset_r4_to_r13(struct unwind_ctrl_block *ctrl, in unwind_exec_pop_subset_r4_to_r13() argument
247 unsigned long *vsp = (unsigned long *)ctrl->vrs[SP]; in unwind_exec_pop_subset_r4_to_r13()
253 if (unwind_pop_register(ctrl, &vsp, reg)) in unwind_exec_pop_subset_r4_to_r13()
259 ctrl->vrs[SP] = (unsigned long)vsp; in unwind_exec_pop_subset_r4_to_r13()
264 static int unwind_exec_pop_r4_to_rN(struct unwind_ctrl_block *ctrl, in unwind_exec_pop_r4_to_rN() argument
267 unsigned long *vsp = (unsigned long *)ctrl->vrs[SP]; in unwind_exec_pop_r4_to_rN()
272 if (unwind_pop_register(ctrl, &vsp, reg)) in unwind_exec_pop_r4_to_rN()
276 if (unwind_pop_register(ctrl, &vsp, 14)) in unwind_exec_pop_r4_to_rN()
279 ctrl->vrs[SP] = (unsigned long)vsp; in unwind_exec_pop_r4_to_rN()
284 static int unwind_exec_pop_subset_r0_to_r3(struct unwind_ctrl_block *ctrl, in unwind_exec_pop_subset_r0_to_r3() argument
287 unsigned long *vsp = (unsigned long *)ctrl->vrs[SP]; in unwind_exec_pop_subset_r0_to_r3()
293 if (unwind_pop_register(ctrl, &vsp, reg)) in unwind_exec_pop_subset_r0_to_r3()
298 ctrl->vrs[SP] = (unsigned long)vsp; in unwind_exec_pop_subset_r0_to_r3()
306 static int unwind_exec_insn(struct unwind_ctrl_block *ctrl) in unwind_exec_insn() argument
308 unsigned long insn = unwind_get_byte(ctrl); in unwind_exec_insn()
314 ctrl->vrs[SP] += ((insn & 0x3f) << 2) + 4; in unwind_exec_insn()
316 ctrl->vrs[SP] -= ((insn & 0x3f) << 2) + 4; in unwind_exec_insn()
320 insn = (insn << 8) | unwind_get_byte(ctrl); in unwind_exec_insn()
328 ret = unwind_exec_pop_subset_r4_to_r13(ctrl, mask); in unwind_exec_insn()
333 ctrl->vrs[SP] = ctrl->vrs[insn & 0x0f]; in unwind_exec_insn()
335 ret = unwind_exec_pop_r4_to_rN(ctrl, insn); in unwind_exec_insn()
339 if (ctrl->vrs[PC] == 0) in unwind_exec_insn()
340 ctrl->vrs[PC] = ctrl->vrs[LR]; in unwind_exec_insn()
342 ctrl->entries = 0; in unwind_exec_insn()
344 unsigned long mask = unwind_get_byte(ctrl); in unwind_exec_insn()
352 ret = unwind_exec_pop_subset_r0_to_r3(ctrl, mask); in unwind_exec_insn()
356 unsigned long uleb128 = unwind_get_byte(ctrl); in unwind_exec_insn()
358 ctrl->vrs[SP] += 0x204 + (uleb128 << 2); in unwind_exec_insn()
365 ctrl->vrs[FP], ctrl->vrs[SP], ctrl->vrs[LR], ctrl->vrs[PC]); in unwind_exec_insn()
379 struct unwind_ctrl_block ctrl; in unwind_frame() local
383 ctrl.sp_high = ALIGN(low, THREAD_SIZE); in unwind_frame()
397 ctrl.vrs[FP] = frame->fp; in unwind_frame()
398 ctrl.vrs[SP] = frame->sp; in unwind_frame()
399 ctrl.vrs[LR] = frame->lr; in unwind_frame()
400 ctrl.vrs[PC] = 0; in unwind_frame()
407 ctrl.insn = (unsigned long *)prel31_to_addr(&idx->insn); in unwind_frame()
410 ctrl.insn = &idx->insn; in unwind_frame()
418 if ((*ctrl.insn & 0xff000000) == 0x80000000) { in unwind_frame()
419 ctrl.byte = 2; in unwind_frame()
420 ctrl.entries = 1; in unwind_frame()
421 } else if ((*ctrl.insn & 0xff000000) == 0x81000000) { in unwind_frame()
422 ctrl.byte = 1; in unwind_frame()
423 ctrl.entries = 1 + ((*ctrl.insn & 0x00ff0000) >> 16); in unwind_frame()
426 *ctrl.insn, ctrl.insn); in unwind_frame()
430 ctrl.check_each_pop = 0; in unwind_frame()
432 while (ctrl.entries > 0) { in unwind_frame()
434 if ((ctrl.sp_high - ctrl.vrs[SP]) < sizeof(ctrl.vrs)) in unwind_frame()
435 ctrl.check_each_pop = 1; in unwind_frame()
436 urc = unwind_exec_insn(&ctrl); in unwind_frame()
439 if (ctrl.vrs[SP] < low || ctrl.vrs[SP] >= ctrl.sp_high) in unwind_frame()
443 if (ctrl.vrs[PC] == 0) in unwind_frame()
444 ctrl.vrs[PC] = ctrl.vrs[LR]; in unwind_frame()
447 if (frame->pc == ctrl.vrs[PC] && frame->sp == ctrl.vrs[SP]) in unwind_frame()
450 frame->fp = ctrl.vrs[FP]; in unwind_frame()
451 frame->sp = ctrl.vrs[SP]; in unwind_frame()
452 frame->lr = ctrl.vrs[LR]; in unwind_frame()
453 frame->pc = ctrl.vrs[PC]; in unwind_frame()