~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/x86/include/asm/stacktrace.h

Version: ~ [ linux-5.18-rc6 ] ~ [ linux-5.17.6 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.38 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.114 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.192 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.241 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.277 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.312 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.302 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  *  Copyright (C) 1991, 1992  Linus Torvalds
  3  *  Copyright (C) 2000, 2001, 2002 Andi Kleen, SuSE Labs
  4  */
  5 
  6 #ifndef _ASM_X86_STACKTRACE_H
  7 #define _ASM_X86_STACKTRACE_H
  8 
  9 #include <linux/uaccess.h>
 10 #include <linux/ptrace.h>
 11 
 12 extern int kstack_depth_to_print;
 13 
 14 struct thread_info;
 15 struct stacktrace_ops;
 16 
 17 typedef unsigned long (*walk_stack_t)(struct thread_info *tinfo,
 18                                       unsigned long *stack,
 19                                       unsigned long bp,
 20                                       const struct stacktrace_ops *ops,
 21                                       void *data,
 22                                       unsigned long *end,
 23                                       int *graph);
 24 
 25 extern unsigned long
 26 print_context_stack(struct thread_info *tinfo,
 27                     unsigned long *stack, unsigned long bp,
 28                     const struct stacktrace_ops *ops, void *data,
 29                     unsigned long *end, int *graph);
 30 
 31 extern unsigned long
 32 print_context_stack_bp(struct thread_info *tinfo,
 33                        unsigned long *stack, unsigned long bp,
 34                        const struct stacktrace_ops *ops, void *data,
 35                        unsigned long *end, int *graph);
 36 
 37 /* Generic stack tracer with callbacks */
 38 
 39 struct stacktrace_ops {
 40         void (*address)(void *data, unsigned long address, int reliable);
 41         /* On negative return stop dumping */
 42         int (*stack)(void *data, char *name);
 43         walk_stack_t    walk_stack;
 44 };
 45 
 46 void dump_trace(struct task_struct *tsk, struct pt_regs *regs,
 47                 unsigned long *stack, unsigned long bp,
 48                 const struct stacktrace_ops *ops, void *data);
 49 
 50 #ifdef CONFIG_X86_32
 51 #define STACKSLOTS_PER_LINE 8
 52 #define get_bp(bp) asm("movl %%ebp, %0" : "=r" (bp) :)
 53 #else
 54 #define STACKSLOTS_PER_LINE 4
 55 #define get_bp(bp) asm("movq %%rbp, %0" : "=r" (bp) :)
 56 #endif
 57 
 58 #ifdef CONFIG_FRAME_POINTER
 59 static inline unsigned long
 60 stack_frame(struct task_struct *task, struct pt_regs *regs)
 61 {
 62         unsigned long bp;
 63 
 64         if (regs)
 65                 return regs->bp;
 66 
 67         if (task == current) {
 68                 /* Grab bp right from our regs */
 69                 get_bp(bp);
 70                 return bp;
 71         }
 72 
 73         /* bp is the last reg pushed by switch_to */
 74         return *(unsigned long *)task->thread.sp;
 75 }
 76 #else
 77 static inline unsigned long
 78 stack_frame(struct task_struct *task, struct pt_regs *regs)
 79 {
 80         return 0;
 81 }
 82 #endif
 83 
 84 extern void
 85 show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
 86                    unsigned long *stack, unsigned long bp, char *log_lvl);
 87 
 88 extern void
 89 show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
 90                    unsigned long *sp, unsigned long bp, char *log_lvl);
 91 
 92 extern unsigned int code_bytes;
 93 
 94 /* The form of the top of the frame on the stack */
 95 struct stack_frame {
 96         struct stack_frame *next_frame;
 97         unsigned long return_address;
 98 };
 99 
100 struct stack_frame_ia32 {
101     u32 next_frame;
102     u32 return_address;
103 };
104 
105 static inline unsigned long caller_frame_pointer(void)
106 {
107         struct stack_frame *frame;
108 
109         get_bp(frame);
110 
111 #ifdef CONFIG_FRAME_POINTER
112         frame = frame->next_frame;
113 #endif
114 
115         return (unsigned long)frame;
116 }
117 
118 #endif /* _ASM_X86_STACKTRACE_H */
119 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp