frame.h 815 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_X86_FRAME_H
  3. #define _ASM_X86_FRAME_H
  4. #include <asm/asm.h>
  5. /*
  6. * These are stack frame creation macros. They should be used by every
  7. * callable non-leaf asm function to make kernel stack traces more reliable.
  8. */
  9. #ifdef CONFIG_FRAME_POINTER
  10. #ifdef __ASSEMBLY__
  11. .macro FRAME_BEGIN
  12. push %_ASM_BP
  13. _ASM_MOV %_ASM_SP, %_ASM_BP
  14. .endm
  15. .macro FRAME_END
  16. pop %_ASM_BP
  17. .endm
  18. #else /* !__ASSEMBLY__ */
  19. #define FRAME_BEGIN \
  20. "push %" _ASM_BP "\n" \
  21. _ASM_MOV "%" _ASM_SP ", %" _ASM_BP "\n"
  22. #define FRAME_END "pop %" _ASM_BP "\n"
  23. #endif /* __ASSEMBLY__ */
  24. #define FRAME_OFFSET __ASM_SEL(4, 8)
  25. #else /* !CONFIG_FRAME_POINTER */
  26. #define FRAME_BEGIN
  27. #define FRAME_END
  28. #define FRAME_OFFSET 0
  29. #endif /* CONFIG_FRAME_POINTER */
  30. #endif /* _ASM_X86_FRAME_H */