GAS of at least version 2.34 complains:
Warning: no instruction mnemonic suffix given and no register operands; using default for `lret'
This is legitimate, as without a suffix, there are up to 3 possible encodings
actually meant.
Use l/q suffixes as appropriate, using __ASM_SEL() in cases where we need to
conditionally select between the suffixes. Use the same trick to clean up
some code32/64 statements.
Sadly, this cannot be done for the single ambiguous use of lcall, because
lcallq isn't accepted as a valid mnemonic. Leave the XSA-298 PoC as it is.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
jmp HYPERCALL_iret /* PV guests use the 'iret' hypercall. */
#else
- iret /* HVM guests use a real 'iret' instruction. */
+ iretl /* HVM guests use a real 'iret' instruction. */
#endif
.endm
{
asm volatile ("push %0;"
"push $1f;"
-#if __x86_64__
- "rex64 "
-#endif
- "lret; 1:"
+ __ASM_SEL(lretl, lretq) "; 1:"
:: "rme" (cs));
}
ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz "yes")
.text
-#ifdef __x86_64__
- .code64
-#else
- .code32
-#endif
+ __ASM_SEL(.code32, .code64)
/* PV entry point. */
GLOBAL(_start)
void entry_NMI_task(void);
asm("exit_NMI_task:"
- "iret;"
+ "iretl;"
"entry_NMI_task:;"
"push $0;"
#endif
"mov $0x1e51c0de, %eax;"
#if defined (CONFIG_HVM)
-#ifdef __x86_64__
- "rex64 "
-#endif
- "iret;"
+ __ASM_SEL(iretl, iretq) ";"
#else /* CONFIG_HVM */
#ifdef __x86_64__
"push $0;"
asm(".align 16;"
"test_int_handler:"
"movl $0xc0de, %eax;"
-#ifdef __x86_64__
- "rex64 "
-#endif
- "iret"
+ __ASM_SEL(iretl, iretq)
);
static const struct xtf_idte idte = {
asm volatile ("push $%c[cs16];"
"push $1f;"
-#ifdef __x86_64__
- "rex64 "
-#endif
- "lret; 1:"
+ __ASM_SEL(lretl, lretq) ";"
- ".code16;"
+ "1: .code16;"
"start_16bit:;"
_ASM_XEN_FEP
"int $" STR(X86_VEC_AVAIL) ";"
"ljmpl $%c[cs], $.Ldone;"
"end_16bit:;"
-#if __x86_64__
- ".code64;"
-#else
- ".code32;"
-#endif
+
+ __ASM_SEL(.code32, .code64) ";"
".Ldone:"
: "=a" (res)
: "0" (0),
unsigned int gate_target(void);
asm ("gate_target:;"
"mov %cs, %eax;"
-#ifdef __x86_64__
- "rex64 "
-#endif
- "lret;");
+ __ASM_SEL(lretl, lretq)
+ );
static void __user_text user1(void)
{