blob: c3cb42615a9fa40dc19be4307a91f666a0f2ba21 [file] [log] [blame]
Kyle Swenson8d8f6542021-03-15 11:02:55 -06001/*
2 * Copyright 2010 Tilera Corporation. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation, version 2.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
11 * NON INFRINGEMENT. See the GNU General Public License for
12 * more details.
13 */
14
15#ifndef _ASM_TILE_STACK_H
16#define _ASM_TILE_STACK_H
17
18#include <linux/types.h>
19#include <linux/sched.h>
20#include <asm/backtrace.h>
21#include <asm/page.h>
22#include <hv/hypervisor.h>
23
24/* Everything we need to keep track of a backtrace iteration */
25struct KBacktraceIterator {
26 BacktraceIterator it;
27 struct task_struct *task; /* task we are backtracing */
28 int end; /* iteration complete. */
29 int new_context; /* new context is starting */
30 int profile; /* profiling, so stop on async intrpt */
31 int verbose; /* printk extra info (don't want to
32 * do this for profiling) */
33 int is_current; /* backtracing current task */
34};
35
36/* Iteration methods for kernel backtraces */
37
38/*
39 * Initialize a KBacktraceIterator from a task_struct, and optionally from
40 * a set of registers. If the registers are omitted, the process is
41 * assumed to be descheduled, and registers are read from the process's
42 * thread_struct and stack. "verbose" means to printk some additional
43 * information about fault handlers as we pass them on the stack.
44 */
45extern void KBacktraceIterator_init(struct KBacktraceIterator *kbt,
46 struct task_struct *, struct pt_regs *);
47
48/* Initialize iterator based on current stack. */
49extern void KBacktraceIterator_init_current(struct KBacktraceIterator *kbt);
50
51/* Helper method for above. */
52extern void _KBacktraceIterator_init_current(struct KBacktraceIterator *kbt,
53 ulong pc, ulong lr, ulong sp, ulong r52);
54
55/* No more frames? */
56extern int KBacktraceIterator_end(struct KBacktraceIterator *kbt);
57
58/* Advance to the next frame. */
59extern void KBacktraceIterator_next(struct KBacktraceIterator *kbt);
60
61/* Dump just the contents of the pt_regs structure. */
62extern void tile_show_regs(struct pt_regs *);
63
64/*
65 * Dump stack given complete register info. Use only from the
66 * architecture-specific code; show_stack()
67 * and dump_stack() are architecture-independent entry points.
68 */
69extern void tile_show_stack(struct KBacktraceIterator *);
70
71#endif /* _ASM_TILE_STACK_H */