Skip to content

Commit

Permalink
x86, kvm: Remove incorrect redundant assembly constraint
Browse files Browse the repository at this point in the history
In __emulate_1op_rax_rdx, we use "+a" and "+d" which are input/output
constraints, and *then* use "a" and "d" as input constraints.  This is
incorrect, but happens to work on some versions of gcc.

However, it breaks gcc with -O0 and icc, and may break on future
versions of gcc.

Reported-and-tested-by: Melanie Blower <melanie.blower@intel.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Link: http://lkml.kernel.org/r/B3584E72CFEBED439A3ECA9BCE67A4EF1B17AF90@FMSMSX107.amr.corp.intel.com
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
  • Loading branch information
H. Peter Anvin committed Nov 26, 2012
1 parent 9489e9d commit cb7cb28
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions arch/x86/kvm/emulate.c
Original file line number Diff line number Diff line change
@@ -426,8 +426,7 @@ static void invalidate_registers(struct x86_emulate_ctxt *ctxt)
_ASM_EXTABLE(1b, 3b) \
: "=m" ((ctxt)->eflags), "=&r" (_tmp), \
"+a" (*rax), "+d" (*rdx), "+qm"(_ex) \
: "i" (EFLAGS_MASK), "m" ((ctxt)->src.val), \
"a" (*rax), "d" (*rdx)); \
: "i" (EFLAGS_MASK), "m" ((ctxt)->src.val)); \
} while (0)

/* instruction has only one source operand, destination is implicit (e.g. mul, div, imul, idiv) */

0 comments on commit cb7cb28

Please sign in to comment.