Loading...
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_X86_FRAME_H
3#define _ASM_X86_FRAME_H
4
5#include <asm/asm.h>
6
7/*
8 * These are stack frame creation macros. They should be used by every
9 * callable non-leaf asm function to make kernel stack traces more reliable.
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#else /* !__ASSEMBLY__ */
26
27#define FRAME_BEGIN \
28 "push %" _ASM_BP "\n" \
29 _ASM_MOV "%" _ASM_SP ", %" _ASM_BP "\n"
30
31#define FRAME_END "pop %" _ASM_BP "\n"
32
33#endif /* __ASSEMBLY__ */
34
35#define FRAME_OFFSET __ASM_SEL(4, 8)
36
37#else /* !CONFIG_FRAME_POINTER */
38
39#define FRAME_BEGIN
40#define FRAME_END
41#define FRAME_OFFSET 0
42
43#endif /* CONFIG_FRAME_POINTER */
44
45#endif /* _ASM_X86_FRAME_H */
1#ifdef __ASSEMBLY__
2
3#include <asm/asm.h>
4#include <asm/dwarf2.h>
5
6/* The annotation hides the frame from the unwinder and makes it look
7 like a ordinary ebp save/restore. This avoids some special cases for
8 frame pointer later */
9#ifdef CONFIG_FRAME_POINTER
10 .macro FRAME
11 __ASM_SIZE(push,_cfi) %__ASM_REG(bp)
12 CFI_REL_OFFSET __ASM_REG(bp), 0
13 __ASM_SIZE(mov) %__ASM_REG(sp), %__ASM_REG(bp)
14 .endm
15 .macro ENDFRAME
16 __ASM_SIZE(pop,_cfi) %__ASM_REG(bp)
17 CFI_RESTORE __ASM_REG(bp)
18 .endm
19#else
20 .macro FRAME
21 .endm
22 .macro ENDFRAME
23 .endm
24#endif
25
26#endif /* __ASSEMBLY__ */