stacktrace.h 1.1 KB

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