x86/asm: Use ASM_CALL() macro for inline asm statements with call instructions

Inline asm statements which have call instructions can be problematic.
GCC doesn't know about the call instructions, so in some cases it can
insert the asm before setting up the frame pointer.  This can result in
bad stack traces when unwinding from the called function.

Previously we worked around this issue by listing the stack pointer as
an input/output constraint for the inline asm.  That works for GCC, but
unfortunately it doesn't work for Clang.  In fact, it causes Clang to
corrupt the stack pointer.

Introduce a new ASM_CALL() macro, which should be used for all inline
statements which have call instructions.  On GCC with frame pointers, it
sets the stack pointer as an input/output constraint, like before.  On
GCC without frame pointers, it does nothing, which saves a small amount
of text.  On Clang, it does nothing (for now).

Reported-by: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
17 files changed