1
2 #ifndef _ASM_X86_FRAME_H
3 #define _ASM_X86_FRAME_H
4
5 #include <asm/asm.h>
6
7
8
9
10
11
12 #ifdef CONFIG_FRAME_POINTER
13
14 #ifdef __ASSEMBLY__
15
16 .macro FRAME_BEGIN
17 push %_ASM_BP
18 _ASM_MOV %_ASM_SP, %_ASM_BP
19 .endm
20
21 .macro FRAME_END
22 pop %_ASM_BP
23 .endm
24
25 #ifdef CONFIG_X86_64
26
27
28
29
30
31
32
33
34
35 .macro ENCODE_FRAME_POINTER ptregs_offset=0
36 leaq 1+\ptregs_offset(%rsp), %rbp
37 .endm
38 #else
39
40
41
42
43
44
45
46
47
48 .macro ENCODE_FRAME_POINTER
49 mov %esp, %ebp
50 andl $0x7fffffff, %ebp
51 .endm
52 #endif
53
54 #else
55
56 #define FRAME_BEGIN \
57 "push %" _ASM_BP "\n" \
58 _ASM_MOV "%" _ASM_SP ", %" _ASM_BP "\n"
59
60 #define FRAME_END "pop %" _ASM_BP "\n"
61
62 #ifdef CONFIG_X86_64
63 #define ENCODE_FRAME_POINTER \
64 "lea 1(%rsp), %rbp\n\t"
65 #else
66 #define ENCODE_FRAME_POINTER \
67 "movl %esp, %ebp\n\t" \
68 "andl $0x7fffffff, %ebp\n\t"
69 #endif
70
71 #endif
72
73 #define FRAME_OFFSET __ASM_SEL(4, 8)
74
75 #else
76
77 #ifdef __ASSEMBLY__
78
79 .macro ENCODE_FRAME_POINTER ptregs_offset=0
80 .endm
81
82 #else
83
84 #define ENCODE_FRAME_POINTER
85
86 #endif
87
88 #define FRAME_BEGIN
89 #define FRAME_END
90 #define FRAME_OFFSET 0
91
92 #endif
93
94 #endif