• Home
  • Raw
  • Download

Lines Matching refs:kbt

44 static int in_kernel_stack(struct KBacktraceIterator *kbt, unsigned long sp)  in in_kernel_stack()  argument
46 ulong kstack_base = (ulong) kbt->task->stack; in in_kernel_stack()
57 struct KBacktraceIterator *kbt = (struct KBacktraceIterator *)vkbt; in read_memory_func() local
65 if (!in_kernel_stack(kbt, address)) in read_memory_func()
67 } else if (!kbt->is_current) { in read_memory_func()
79 static struct pt_regs *valid_fault_handler(struct KBacktraceIterator* kbt) in valid_fault_handler() argument
83 unsigned long sp = kbt->it.sp; in valid_fault_handler()
88 if (!in_kernel_stack(kbt, sp)) in valid_fault_handler()
90 if (!in_kernel_stack(kbt, sp + C_ABI_SAVE_AREA_SIZE + PTREGS_SIZE-1)) in valid_fault_handler()
96 if (kbt->verbose) { /* else we aren't going to use it */ in valid_fault_handler()
104 in_kernel_stack(kbt, p->sp) && in valid_fault_handler()
106 if (kbt->verbose) in valid_fault_handler()
110 if (kbt->verbose) in valid_fault_handler()
113 if (kbt->verbose && (p->pc != 0 || p->sp != 0 || p->ex1 != 0)) in valid_fault_handler()
118 if (kbt->profile && ((1ULL << p->faultnum) & QUEUED_INTERRUPTS) != 0) in valid_fault_handler()
124 static int is_sigreturn(struct KBacktraceIterator *kbt) in is_sigreturn() argument
126 return kbt->task->mm && in is_sigreturn()
127 (kbt->it.pc == ((ulong)kbt->task->mm->context.vdso_base + in is_sigreturn()
132 static struct pt_regs *valid_sigframe(struct KBacktraceIterator* kbt, in valid_sigframe() argument
135 BacktraceIterator *b = &kbt->it; in valid_sigframe()
137 if (is_sigreturn(kbt) && b->sp < PAGE_OFFSET && in valid_sigframe()
148 if (kbt->verbose) { in valid_sigframe()
157 static int KBacktraceIterator_restart(struct KBacktraceIterator *kbt) in KBacktraceIterator_restart() argument
162 p = valid_fault_handler(kbt); in KBacktraceIterator_restart()
164 p = valid_sigframe(kbt, &kframe); in KBacktraceIterator_restart()
167 backtrace_init(&kbt->it, read_memory_func, kbt, in KBacktraceIterator_restart()
169 kbt->new_context = 1; in KBacktraceIterator_restart()
175 struct KBacktraceIterator *kbt) in KBacktraceIterator_next_item_inclusive() argument
179 if (!is_sigreturn(kbt)) in KBacktraceIterator_next_item_inclusive()
181 } while (backtrace_next(&kbt->it)); in KBacktraceIterator_next_item_inclusive()
183 if (!KBacktraceIterator_restart(kbt)) in KBacktraceIterator_next_item_inclusive()
216 void KBacktraceIterator_init(struct KBacktraceIterator *kbt, in KBacktraceIterator_init() argument
227 kbt->is_current = is_current; in KBacktraceIterator_init()
230 kbt->task = t; in KBacktraceIterator_init()
231 kbt->verbose = 0; /* override in caller if desired */ in KBacktraceIterator_init()
232 kbt->profile = 0; /* override in caller if desired */ in KBacktraceIterator_init()
233 kbt->end = KBT_ONGOING; in KBacktraceIterator_init()
234 kbt->new_context = 1; in KBacktraceIterator_init()
241 kbt->end = KBT_RUNNING; in KBacktraceIterator_init()
255 backtrace_init(&kbt->it, read_memory_func, kbt, pc, lr, sp, r52); in KBacktraceIterator_init()
256 kbt->end = KBacktraceIterator_next_item_inclusive(kbt); in KBacktraceIterator_init()
260 int KBacktraceIterator_end(struct KBacktraceIterator *kbt) in KBacktraceIterator_end() argument
262 return kbt->end != KBT_ONGOING; in KBacktraceIterator_end()
266 void KBacktraceIterator_next(struct KBacktraceIterator *kbt) in KBacktraceIterator_next() argument
268 unsigned long old_pc = kbt->it.pc, old_sp = kbt->it.sp; in KBacktraceIterator_next()
269 kbt->new_context = 0; in KBacktraceIterator_next()
270 if (!backtrace_next(&kbt->it) && !KBacktraceIterator_restart(kbt)) { in KBacktraceIterator_next()
271 kbt->end = KBT_DONE; in KBacktraceIterator_next()
274 kbt->end = KBacktraceIterator_next_item_inclusive(kbt); in KBacktraceIterator_next()
275 if (old_pc == kbt->it.pc && old_sp == kbt->it.sp) { in KBacktraceIterator_next()
277 kbt->end = KBT_LOOP; in KBacktraceIterator_next()
282 static void describe_addr(struct KBacktraceIterator *kbt, in describe_addr() argument
299 adjust = !kbt->new_context; in describe_addr()
328 vma = find_vma(kbt->task->mm, address); in describe_addr()
376 void tile_show_stack(struct KBacktraceIterator *kbt) in tile_show_stack() argument
383 kbt->verbose = 1; in tile_show_stack()
385 for (; !KBacktraceIterator_end(kbt); KBacktraceIterator_next(kbt)) { in tile_show_stack()
387 unsigned long address = kbt->it.pc; in tile_show_stack()
397 if (kbt->task == current && address < PAGE_OFFSET && in tile_show_stack()
398 !have_mmap_sem && kbt->task->mm && !in_interrupt()) { in tile_show_stack()
400 down_read_trylock(&kbt->task->mm->mmap_sem); in tile_show_stack()
403 describe_addr(kbt, address, have_mmap_sem, in tile_show_stack()
407 i++, address, namebuf, (unsigned long)(kbt->it.sp)); in tile_show_stack()
414 if (kbt->end == KBT_LOOP) in tile_show_stack()
417 up_read(&kbt->task->mm->mmap_sem); in tile_show_stack()
436 struct KBacktraceIterator kbt; in _dump_stack() local
440 KBacktraceIterator_init(&kbt, NULL, &regs); in _dump_stack()
441 tile_show_stack(&kbt); in _dump_stack()
445 void _KBacktraceIterator_init_current(struct KBacktraceIterator *kbt, ulong pc, in _KBacktraceIterator_init_current() argument
449 KBacktraceIterator_init(kbt, NULL, in _KBacktraceIterator_init_current()
459 struct KBacktraceIterator kbt; in show_stack() local
461 KBacktraceIterator_init_current(&kbt); in show_stack()
462 KBacktraceIterator_next(&kbt); /* don't show first frame */ in show_stack()
464 KBacktraceIterator_init(&kbt, task, NULL); in show_stack()
466 tile_show_stack(&kbt); in show_stack()
478 struct KBacktraceIterator kbt; in save_stack_trace_common() local
485 KBacktraceIterator_init(&kbt, NULL, regs); in save_stack_trace_common()
487 KBacktraceIterator_init_current(&kbt); in save_stack_trace_common()
490 KBacktraceIterator_init(&kbt, task, NULL); in save_stack_trace_common()
492 for (; !KBacktraceIterator_end(&kbt); KBacktraceIterator_next(&kbt)) { in save_stack_trace_common()
498 (!user && kbt.it.pc < PAGE_OFFSET)) in save_stack_trace_common()
500 trace->entries[i++] = kbt.it.pc; in save_stack_trace_common()