1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 2997963edSJosh Poimboeuf #ifndef _ASM_X86_FRAME_H 3997963edSJosh Poimboeuf #define _ASM_X86_FRAME_H 4997963edSJosh Poimboeuf 54625cd63SJan Beulich #include <asm/asm.h> 6bb898558SAl Viro 7997963edSJosh Poimboeuf /* 8997963edSJosh Poimboeuf * These are stack frame creation macros. They should be used by every 9997963edSJosh Poimboeuf * callable non-leaf asm function to make kernel stack traces more reliable. 10997963edSJosh Poimboeuf */ 11ec518655SJosh Poimboeuf 12bb898558SAl Viro #ifdef CONFIG_FRAME_POINTER 13997963edSJosh Poimboeuf 14ec518655SJosh Poimboeuf #ifdef __ASSEMBLY__ 15ec518655SJosh Poimboeuf 16997963edSJosh Poimboeuf .macro FRAME_BEGIN 17997963edSJosh Poimboeuf push %_ASM_BP 18997963edSJosh Poimboeuf _ASM_MOV %_ASM_SP, %_ASM_BP 19bb898558SAl Viro .endm 20997963edSJosh Poimboeuf 21997963edSJosh Poimboeuf .macro FRAME_END 22997963edSJosh Poimboeuf pop %_ASM_BP 23bb898558SAl Viro .endm 24997963edSJosh Poimboeuf 25ec518655SJosh Poimboeuf #else /* !__ASSEMBLY__ */ 26ec518655SJosh Poimboeuf 27ec518655SJosh Poimboeuf #define FRAME_BEGIN \ 28ec518655SJosh Poimboeuf "push %" _ASM_BP "\n" \ 29ec518655SJosh Poimboeuf _ASM_MOV "%" _ASM_SP ", %" _ASM_BP "\n" 30ec518655SJosh Poimboeuf 31ec518655SJosh Poimboeuf #define FRAME_END "pop %" _ASM_BP "\n" 32ec518655SJosh Poimboeuf 33ec518655SJosh Poimboeuf #endif /* __ASSEMBLY__ */ 34ec518655SJosh Poimboeuf 35997963edSJosh Poimboeuf #define FRAME_OFFSET __ASM_SEL(4, 8) 36997963edSJosh Poimboeuf 37997963edSJosh Poimboeuf #else /* !CONFIG_FRAME_POINTER */ 38997963edSJosh Poimboeuf 39997963edSJosh Poimboeuf #define FRAME_BEGIN 40997963edSJosh Poimboeuf #define FRAME_END 41997963edSJosh Poimboeuf #define FRAME_OFFSET 0 42997963edSJosh Poimboeuf 43997963edSJosh Poimboeuf #endif /* CONFIG_FRAME_POINTER */ 44bb898558SAl Viro 45997963edSJosh Poimboeuf #endif /* _ASM_X86_FRAME_H */ 46