0001
0002 #ifndef _ASM_X86_FRAME_H
0003 #define _ASM_X86_FRAME_H
0004
0005 #include <asm/asm.h>
0006
0007
0008
0009
0010
0011
0012 #ifdef CONFIG_FRAME_POINTER
0013
0014 #ifdef __ASSEMBLY__
0015
0016 .macro FRAME_BEGIN
0017 push %_ASM_BP
0018 _ASM_MOV %_ASM_SP, %_ASM_BP
0019 .endm
0020
0021 .macro FRAME_END
0022 pop %_ASM_BP
0023 .endm
0024
0025 #ifdef CONFIG_X86_64
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 .macro ENCODE_FRAME_POINTER ptregs_offset=0
0036 leaq 1+\ptregs_offset(%rsp), %rbp
0037 .endm
0038 #else
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048 .macro ENCODE_FRAME_POINTER
0049 mov %esp, %ebp
0050 andl $0x7fffffff, %ebp
0051 .endm
0052 #endif
0053
0054 #else
0055
0056 #define FRAME_BEGIN \
0057 "push %" _ASM_BP "\n" \
0058 _ASM_MOV "%" _ASM_SP ", %" _ASM_BP "\n"
0059
0060 #define FRAME_END "pop %" _ASM_BP "\n"
0061
0062 #ifdef CONFIG_X86_64
0063
0064 #define ENCODE_FRAME_POINTER \
0065 "lea 1(%rsp), %rbp\n\t"
0066
0067 static inline unsigned long encode_frame_pointer(struct pt_regs *regs)
0068 {
0069 return (unsigned long)regs + 1;
0070 }
0071
0072 #else
0073
0074 #define ENCODE_FRAME_POINTER \
0075 "movl %esp, %ebp\n\t" \
0076 "andl $0x7fffffff, %ebp\n\t"
0077
0078 static inline unsigned long encode_frame_pointer(struct pt_regs *regs)
0079 {
0080 return (unsigned long)regs & 0x7fffffff;
0081 }
0082
0083 #endif
0084
0085 #endif
0086
0087 #define FRAME_OFFSET __ASM_SEL(4, 8)
0088
0089 #else
0090
0091 #ifdef __ASSEMBLY__
0092
0093 .macro ENCODE_FRAME_POINTER ptregs_offset=0
0094 .endm
0095
0096 #else
0097
0098 #define ENCODE_FRAME_POINTER
0099
0100 static inline unsigned long encode_frame_pointer(struct pt_regs *regs)
0101 {
0102 return 0;
0103 }
0104
0105 #endif
0106
0107 #define FRAME_BEGIN
0108 #define FRAME_END
0109 #define FRAME_OFFSET 0
0110
0111 #endif
0112
0113 #endif