arch/x86/include/asm/ftrace.h
changeset 2 d1f6d8b6f81c
parent 0 aa628870c1d3
equal deleted inserted replaced
1:0056487c491e 2:d1f6d8b6f81c
     1 #ifndef _ASM_X86_FTRACE_H
     1 #ifndef _ASM_X86_FTRACE_H
     2 #define _ASM_X86_FTRACE_H
     2 #define _ASM_X86_FTRACE_H
       
     3 
       
     4 #ifdef __ASSEMBLY__
       
     5 
       
     6 	.macro MCOUNT_SAVE_FRAME
       
     7 	/* taken from glibc */
       
     8 	subq $0x38, %rsp
       
     9 	movq %rax, (%rsp)
       
    10 	movq %rcx, 8(%rsp)
       
    11 	movq %rdx, 16(%rsp)
       
    12 	movq %rsi, 24(%rsp)
       
    13 	movq %rdi, 32(%rsp)
       
    14 	movq %r8, 40(%rsp)
       
    15 	movq %r9, 48(%rsp)
       
    16 	.endm
       
    17 
       
    18 	.macro MCOUNT_RESTORE_FRAME
       
    19 	movq 48(%rsp), %r9
       
    20 	movq 40(%rsp), %r8
       
    21 	movq 32(%rsp), %rdi
       
    22 	movq 24(%rsp), %rsi
       
    23 	movq 16(%rsp), %rdx
       
    24 	movq 8(%rsp), %rcx
       
    25 	movq (%rsp), %rax
       
    26 	addq $0x38, %rsp
       
    27 	.endm
       
    28 
       
    29 #endif
     3 
    30 
     4 #ifdef CONFIG_FUNCTION_TRACER
    31 #ifdef CONFIG_FUNCTION_TRACER
     5 #define MCOUNT_ADDR		((long)(mcount))
    32 #define MCOUNT_ADDR		((long)(mcount))
     6 #define MCOUNT_INSN_SIZE	5 /* sizeof mcount call */
    33 #define MCOUNT_INSN_SIZE	5 /* sizeof mcount call */
     7 
    34 
    15 	 * The addr points to the 4 byte offset and the caller of this
    42 	 * The addr points to the 4 byte offset and the caller of this
    16 	 * function wants the pointer to e8. Simply subtract one.
    43 	 * function wants the pointer to e8. Simply subtract one.
    17 	 */
    44 	 */
    18 	return addr - 1;
    45 	return addr - 1;
    19 }
    46 }
    20 #endif
       
    21 
    47 
       
    48 #ifdef CONFIG_DYNAMIC_FTRACE
       
    49 
       
    50 struct dyn_arch_ftrace {
       
    51 	/* No extra data needed for x86 */
       
    52 };
       
    53 
       
    54 #endif /*  CONFIG_DYNAMIC_FTRACE */
       
    55 #endif /* __ASSEMBLY__ */
    22 #endif /* CONFIG_FUNCTION_TRACER */
    56 #endif /* CONFIG_FUNCTION_TRACER */
    23 
    57 
       
    58 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
       
    59 
       
    60 #ifndef __ASSEMBLY__
       
    61 
       
    62 /*
       
    63  * Stack of return addresses for functions
       
    64  * of a thread.
       
    65  * Used in struct thread_info
       
    66  */
       
    67 struct ftrace_ret_stack {
       
    68 	unsigned long ret;
       
    69 	unsigned long func;
       
    70 	unsigned long long calltime;
       
    71 };
       
    72 
       
    73 /*
       
    74  * Primary handler of a function return.
       
    75  * It relays on ftrace_return_to_handler.
       
    76  * Defined in entry_32/64.S
       
    77  */
       
    78 extern void return_to_handler(void);
       
    79 
       
    80 #endif /* __ASSEMBLY__ */
       
    81 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
       
    82 
    24 #endif /* _ASM_X86_FTRACE_H */
    83 #endif /* _ASM_X86_FTRACE_H */