stack.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  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. #ifndef _ASM_TILE_STACK_H
  15. #define _ASM_TILE_STACK_H
  16. #include <linux/types.h>
  17. #include <linux/sched.h>
  18. #include <asm/backtrace.h>
  19. #include <asm/page.h>
  20. #include <hv/hypervisor.h>
  21. /* Everything we need to keep track of a backtrace iteration */
  22. struct KBacktraceIterator {
  23. BacktraceIterator it;
  24. struct task_struct *task; /* task we are backtracing */
  25. int end; /* iteration complete. */
  26. int new_context; /* new context is starting */
  27. int profile; /* profiling, so stop on async intrpt */
  28. int verbose; /* printk extra info (don't want to
  29. * do this for profiling) */
  30. int is_current; /* backtracing current task */
  31. };
  32. /* Iteration methods for kernel backtraces */
  33. /*
  34. * Initialize a KBacktraceIterator from a task_struct, and optionally from
  35. * a set of registers. If the registers are omitted, the process is
  36. * assumed to be descheduled, and registers are read from the process's
  37. * thread_struct and stack. "verbose" means to printk some additional
  38. * information about fault handlers as we pass them on the stack.
  39. */
  40. extern void KBacktraceIterator_init(struct KBacktraceIterator *kbt,
  41. struct task_struct *, struct pt_regs *);
  42. /* Initialize iterator based on current stack. */
  43. extern void KBacktraceIterator_init_current(struct KBacktraceIterator *kbt);
  44. /* Helper method for above. */
  45. extern void _KBacktraceIterator_init_current(struct KBacktraceIterator *kbt,
  46. ulong pc, ulong lr, ulong sp, ulong r52);
  47. /* No more frames? */
  48. extern int KBacktraceIterator_end(struct KBacktraceIterator *kbt);
  49. /* Advance to the next frame. */
  50. extern void KBacktraceIterator_next(struct KBacktraceIterator *kbt);
  51. /* Dump just the contents of the pt_regs structure. */
  52. extern void tile_show_regs(struct pt_regs *);
  53. /*
  54. * Dump stack given complete register info. Use only from the
  55. * architecture-specific code; show_stack()
  56. * and dump_stack() are architecture-independent entry points.
  57. */
  58. extern void tile_show_stack(struct KBacktraceIterator *);
  59. #endif /* _ASM_TILE_STACK_H */