Lines Matching refs:sr
30 struct ia64_state_record *sr,
43 push (struct ia64_state_record *sr) in push() argument
53 memcpy (rs, &sr->curr, sizeof (*rs)); in push()
54 sr->curr.next = rs; in push()
58 pop (struct ia64_state_record *sr) in pop() argument
60 struct ia64_reg_state *rs = sr->curr.next; in pop()
67 memcpy (&sr->curr, rs, sizeof (*rs)); in pop()
200 finish_prologue (struct ia64_state_record *sr) in finish_prologue() argument
210 reg = sr->curr.reg + unw.save_order[i]; in finish_prologue()
214 reg->val = sr->gr_save_loc++; in finish_prologue()
222 if (sr->imask) in finish_prologue()
224 unsigned char kind, mask = 0, *cp = sr->imask; in finish_prologue()
232 regs[0] = sr->curr.reg + IA64_REG_F2; in finish_prologue()
233 regs[1] = sr->curr.reg + IA64_REG_R4; in finish_prologue()
234 regs[2] = sr->curr.reg + IA64_REG_B1; in finish_prologue()
236 for (t = 0; (int) t < sr->region_len; ++t) in finish_prologue()
242 spill_next_when (®s[kind - 1], sr->curr.reg + limit[kind - 1], in finish_prologue()
243 sr->region_start + t); in finish_prologue()
249 if (sr->any_spills) in finish_prologue()
251 off = sr->spill_offset; in finish_prologue()
252 alloc_spill_area (&off, 16, sr->curr.reg + IA64_REG_F2, in finish_prologue()
253 sr->curr.reg + IA64_REG_F31); in finish_prologue()
254 alloc_spill_area (&off, 8, sr->curr.reg + IA64_REG_B1, in finish_prologue()
255 sr->curr.reg + IA64_REG_B5); in finish_prologue()
256 alloc_spill_area (&off, 8, sr->curr.reg + IA64_REG_R4, in finish_prologue()
257 sr->curr.reg + IA64_REG_R7); in finish_prologue()
265 unsigned char grsave, struct ia64_state_record *sr) in desc_prologue() argument
269 if (!(sr->in_body || sr->first_region)) in desc_prologue()
270 finish_prologue (sr); in desc_prologue()
271 sr->first_region = 0; in desc_prologue()
274 if (sr->when_target < sr->region_start + sr->region_len) in desc_prologue()
276 sr->done = 1; in desc_prologue()
280 region_start = sr->region_start + sr->region_len; in desc_prologue()
282 for (i = 0; i < sr->epilogue_count; ++i) in desc_prologue()
283 pop (sr); in desc_prologue()
284 sr->epilogue_count = 0; in desc_prologue()
285 sr->when_sp_restored = IA64_WHEN_NEVER; in desc_prologue()
287 sr->region_start = region_start; in desc_prologue()
288 sr->region_len = rlen; in desc_prologue()
289 sr->in_body = body; in desc_prologue()
293 push (sr); in desc_prologue()
299 set_reg (sr->curr.reg + unw.save_order[i], IA64_WHERE_GR, in desc_prologue()
300 sr->region_start + sr->region_len - 1, grsave++); in desc_prologue()
303 sr->gr_save_loc = grsave; in desc_prologue()
304 sr->any_spills = 0; in desc_prologue()
305 sr->imask = 0; in desc_prologue()
306 sr->spill_offset = 0x10; /* default to psp+16 */ in desc_prologue()
314 struct ia64_state_record *sr) in desc_abi() argument
316 sr->abi_marker = (abi << 8) | context; in desc_abi()
321 struct ia64_state_record *sr) in desc_br_gr() argument
328 set_reg (sr->curr.reg + IA64_REG_B1 + i, IA64_WHERE_GR, in desc_br_gr()
329 sr->region_start + sr->region_len - 1, gr++); in desc_br_gr()
335 desc_br_mem (unsigned char brmask, struct ia64_state_record *sr) in desc_br_mem() argument
343 set_reg (sr->curr.reg + IA64_REG_B1 + i, IA64_WHERE_SPILL_HOME, in desc_br_mem()
344 sr->region_start + sr->region_len - 1, 0); in desc_br_mem()
345 sr->any_spills = 1; in desc_br_mem()
353 struct ia64_state_record *sr) in desc_frgr_mem() argument
361 set_reg (sr->curr.reg + IA64_REG_R4 + i, IA64_WHERE_SPILL_HOME, in desc_frgr_mem()
362 sr->region_start + sr->region_len - 1, 0); in desc_frgr_mem()
363 sr->any_spills = 1; in desc_frgr_mem()
372 set_reg (sr->curr.reg + base + i, IA64_WHERE_SPILL_HOME, in desc_frgr_mem()
373 sr->region_start + sr->region_len - 1, 0); in desc_frgr_mem()
374 sr->any_spills = 1; in desc_frgr_mem()
381 desc_fr_mem (unsigned char frmask, struct ia64_state_record *sr) in desc_fr_mem() argument
389 set_reg (sr->curr.reg + IA64_REG_F2 + i, IA64_WHERE_SPILL_HOME, in desc_fr_mem()
390 sr->region_start + sr->region_len - 1, 0); in desc_fr_mem()
391 sr->any_spills = 1; in desc_fr_mem()
399 struct ia64_state_record *sr) in desc_gr_gr() argument
406 set_reg (sr->curr.reg + IA64_REG_R4 + i, IA64_WHERE_GR, in desc_gr_gr()
407 sr->region_start + sr->region_len - 1, gr++); in desc_gr_gr()
413 desc_gr_mem (unsigned char grmask, struct ia64_state_record *sr) in desc_gr_mem() argument
421 set_reg (sr->curr.reg + IA64_REG_R4 + i, IA64_WHERE_SPILL_HOME, in desc_gr_mem()
422 sr->region_start + sr->region_len - 1, 0); in desc_gr_mem()
423 sr->any_spills = 1; in desc_gr_mem()
430 desc_mem_stack_f (unw_word t, unw_word size, struct ia64_state_record *sr) in desc_mem_stack_f() argument
432 set_reg (sr->curr.reg + IA64_REG_PSP, IA64_WHERE_NONE, in desc_mem_stack_f()
433 sr->region_start + MIN ((int) t, sr->region_len - 1), 16 * size); in desc_mem_stack_f()
437 desc_mem_stack_v (unw_word t, struct ia64_state_record *sr) in desc_mem_stack_v() argument
439 sr->curr.reg[IA64_REG_PSP].when = in desc_mem_stack_v()
440 sr->region_start + MIN ((int) t, sr->region_len - 1); in desc_mem_stack_v()
445 struct ia64_state_record *sr) in desc_reg_gr() argument
447 set_reg (sr->curr.reg + reg, IA64_WHERE_GR, in desc_reg_gr()
448 sr->region_start + sr->region_len - 1, dst); in desc_reg_gr()
453 struct ia64_state_record *sr) in desc_reg_psprel() argument
455 set_reg (sr->curr.reg + reg, IA64_WHERE_PSPREL, in desc_reg_psprel()
456 sr->region_start + sr->region_len - 1, 0x10 - 4 * pspoff); in desc_reg_psprel()
461 struct ia64_state_record *sr) in desc_reg_sprel() argument
463 set_reg (sr->curr.reg + reg, IA64_WHERE_SPREL, in desc_reg_sprel()
464 sr->region_start + sr->region_len - 1, 4 * spoff); in desc_reg_sprel()
468 desc_rp_br (unsigned char dst, struct ia64_state_record *sr) in desc_rp_br() argument
470 sr->return_link_reg = dst; in desc_rp_br()
474 desc_reg_when (unsigned char regnum, unw_word t, struct ia64_state_record *sr) in desc_reg_when() argument
476 struct ia64_reg_info *reg = sr->curr.reg + regnum; in desc_reg_when()
480 reg->when = sr->region_start + MIN ((int) t, sr->region_len - 1); in desc_reg_when()
484 desc_spill_base (unw_word pspoff, struct ia64_state_record *sr) in desc_spill_base() argument
486 sr->spill_offset = 0x10 - 4 * pspoff; in desc_spill_base()
490 desc_spill_mask (unsigned char *imaskp, struct ia64_state_record *sr) in desc_spill_mask() argument
492 sr->imask = imaskp; in desc_spill_mask()
493 return imaskp + (2 * sr->region_len + 7) / 8; in desc_spill_mask()
499 desc_epilogue (unw_word t, unw_word ecount, struct ia64_state_record *sr) in desc_epilogue() argument
501 sr->when_sp_restored = sr->region_start + sr->region_len - 1 - t; in desc_epilogue()
502 sr->epilogue_count = ecount + 1; in desc_epilogue()
506 desc_copy_state (unw_word label, struct ia64_state_record *sr) in desc_copy_state() argument
510 for (ls = sr->labeled_states; ls; ls = ls->next) in desc_copy_state()
514 free_state_stack (&sr->curr); in desc_copy_state()
515 memcpy (&sr->curr, &ls->saved_state, sizeof (sr->curr)); in desc_copy_state()
516 sr->curr.next = dup_state_stack (ls->saved_state.next); in desc_copy_state()
524 desc_label_state (unw_word label, struct ia64_state_record *sr) in desc_label_state() argument
535 memcpy (&ls->saved_state, &sr->curr, sizeof (ls->saved_state)); in desc_label_state()
536 ls->saved_state.next = dup_state_stack (sr->curr.next); in desc_label_state()
539 ls->next = sr->labeled_states; in desc_label_state()
540 sr->labeled_states = ls; in desc_label_state()
546 desc_is_active (unsigned char qp, unw_word t, struct ia64_state_record *sr) in desc_is_active() argument
548 if (sr->when_target <= sr->region_start + MIN ((int) t, sr->region_len - 1)) in desc_is_active()
552 if ((sr->pr_val & ((unw_word_t) 1 << qp)) == 0) in desc_is_active()
554 sr->pr_mask |= ((unw_word_t) 1 << qp); in desc_is_active()
561 struct ia64_state_record *sr) in desc_restore_p() argument
565 if (!desc_is_active (qp, t, sr)) in desc_restore_p()
568 r = sr->curr.reg + decode_abreg (abreg, 0); in desc_restore_p()
577 struct ia64_state_record *sr) in desc_spill_reg_p() argument
582 if (!desc_is_active (qp, t, sr)) in desc_spill_reg_p()
590 r = sr->curr.reg + decode_abreg (abreg, 0); in desc_spill_reg_p()
592 r->when = sr->region_start + MIN ((int) t, sr->region_len - 1); in desc_spill_reg_p()
598 unw_word pspoff, struct ia64_state_record *sr) in desc_spill_psprel_p() argument
602 if (!desc_is_active (qp, t, sr)) in desc_spill_psprel_p()
605 r = sr->curr.reg + decode_abreg (abreg, 1); in desc_spill_psprel_p()
607 r->when = sr->region_start + MIN ((int) t, sr->region_len - 1); in desc_spill_psprel_p()
613 unw_word spoff, struct ia64_state_record *sr) in desc_spill_sprel_p() argument
617 if (!desc_is_active (qp, t, sr)) in desc_spill_sprel_p()
620 r = sr->curr.reg + decode_abreg (abreg, 1); in desc_spill_sprel_p()
622 r->when = sr->region_start + MIN ((int) t, sr->region_len - 1); in desc_spill_sprel_p()
697 lookup_preg (int regnum, int memory, struct ia64_state_record *sr) in lookup_preg() argument
741 return sr->curr.reg + preg; in lookup_preg()
751 desc_alias (unw_dyn_op_t *op, struct cursor *c, struct ia64_state_record *sr) in desc_alias() argument
753 struct ia64_state_record orig_sr = *sr; in desc_alias()
754 int i, ret, when, rlen = sr->region_len; in desc_alias()
757 when = MIN (sr->when_target, rlen); in desc_alias()
763 if ((ret = create_state_record_for (c, sr, new_ip)) < 0) in desc_alias()
766 sr->first_region = orig_sr.first_region; in desc_alias()
767 sr->done = 0; in desc_alias()
768 sr->any_spills |= orig_sr.any_spills; in desc_alias()
769 sr->in_body = orig_sr.in_body; in desc_alias()
770 sr->region_start = orig_sr.region_start; in desc_alias()
771 sr->region_len = orig_sr.region_len; in desc_alias()
772 if (sr->when_sp_restored != IA64_WHEN_NEVER) in desc_alias()
773 sr->when_sp_restored = op->when + MIN (orig_sr.when_sp_restored, rlen); in desc_alias()
774 sr->epilogue_count = orig_sr.epilogue_count; in desc_alias()
775 sr->when_target = orig_sr.when_target; in desc_alias()
778 if (sr->curr.reg[i].when != IA64_WHEN_NEVER) in desc_alias()
779 sr->curr.reg[i].when = op->when + MIN (sr->curr.reg[i].when, rlen); in desc_alias()
781 ia64_free_state_record (sr); in desc_alias()
782 sr->labeled_states = orig_sr.labeled_states; in desc_alias()
783 sr->curr.next = orig_sr.curr.next; in desc_alias()
788 parse_dynamic (struct cursor *c, struct ia64_state_record *sr) in parse_dynamic() argument
813 sr->region_start = (di->end_ip - di->start_ip) / 0x10 * 3 - len; in parse_dynamic()
814 sr->region_len = 0; in parse_dynamic()
817 desc_prologue (0, len, 0, 0, sr); in parse_dynamic()
819 if (sr->done) in parse_dynamic()
828 if (!desc_is_active (qp, when, sr)) in parse_dynamic()
831 when = sr->region_start + MIN ((int) when, sr->region_len - 1); in parse_dynamic()
851 ri = lookup_preg (op->reg, memory, sr); in parse_dynamic()
880 desc_mem_stack_f (when, -((int64_t) val / 16), sr); in parse_dynamic()
891 sr->when_sp_restored = when; in parse_dynamic()
892 sr->epilogue_count = op->val; in parse_dynamic()
896 desc_label_state (op->val, sr); in parse_dynamic()
900 desc_copy_state (op->val, sr); in parse_dynamic()
904 if ((ret = desc_alias (op, c, sr)) < 0) in parse_dynamic()
917 # define parse_dynamic(c,sr) (-UNW_EINVAL) argument
956 create_state_record_for (struct cursor *c, struct ia64_state_record *sr, in create_state_record_for() argument
967 memset (sr, 0, sizeof (*sr)); in create_state_record_for()
968 for (r = sr->curr.reg; r < sr->curr.reg + IA64_NUM_PREGS; ++r) in create_state_record_for()
970 sr->pr_val = predicates; in create_state_record_for()
971 sr->first_region = 1; in create_state_record_for()
979 sr->curr.reg[IA64_REG_IP].where = IA64_WHERE_BR; in create_state_record_for()
980 sr->curr.reg[IA64_REG_IP].when = -1; in create_state_record_for()
981 sr->curr.reg[IA64_REG_IP].val = 0; in create_state_record_for()
985 sr->when_target = (3 * ((ip & ~(unw_word_t) 0xf) - c->pi.start_ip) / 16 in create_state_record_for()
994 while (!sr->done && dp < desc_end) in create_state_record_for()
995 dp = unw_decode (dp, sr->in_body, sr); in create_state_record_for()
1000 ret = parse_dynamic (c, sr); in create_state_record_for()
1012 if (sr->when_target > sr->when_sp_restored) in create_state_record_for()
1016 sr->curr.reg[IA64_REG_PSP].val = 0; in create_state_record_for()
1017 sr->curr.reg[IA64_REG_PSP].where = IA64_WHERE_NONE; in create_state_record_for()
1018 sr->curr.reg[IA64_REG_PSP].when = IA64_WHEN_NEVER; in create_state_record_for()
1019 for (r = sr->curr.reg; r < sr->curr.reg + IA64_NUM_PREGS; ++r) in create_state_record_for()
1031 if (sr->curr.reg[IA64_REG_IP].when >= sr->when_target) in create_state_record_for()
1033 sr->curr.reg[IA64_REG_IP].where = IA64_WHERE_BR; in create_state_record_for()
1034 sr->curr.reg[IA64_REG_IP].when = -1; in create_state_record_for()
1035 sr->curr.reg[IA64_REG_IP].val = sr->return_link_reg; in create_state_record_for()
1038 if (sr->when_target > sr->curr.reg[IA64_REG_BSP].when in create_state_record_for()
1039 && sr->when_target > sr->curr.reg[IA64_REG_BSPSTORE].when in create_state_record_for()
1040 && sr->when_target > sr->curr.reg[IA64_REG_RNAT].when) in create_state_record_for()
1052 (long) c->pi.start_ip, sr->when_target, (long) c->pi.flags); in create_state_record_for()
1053 for (r = sr->curr.reg; r < sr->curr.reg + IA64_NUM_PREGS; ++r) in create_state_record_for()
1057 Dprintf (" %s <- ", unw.preg_name[r - sr->curr.reg]); in create_state_record_for()
1077 unw.preg_name[r - sr->curr.reg], (long) r->val); in create_state_record_for()
1094 ia64_create_state_record (struct cursor *c, struct ia64_state_record *sr) in ia64_create_state_record() argument
1096 return create_state_record_for (c, sr, c->ip); in ia64_create_state_record()
1100 ia64_free_state_record (struct ia64_state_record *sr) in ia64_free_state_record() argument
1106 for (ls = sr->labeled_states; ls; ls = next) in ia64_free_state_record()
1112 free_state_stack (&sr->curr); in ia64_free_state_record()