x86/asm: Add C versions of frame pointer macros
[deliverable/linux.git] / arch / x86 / include / asm / frame.h
CommitLineData
997963ed
JP
1#ifndef _ASM_X86_FRAME_H
2#define _ASM_X86_FRAME_H
3
4625cd63 4#include <asm/asm.h>
ecaf45ee 5
997963ed
JP
6/*
7 * These are stack frame creation macros. They should be used by every
8 * callable non-leaf asm function to make kernel stack traces more reliable.
9 */
ec518655 10
ecaf45ee 11#ifdef CONFIG_FRAME_POINTER
997963ed 12
ec518655
JP
13#ifdef __ASSEMBLY__
14
997963ed
JP
15.macro FRAME_BEGIN
16 push %_ASM_BP
17 _ASM_MOV %_ASM_SP, %_ASM_BP
18.endm
19
20.macro FRAME_END
21 pop %_ASM_BP
22.endm
23
ec518655
JP
24#else /* !__ASSEMBLY__ */
25
26#define FRAME_BEGIN \
27 "push %" _ASM_BP "\n" \
28 _ASM_MOV "%" _ASM_SP ", %" _ASM_BP "\n"
29
30#define FRAME_END "pop %" _ASM_BP "\n"
31
32#endif /* __ASSEMBLY__ */
33
997963ed
JP
34#define FRAME_OFFSET __ASM_SEL(4, 8)
35
36#else /* !CONFIG_FRAME_POINTER */
37
38#define FRAME_BEGIN
39#define FRAME_END
40#define FRAME_OFFSET 0
41
42#endif /* CONFIG_FRAME_POINTER */
7e02cb94 43
997963ed 44#endif /* _ASM_X86_FRAME_H */
This page took 0.618175 seconds and 5 git commands to generate.