MCPcopy Create free account
hub / github.com/F-Stack/f-stack / find_index

Function find_index

freebsd/arm/arm/unwind.c:313–347  ·  view source on GitHub ↗

* Perform a binary search of the index table to find the function * with the largest address that doesn't exceed addr. */

Source from the content-addressed store, hash-verified

311 * with the largest address that doesn't exceed addr.
312 */
313static struct unwind_idx *
314find_index(uint32_t addr)
315{
316 struct module_info *info;
317 unsigned int min, mid, max;
318 struct unwind_idx *start;
319 struct unwind_idx *item;
320 int32_t prel31_addr;
321 uint32_t func_addr;
322
323 info = find_module_info(addr);
324 if (info == NULL)
325 return NULL;
326
327 min = 0;
328 max = (info->exidx_end - info->exidx_start) / sizeof(struct unwind_idx);
329 start = (struct unwind_idx *)CADDR(info->exidx_start);
330
331 while (min != max) {
332 mid = min + (max - min + 1) / 2;
333
334 item = &start[mid];
335
336 prel31_addr = expand_prel31(item->offset);
337 func_addr = (uint32_t)&item->offset + prel31_addr;
338
339 if (func_addr <= addr) {
340 min = mid;
341 } else {
342 max = mid - 1;
343 }
344 }
345
346 return &start[min];
347}
348
349/* Reads the next byte from the instruction list */
350static uint8_t

Callers 1

unwind_stack_oneFunction · 0.85

Calls 2

find_module_infoFunction · 0.85
expand_prel31Function · 0.85

Tested by

no test coverage detected