stacktrace.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef _ASM_UML_STACKTRACE_H
  2. #define _ASM_UML_STACKTRACE_H
  3. #include <linux/uaccess.h>
  4. #include <linux/ptrace.h>
  5. struct stack_frame {
  6. struct stack_frame *next_frame;
  7. unsigned long return_address;
  8. };
  9. struct stacktrace_ops {
  10. void (*address)(void *data, unsigned long address, int reliable);
  11. };
  12. #ifdef CONFIG_FRAME_POINTER
  13. static inline unsigned long
  14. get_frame_pointer(struct task_struct *task, struct pt_regs *segv_regs)
  15. {
  16. if (!task || task == current)
  17. return segv_regs ? PT_REGS_BP(segv_regs) : current_bp();
  18. return KSTK_EBP(task);
  19. }
  20. #else
  21. static inline unsigned long
  22. get_frame_pointer(struct task_struct *task, struct pt_regs *segv_regs)
  23. {
  24. return 0;
  25. }
  26. #endif
  27. static inline unsigned long
  28. *get_stack_pointer(struct task_struct *task, struct pt_regs *segv_regs)
  29. {
  30. if (!task || task == current)
  31. return segv_regs ? (unsigned long *)PT_REGS_SP(segv_regs) : current_sp();
  32. return (unsigned long *)KSTK_ESP(task);
  33. }
  34. void dump_trace(struct task_struct *tsk, const struct stacktrace_ops *ops, void *data);
  35. #endif /* _ASM_UML_STACKTRACE_H */