blob: 4d97a2db932e90784d37eb4f53ff7da3f80eb4e2 [file] [log] [blame]
Chris Metcalf867e3592010-05-28 23:09:12 -04001/*
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>
Chris Metcalf76c567f2011-02-28 16:37:34 -050021#include <asm/page.h>
Chris Metcalf867e3592010-05-28 23:09:12 -040022#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 */
Chris Metcalf76c567f2011-02-28 16:37:34 -050028 pte_t *pgtable; /* page table for user space access */
Chris Metcalf867e3592010-05-28 23:09:12 -040029 int end; /* iteration complete. */
30 int new_context; /* new context is starting */
31 int profile; /* profiling, so stop on async intrpt */
32 int verbose; /* printk extra info (don't want to
33 * do this for profiling) */
34 int is_current; /* backtracing current task */
35};
36
37/* Iteration methods for kernel backtraces */
38
39/*
40 * Initialize a KBacktraceIterator from a task_struct, and optionally from
41 * a set of registers. If the registers are omitted, the process is
42 * assumed to be descheduled, and registers are read from the process's
43 * thread_struct and stack. "verbose" means to printk some additional
44 * information about fault handlers as we pass them on the stack.
45 */
46extern void KBacktraceIterator_init(struct KBacktraceIterator *kbt,
47 struct task_struct *, struct pt_regs *);
48
49/* Initialize iterator based on current stack. */
50extern void KBacktraceIterator_init_current(struct KBacktraceIterator *kbt);
51
Chris Metcalf0707ad32010-06-25 17:04:17 -040052/* Helper method for above. */
53extern void _KBacktraceIterator_init_current(struct KBacktraceIterator *kbt,
54 ulong pc, ulong lr, ulong sp, ulong r52);
55
Chris Metcalf867e3592010-05-28 23:09:12 -040056/* No more frames? */
57extern int KBacktraceIterator_end(struct KBacktraceIterator *kbt);
58
59/* Advance to the next frame. */
60extern void KBacktraceIterator_next(struct KBacktraceIterator *kbt);
61
62/*
63 * Dump stack given complete register info. Use only from the
64 * architecture-specific code; show_stack()
65 * and dump_stack() (in entry.S) are architecture-independent entry points.
66 */
67extern void tile_show_stack(struct KBacktraceIterator *, int headers);
68
69/* Dump stack of current process, with registers to seed the backtrace. */
70extern void dump_stack_regs(struct pt_regs *);
71
Chris Metcalf0707ad32010-06-25 17:04:17 -040072/* Helper method for assembly dump_stack(). */
73extern void _dump_stack(int dummy, ulong pc, ulong lr, ulong sp, ulong r52);
Chris Metcalf867e3592010-05-28 23:09:12 -040074
75#endif /* _ASM_TILE_STACK_H */