Lines Matching +full:loc +full:- +full:code

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
4 * Copyright (C) 2002-2006 Novell, Inc.
9 * full-blown stack unwinding with all the bells and whistles, so there
140 uleb128_t loc, org; member
160 for (table = &root_table; table; table = table->link) in find_table()
161 if ((pc >= table->core.pc in find_table()
162 && pc < table->core.pc + table->core.range) in find_table()
163 || (pc >= table->init.pc in find_table()
164 && pc < table->init.pc + table->init.range)) in find_table()
190 table->core.pc = (unsigned long)core_start; in init_unwind_table()
191 table->core.range = core_size; in init_unwind_table()
192 table->init.pc = (unsigned long)init_start; in init_unwind_table()
193 table->init.range = init_size; in init_unwind_table()
194 table->address = table_start; in init_unwind_table()
195 table->size = table_size; in init_unwind_table()
210 table->hdrsz = header_size; in init_unwind_table()
212 table->header = header_start; in init_unwind_table()
213 table->link = NULL; in init_unwind_table()
214 table->name = name; in init_unwind_table()
219 init_unwind_table(&root_table, "kernel", _text, _end - _text, NULL, 0, in arc_unwind_init()
220 __start_unwind, __end_unwind - __start_unwind, in arc_unwind_init()
222 /*__start_unwind_hdr, __end_unwind_hdr - __start_unwind_hdr);*/ in arc_unwind_init()
241 return (e1->start > e2->start) - (e1->start < e2->start); in cmp_eh_frame_hdr_table_entries()
249 swap(e1->start, e2->start); in swap_eh_frame_hdr_table_entries()
250 swap(e1->fde, e2->fde); in swap_eh_frame_hdr_table_entries()
257 unsigned long tableSize = table->size, hdrSize; in init_unwind_hdr()
270 if (table->header) in init_unwind_hdr()
273 if (table->hdrsz) in init_unwind_hdr()
275 table->name); in init_unwind_hdr()
277 if (tableSize & (sizeof(*fde) - 1)) in init_unwind_hdr()
280 for (fde = table->address, n = 0; in init_unwind_hdr()
281 tableSize > sizeof(*fde) && tableSize - sizeof(*fde) >= *fde; in init_unwind_hdr()
282 tableSize -= sizeof(*fde) + *fde, fde += 1 + *fde / sizeof(*fde)) { in init_unwind_hdr()
298 * instead of the initial loc addr in init_unwind_hdr()
301 WARN(1, "unwinder: FDE->initial_location NULL %p\n", in init_unwind_hdr()
317 header->version = 1; in init_unwind_hdr()
318 header->eh_frame_ptr_enc = DW_EH_PE_abs | DW_EH_PE_native; in init_unwind_hdr()
319 header->fde_count_enc = DW_EH_PE_abs | DW_EH_PE_data4; in init_unwind_hdr()
320 header->table_enc = DW_EH_PE_abs | DW_EH_PE_native; in init_unwind_hdr()
321 put_unaligned((unsigned long)table->address, &header->eh_frame_ptr); in init_unwind_hdr()
323 % __alignof(typeof(header->fde_count))); in init_unwind_hdr()
324 header->fde_count = n; in init_unwind_hdr()
327 % __alignof(typeof(*header->table))); in init_unwind_hdr()
328 for (fde = table->address, tableSize = table->size, n = 0; in init_unwind_hdr()
330 tableSize -= sizeof(*fde) + *fde, fde += 1 + *fde / sizeof(*fde)) { in init_unwind_hdr()
336 header->table[n].start = read_pointer(&ptr, in init_unwind_hdr()
340 header->table[n].fde = (unsigned long)fde; in init_unwind_hdr()
343 WARN_ON(n != header->fde_count); in init_unwind_hdr()
345 sort(header->table, in init_unwind_hdr()
347 sizeof(*header->table), in init_unwind_hdr()
350 table->hdrsz = hdrSize; in init_unwind_hdr()
352 table->header = (const void *)header; in init_unwind_hdr()
382 core_text = &module->mem[MOD_TEXT]; in unwind_add_table()
383 init_text = &module->mem[MOD_INIT_TEXT]; in unwind_add_table()
385 init_unwind_table(table, module->name, core_text->base, core_text->size, in unwind_add_table()
386 init_text->base, init_text->size, table_start, table_size, NULL, 0); in unwind_add_table()
392 module->name, table->core.pc, table->core.range); in unwind_add_table()
395 last_table->link = table; in unwind_add_table()
411 struct unwind_table *table = info->table, *prev; in unlink_table()
413 for (prev = &root_table; prev->link && prev->link != table; in unlink_table()
414 prev = prev->link) in unlink_table()
417 if (prev->link) { in unlink_table()
418 if (info->init_only) { in unlink_table()
419 table->init.pc = 0; in unlink_table()
420 table->init.range = 0; in unlink_table()
421 info->table = NULL; in unlink_table()
423 prev->link = table->link; in unlink_table()
424 if (!prev->link) in unlink_table()
428 info->table = NULL; in unlink_table()
443 table->init.pc = 0; in unwind_remove_table()
444 table->init.range = 0; in unwind_remove_table()
452 kfree(table->header); in unwind_remove_table()
466 && (*cur & 0x7fU) >= (1U << (8 * sizeof(value) - shift))) { in get_uleb128()
487 && (*cur & 0x7fU) >= (1U << (8 * sizeof(value) - shift))) { in get_sleb128()
493 value |= -(*cur++ & 0x40) << shift; in get_sleb128()
506 cie = fde + 1 - fde[1] / sizeof(*fde); in __cie_for_fde()
515 if (!*fde || (*fde & (sizeof(*fde) - 1))) in cie_for_fde()
521 if ((fde[1] & (sizeof(*fde) - 1))) in cie_for_fde()
522 /* || fde[1] > (unsigned long)(fde + 1) - (unsigned long)table->address) */ in cie_for_fde()
527 if (*cie <= sizeof(*cie) + 4 || *cie >= fde[1] - sizeof(*fde) in cie_for_fde()
528 || (*cie & (sizeof(*cie) - 1)) in cie_for_fde()
618 return -1; in fde_pointer_type()
620 /* check if augmentation string is nul-terminated */ in fde_pointer_type()
622 ptr = memchr(aug, 0, end - ptr); in fde_pointer_type()
624 return -1; in fde_pointer_type()
627 get_uleb128(&ptr, end); /* skip code alignment */ in fde_pointer_type()
634 return -1; in fde_pointer_type()
639 return -1; in fde_pointer_type()
649 return -1; in fde_pointer_type()
655 return -1; in fde_pointer_type()
664 state->loc += delta * state->codeAlign; in advance_loc()
669 unw_debug("delta %3lu => loc 0x%lx: ", delta, state->loc); in advance_loc()
676 if (reg < ARRAY_SIZE(state->regs)) { in set_rule()
677 state->regs[reg].where = where; in set_rule()
678 state->regs[reg].value = value; in set_rule()
713 if (start != state->cieStart) { in processCFI()
714 state->loc = state->org; in processCFI()
716 processCFI(state->cieStart, state->cieEnd, 0, ptrType, in processCFI()
718 if (targetLoc == 0 && state->label == NULL) in processCFI()
733 state->loc = read_pointer(&ptr.p8, end, in processCFI()
735 if (state->loc == 0) in processCFI()
737 unw_debug("cfa_set_loc: 0x%lx ", state->loc); in processCFI()
796 if (ptr.p8 == state->label) { in processCFI()
797 state->label = NULL; in processCFI()
800 if (state->stackDepth >= MAX_STACK_DEPTH) in processCFI()
802 state->stack[state->stackDepth++] = ptr.p8; in processCFI()
806 if (state->stackDepth) { in processCFI()
807 const uleb128_t loc = state->loc; in processCFI() local
808 const u8 *label = state->label; in processCFI()
810 state->label = in processCFI()
811 state->stack[state->stackDepth - 1]; in processCFI()
812 memcpy(&state->cfa, &badCFA, in processCFI()
813 sizeof(state->cfa)); in processCFI()
814 memset(state->regs, 0, in processCFI()
815 sizeof(state->regs)); in processCFI()
816 state->stackDepth = 0; in processCFI()
820 state->loc = loc; in processCFI()
821 state->label = label; in processCFI()
826 state->cfa.reg = get_uleb128(&ptr.p8, end); in processCFI()
827 unw_debug("cfa_def_cfa: r%lu ", state->cfa.reg); in processCFI()
830 state->cfa.offs = get_uleb128(&ptr.p8, end); in processCFI()
832 state->cfa.offs); in processCFI()
835 state->cfa.reg = get_uleb128(&ptr.p8, end); in processCFI()
838 state->cfa.offs = get_sleb128(&ptr.p8, end) in processCFI()
839 * state->dataAlign; in processCFI()
843 state->cfa.reg = get_uleb128(&ptr.p8, end); in processCFI()
855 (uleb128_t) 0 - get_uleb128(&ptr.p8, in processCFI()
884 if (result && targetLoc != 0 && targetLoc < state->loc) in processCFI()
892 targetLoc < state->loc && */ state->label == NULL)); in processCFI()
902 unsigned long pc = UNW_PC(frame) - frame->call_frame; in arc_unwind()
905 signed ptrType = -1; in arc_unwind()
918 return -EINVAL; in arc_unwind()
932 && !(table->size & (sizeof(*fde) - 1))) { in arc_unwind()
933 const u8 *hdr = table->header; in arc_unwind()
956 end = hdr + table->hdrsz; in arc_unwind()
958 == (unsigned long)table->address in arc_unwind()
960 && i == (end - ptr) / (2 * tableSize) in arc_unwind()
961 && !((end - ptr) % (2 * tableSize))) { in arc_unwind()
972 ptr = cur - tableSize; in arc_unwind()
1021 frame->call_frame = 1; in arc_unwind()
1028 * nul-terminated augmentation string */ in arc_unwind()
1034 frame->call_frame = 0; in arc_unwind()
1048 /* get code alignment factor */ in arc_unwind()
1062 unw_debug("code Align: %lu\n", state.codeAlign); in arc_unwind()
1093 top = STACK_TOP_UNW(frame->task); in arc_unwind()
1094 bottom = STACK_BOTTOM_UNW(frame->task); in arc_unwind()
1103 & (sizeof(unsigned long) - 1))) { in arc_unwind()
1113 && !(link & (sizeof(link) - 1)) in arc_unwind()
1121 - in arc_unwind()
1131 return -ENXIO; in arc_unwind()
1144 || state.loc > endLoc in arc_unwind()
1149 return -EIO; in arc_unwind()
1179 if (frame->call_frame in arc_unwind()
1181 frame->call_frame = 0; in arc_unwind()
1197 return -EIO; in arc_unwind()
1207 return -EIO; in arc_unwind()
1228 return -EIO; in arc_unwind()
1235 fptr = (unsigned long *)(&frame->regs); in arc_unwind()
1265 return -EIO; in arc_unwind()
1270 return -EIO; in arc_unwind()
1282 return -EIO; in arc_unwind()
1304 return -EIO; in arc_unwind()