Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/asm: Add C versions of frame pointer macros

Add C versions of the frame pointer macros which can be used to
create a stack frame in inline assembly.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Bernd Petrovitsch <bernd@petrovitsch.priv.at>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Chris J Arges <chris.j.arges@canonical.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Pedro Alves <palves@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/f6786a282bf232ede3e2866414eae3cf02c7d662.1450442274.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Josh Poimboeuf and committed by
Ingo Molnar
ec518655 997963ed

+13 -3
+13 -3
arch/x86/include/asm/frame.h
··· 1 1 #ifndef _ASM_X86_FRAME_H 2 2 #define _ASM_X86_FRAME_H 3 3 4 - #ifdef __ASSEMBLY__ 5 - 6 4 #include <asm/asm.h> 7 5 8 6 /* 9 7 * These are stack frame creation macros. They should be used by every 10 8 * callable non-leaf asm function to make kernel stack traces more reliable. 11 9 */ 10 + 12 11 #ifdef CONFIG_FRAME_POINTER 12 + 13 + #ifdef __ASSEMBLY__ 13 14 14 15 .macro FRAME_BEGIN 15 16 push %_ASM_BP ··· 20 19 .macro FRAME_END 21 20 pop %_ASM_BP 22 21 .endm 22 + 23 + #else /* !__ASSEMBLY__ */ 24 + 25 + #define FRAME_BEGIN \ 26 + "push %" _ASM_BP "\n" \ 27 + _ASM_MOV "%" _ASM_SP ", %" _ASM_BP "\n" 28 + 29 + #define FRAME_END "pop %" _ASM_BP "\n" 30 + 31 + #endif /* __ASSEMBLY__ */ 23 32 24 33 #define FRAME_OFFSET __ASM_SEL(4, 8) 25 34 ··· 41 30 42 31 #endif /* CONFIG_FRAME_POINTER */ 43 32 44 - #endif /* __ASSEMBLY__ */ 45 33 #endif /* _ASM_X86_FRAME_H */