#include <xen/errno.h>
#include <xen/init.h>
#include <xen/lib.h>
-#include <asm/page.h>
+#include <asm/asm_defns.h>
#include <asm/efibind.h>
+#include <asm/page.h>
#include <efi/efidef.h>
#include <efi/eficapsule.h>
#include <efi/eficon.h>
* not be directly supported by C compiler.
*/
asm volatile(
- " call *%3 \n"
+ " call *%[outstr] \n"
"0: hlt \n"
" jmp 0b \n"
- : "+c" (StdErr), "=d" (StdErr) : "1" (err), "rm" (StdErr->OutputString)
+ : "+c" (StdErr), "=d" (StdErr) ASM_CALL_CONSTRAINT
+ : "1" (err), [outstr] "rm" (StdErr->OutputString)
: "rax", "r8", "r9", "r10", "r11", "memory");
unreachable();
"jmp .Lret%=\n\t"
".popsection\n\t"
_ASM_EXTABLE(.Lret%=, .Lfix%=)
- : [exn] "+m" (res)
+ : [exn] "+m" (res) ASM_CALL_CONSTRAINT
: [stb] "r" (addr), "a" (tests[i].rax));
if ( res.raw != tests[i].res.raw )
"jmp .Lret%=\n\t" \
".popsection\n\t" \
_ASM_EXTABLE(.Lret%=, .Lfix%=) \
- : [exn] "+g" (stub_exn.info), constraints, \
+ : [exn] "+g" (stub_exn.info) ASM_CALL_CONSTRAINT, \
+ constraints, \
[stub] "r" (stub.func), \
"m" (*(uint8_t(*)[MAX_INST_LEN + 1])stub.ptr) ); \
if ( unlikely(~stub_exn.info.raw) ) \
#ifndef __ASSEMBLY__
void ret_from_intr(void);
+
+/*
+ * This output constraint should be used for any inline asm which has a "call"
+ * instruction. Otherwise the asm may be inserted before the frame pointer
+ * gets set up by the containing function.
+ */
+#ifdef CONFIG_FRAME_POINTER
+register unsigned long current_stack_pointer asm("rsp");
+# define ASM_CALL_CONSTRAINT , "+r" (current_stack_pointer)
+#else
+# define ASM_CALL_CONSTRAINT
+#endif
+
#endif
#ifndef NDEBUG
long res, tmp__; \
asm volatile ( \
"call hypercall_page + %c[offset]" \
- : "=a" (res), "=D" (tmp__) \
+ : "=a" (res), "=D" (tmp__) ASM_CALL_CONSTRAINT \
: [offset] "i" (hcall * 32), \
"1" ((long)(a1)) \
: "memory" ); \
asm volatile ( \
"call hypercall_page + %c[offset]" \
: "=a" (res), "=D" (tmp__), "=S" (tmp__) \
+ ASM_CALL_CONSTRAINT \
: [offset] "i" (hcall * 32), \
"1" ((long)(a1)), "2" ((long)(a2)) \
: "memory" ); \
asm volatile ( \
"call hypercall_page + %c[offset]" \
: "=a" (res), "=D" (tmp__), "=S" (tmp__), "=d" (tmp__) \
+ ASM_CALL_CONSTRAINT \
: [offset] "i" (hcall * 32), \
"1" ((long)(a1)), "2" ((long)(a2)), "3" ((long)(a3)) \
: "memory" ); \
asm volatile ( \
"call hypercall_page + %c[offset]" \
: "=a" (res), "=D" (tmp__), "=S" (tmp__), "=d" (tmp__), \
- "=&r" (tmp__) \
+ "=&r" (tmp__) ASM_CALL_CONSTRAINT \
: [offset] "i" (hcall * 32), \
"1" ((long)(a1)), "2" ((long)(a2)), "3" ((long)(a3)), \
"4" (_a4) \