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()
248 unsigned long tableSize = table->size, hdrSize; in init_unwind_hdr()
261 if (table->header) in init_unwind_hdr()
264 if (table->hdrsz) in init_unwind_hdr()
266 table->name); in init_unwind_hdr()
268 if (tableSize & (sizeof(*fde) - 1)) in init_unwind_hdr()
271 for (fde = table->address, n = 0; in init_unwind_hdr()
272 tableSize > sizeof(*fde) && tableSize - sizeof(*fde) >= *fde; in init_unwind_hdr()
273 tableSize -= sizeof(*fde) + *fde, fde += 1 + *fde / sizeof(*fde)) { in init_unwind_hdr()
289 * instead of the initial loc addr in init_unwind_hdr()
292 WARN(1, "unwinder: FDE->initial_location NULL %p\n", in init_unwind_hdr()
308 header->version = 1; in init_unwind_hdr()
309 header->eh_frame_ptr_enc = DW_EH_PE_abs | DW_EH_PE_native; in init_unwind_hdr()
310 header->fde_count_enc = DW_EH_PE_abs | DW_EH_PE_data4; in init_unwind_hdr()
311 header->table_enc = DW_EH_PE_abs | DW_EH_PE_native; in init_unwind_hdr()
312 put_unaligned((unsigned long)table->address, &header->eh_frame_ptr); in init_unwind_hdr()
314 % __alignof(typeof(header->fde_count))); in init_unwind_hdr()
315 header->fde_count = n; in init_unwind_hdr()
318 % __alignof(typeof(*header->table))); in init_unwind_hdr()
319 for (fde = table->address, tableSize = table->size, n = 0; in init_unwind_hdr()
321 tableSize -= sizeof(*fde) + *fde, fde += 1 + *fde / sizeof(*fde)) { in init_unwind_hdr()
327 header->table[n].start = read_pointer(&ptr, in init_unwind_hdr()
331 header->table[n].fde = (unsigned long)fde; in init_unwind_hdr()
334 WARN_ON(n != header->fde_count); in init_unwind_hdr()
336 sort(header->table, in init_unwind_hdr()
338 sizeof(*header->table), in init_unwind_hdr()
341 table->hdrsz = hdrSize; in init_unwind_hdr()
343 table->header = (const void *)header; in init_unwind_hdr()
373 core_text = &module->mem[MOD_TEXT]; in unwind_add_table()
374 init_text = &module->mem[MOD_INIT_TEXT]; in unwind_add_table()
376 init_unwind_table(table, module->name, core_text->base, core_text->size, in unwind_add_table()
377 init_text->base, init_text->size, table_start, table_size, NULL, 0); in unwind_add_table()
383 module->name, table->core.pc, table->core.range); in unwind_add_table()
386 last_table->link = table; in unwind_add_table()
402 struct unwind_table *table = info->table, *prev; in unlink_table()
404 for (prev = &root_table; prev->link && prev->link != table; in unlink_table()
405 prev = prev->link) in unlink_table()
408 if (prev->link) { in unlink_table()
409 if (info->init_only) { in unlink_table()
410 table->init.pc = 0; in unlink_table()
411 table->init.range = 0; in unlink_table()
412 info->table = NULL; in unlink_table()
414 prev->link = table->link; in unlink_table()
415 if (!prev->link) in unlink_table()
419 info->table = NULL; in unlink_table()
434 table->init.pc = 0; in unwind_remove_table()
435 table->init.range = 0; in unwind_remove_table()
443 kfree(table->header); in unwind_remove_table()
457 && (*cur & 0x7fU) >= (1U << (8 * sizeof(value) - shift))) { in get_uleb128()
478 && (*cur & 0x7fU) >= (1U << (8 * sizeof(value) - shift))) { in get_sleb128()
484 value |= -(*cur++ & 0x40) << shift; in get_sleb128()
497 cie = fde + 1 - fde[1] / sizeof(*fde); in __cie_for_fde()
506 if (!*fde || (*fde & (sizeof(*fde) - 1))) in cie_for_fde()
512 if ((fde[1] & (sizeof(*fde) - 1))) in cie_for_fde()
513 /* || fde[1] > (unsigned long)(fde + 1) - (unsigned long)table->address) */ in cie_for_fde()
518 if (*cie <= sizeof(*cie) + 4 || *cie >= fde[1] - sizeof(*fde) in cie_for_fde()
519 || (*cie & (sizeof(*cie) - 1)) in cie_for_fde()
609 return -1; in fde_pointer_type()
611 /* check if augmentation string is nul-terminated */ in fde_pointer_type()
613 ptr = memchr(aug, 0, end - ptr); in fde_pointer_type()
615 return -1; in fde_pointer_type()
618 get_uleb128(&ptr, end); /* skip code alignment */ in fde_pointer_type()
625 return -1; in fde_pointer_type()
630 return -1; in fde_pointer_type()
640 return -1; in fde_pointer_type()
646 return -1; in fde_pointer_type()
655 state->loc += delta * state->codeAlign; in advance_loc()
660 unw_debug("delta %3lu => loc 0x%lx: ", delta, state->loc); in advance_loc()
667 if (reg < ARRAY_SIZE(state->regs)) { in set_rule()
668 state->regs[reg].where = where; in set_rule()
669 state->regs[reg].value = value; in set_rule()
704 if (start != state->cieStart) { in processCFI()
705 state->loc = state->org; in processCFI()
707 processCFI(state->cieStart, state->cieEnd, 0, ptrType, in processCFI()
709 if (targetLoc == 0 && state->label == NULL) in processCFI()
724 state->loc = read_pointer(&ptr.p8, end, in processCFI()
726 if (state->loc == 0) in processCFI()
728 unw_debug("cfa_set_loc: 0x%lx ", state->loc); in processCFI()
787 if (ptr.p8 == state->label) { in processCFI()
788 state->label = NULL; in processCFI()
791 if (state->stackDepth >= MAX_STACK_DEPTH) in processCFI()
793 state->stack[state->stackDepth++] = ptr.p8; in processCFI()
797 if (state->stackDepth) { in processCFI()
798 const uleb128_t loc = state->loc; in processCFI() local
799 const u8 *label = state->label; in processCFI()
801 state->label = in processCFI()
802 state->stack[state->stackDepth - 1]; in processCFI()
803 memcpy(&state->cfa, &badCFA, in processCFI()
804 sizeof(state->cfa)); in processCFI()
805 memset(state->regs, 0, in processCFI()
806 sizeof(state->regs)); in processCFI()
807 state->stackDepth = 0; in processCFI()
811 state->loc = loc; in processCFI()
812 state->label = label; in processCFI()
817 state->cfa.reg = get_uleb128(&ptr.p8, end); in processCFI()
818 unw_debug("cfa_def_cfa: r%lu ", state->cfa.reg); in processCFI()
821 state->cfa.offs = get_uleb128(&ptr.p8, end); in processCFI()
823 state->cfa.offs); in processCFI()
826 state->cfa.reg = get_uleb128(&ptr.p8, end); in processCFI()
829 state->cfa.offs = get_sleb128(&ptr.p8, end) in processCFI()
830 * state->dataAlign; in processCFI()
834 state->cfa.reg = get_uleb128(&ptr.p8, end); in processCFI()
846 (uleb128_t) 0 - get_uleb128(&ptr.p8, in processCFI()
875 if (result && targetLoc != 0 && targetLoc < state->loc) in processCFI()
883 targetLoc < state->loc && */ state->label == NULL)); in processCFI()
893 unsigned long pc = UNW_PC(frame) - frame->call_frame; in arc_unwind()
896 signed ptrType = -1; in arc_unwind()
909 return -EINVAL; in arc_unwind()
923 && !(table->size & (sizeof(*fde) - 1))) { in arc_unwind()
924 const u8 *hdr = table->header; in arc_unwind()
947 end = hdr + table->hdrsz; in arc_unwind()
949 == (unsigned long)table->address in arc_unwind()
951 && i == (end - ptr) / (2 * tableSize) in arc_unwind()
952 && !((end - ptr) % (2 * tableSize))) { in arc_unwind()
963 ptr = cur - tableSize; in arc_unwind()
1012 frame->call_frame = 1; in arc_unwind()
1019 * nul-terminated augmentation string */ in arc_unwind()
1025 frame->call_frame = 0; in arc_unwind()
1039 /* get code alignment factor */ in arc_unwind()
1053 unw_debug("code Align: %lu\n", state.codeAlign); in arc_unwind()
1084 top = STACK_TOP_UNW(frame->task); in arc_unwind()
1085 bottom = STACK_BOTTOM_UNW(frame->task); in arc_unwind()
1094 & (sizeof(unsigned long) - 1))) { in arc_unwind()
1104 && !(link & (sizeof(link) - 1)) in arc_unwind()
1112 - in arc_unwind()
1122 return -ENXIO; in arc_unwind()
1135 || state.loc > endLoc in arc_unwind()
1140 return -EIO; in arc_unwind()
1170 if (frame->call_frame in arc_unwind()
1172 frame->call_frame = 0; in arc_unwind()
1188 return -EIO; in arc_unwind()
1198 return -EIO; in arc_unwind()
1219 return -EIO; in arc_unwind()
1226 fptr = (unsigned long *)(&frame->regs); in arc_unwind()
1256 return -EIO; in arc_unwind()
1261 return -EIO; in arc_unwind()
1273 return -EIO; in arc_unwind()
1295 return -EIO; in arc_unwind()