kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bill Wendling <morbo@google.com>
To: kvm@vger.kernel.org
Cc: oupton@google.com, pbonzini@redhat.com, drjones@redhat.com,
	Bill Wendling <morbo@google.com>
Subject: [kvm-unit-tests PATCH 3/7] x86: realmode: syscall: add explicit size suffix to ambiguous instructions
Date: Wed, 26 Feb 2020 01:44:25 -0800	[thread overview]
Message-ID: <20200226094433.210968-7-morbo@google.com> (raw)
In-Reply-To: <20200226094433.210968-1-morbo@google.com>

Clang requires explicit size suffixes for potentially ambiguous
instructions:

x86/realmode.c:1647:2: error: ambiguous instructions require an explicit suffix (could be 'cmpb', 'cmpw', or 'cmpl')
        MK_INSN_PERF(perf_memory_load, "cmp $0, (%edi)");
        ^
x86/realmode.c:1591:10: note: expanded from macro 'MK_INSN_PERF'
                      "1:" insn "\n"                            \
                       ^
<inline asm>:8:3: note: instantiated into assembly here
1:cmp $0, (%edi)
  ^

The 'w' and 'l' suffixes generate code that's identical to the gcc
version without them.

Signed-off-by: Bill Wendling <morbo@google.com>
---
 x86/realmode.c | 6 +++---
 x86/syscall.c  | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/x86/realmode.c b/x86/realmode.c
index f5967ef..31f84d0 100644
--- a/x86/realmode.c
+++ b/x86/realmode.c
@@ -1644,7 +1644,7 @@ static void test_perf_memory_load(void)
 {
 	u32 cyc, tmp;
 
-	MK_INSN_PERF(perf_memory_load, "cmp $0, (%edi)");
+	MK_INSN_PERF(perf_memory_load, "cmpw $0, (%edi)");
 
 	init_inregs(&(struct regs){ .edi = (u32)&tmp });
 
@@ -1657,7 +1657,7 @@ static void test_perf_memory_store(void)
 {
 	u32 cyc, tmp;
 
-	MK_INSN_PERF(perf_memory_store, "mov %ax, (%edi)");
+	MK_INSN_PERF(perf_memory_store, "movw %ax, (%edi)");
 
 	init_inregs(&(struct regs){ .edi = (u32)&tmp });
 
@@ -1670,7 +1670,7 @@ static void test_perf_memory_rmw(void)
 {
 	u32 cyc, tmp;
 
-	MK_INSN_PERF(perf_memory_rmw, "add $1, (%edi)");
+	MK_INSN_PERF(perf_memory_rmw, "addw $1, (%edi)");
 
 	init_inregs(&(struct regs){ .edi = (u32)&tmp });
 
diff --git a/x86/syscall.c b/x86/syscall.c
index b4f5ac0..b7e29d6 100644
--- a/x86/syscall.c
+++ b/x86/syscall.c
@@ -38,7 +38,7 @@ static void handle_db(struct ex_regs *regs)
 
 /* expects desired ring 3 flags in rax */
 asm("syscall32_target:\n"
-    "   cmp $0, code_segment_upon_db(%rip)\n"
+    "   cmpl $0, code_segment_upon_db(%rip)\n"
     "   jne back_to_test\n"
     "   mov %eax,%r11d\n"
     "   sysretl\n");
-- 
2.25.0.265.gbab2e86ba0-goog


  parent reply	other threads:[~2020-02-26  9:44 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-26  7:44 [kvm-unit-tests PATCH 0/7] Fixes for clang builds morbo
2020-02-26  7:44 ` [kvm-unit-tests PATCH 1/7] x86: emulator: use "SSE2" for the target morbo
2020-02-26  7:44 ` [kvm-unit-tests PATCH 2/7] pci: use uint32_t for unsigned long values morbo
2020-02-26  7:59   ` Andrew Jones
2020-02-26  9:02     ` Bill Wendling
2020-02-26  9:24       ` Andrew Jones
2020-02-26  7:44 ` [kvm-unit-tests PATCH 3/7] x86: realmode: syscall: add explicit size suffix to ambiguous instructions morbo
2020-02-26  7:44 ` [kvm-unit-tests PATCH 4/7] svm: change operand to output-only for matching constraint morbo
2020-02-26  7:44 ` [kvm-unit-tests PATCH 5/7] svm: convert neg shift to unsigned shift morbo
2020-02-26  7:44 ` [kvm-unit-tests PATCH 6/7] x86: VMX: use inline asm to get stack pointer morbo
2020-02-26  7:44 ` [kvm-unit-tests PATCH 7/7] x86: VMX: the "noclone" attribute is gcc-specific morbo
2020-02-26  8:21   ` Oliver Upton
2020-02-26  8:22     ` Oliver Upton
2020-02-26  9:44 ` [kvm-unit-tests PATCH v2 0/7] Fixes for clang builds Bill Wendling
2020-02-26  9:44   ` [kvm-unit-tests PATCH 1/7] x86: emulator: use "SSE2" for the target Bill Wendling
2020-02-26  9:44   ` [kvm-unit-tests PATCH v2 1/7] x86: pmu: Test WRMSR on a running counter Bill Wendling
2020-02-26  9:44   ` [kvm-unit-tests PATCH 2/7] pci: use uint32_t for unsigned long values Bill Wendling
2020-02-28 11:04     ` Paolo Bonzini
2020-02-28 12:46       ` Andrew Jones
2020-02-28 13:02         ` Paolo Bonzini
2020-02-26  9:44   ` [kvm-unit-tests PATCH v2 2/7] x86: provide enabled and disabled variation of the PCID test Bill Wendling
2020-02-26  9:44   ` [kvm-unit-tests PATCH v2 3/7] x86: pmu: Test perfctr overflow after WRMSR on a running counter Bill Wendling
2020-02-26  9:44   ` Bill Wendling [this message]
2020-02-26  9:44   ` [kvm-unit-tests PATCH 4/7] svm: change operand to output-only for matching constraint Bill Wendling
2020-02-26  9:44   ` [kvm-unit-tests PATCH v2 4/7] vmx: tweak XFAILS for #DB test Bill Wendling
2020-02-26  9:44   ` [kvm-unit-tests PATCH 5/7] svm: convert neg shift to unsigned shift Bill Wendling
2020-02-28 11:12     ` Paolo Bonzini
2020-02-26  9:44   ` [kvm-unit-tests PATCH v2 5/7] x86: VMX: Add tests for monitor trap flag Bill Wendling
2020-02-26  9:44   ` [kvm-unit-tests PATCH v2 6/7] x86: emulator: use "SSE2" for the target Bill Wendling
2020-02-26  9:44   ` [kvm-unit-tests PATCH 6/7] x86: VMX: use inline asm to get stack pointer Bill Wendling
2020-02-26  9:44   ` [kvm-unit-tests PATCH v2 7/7] pci: cast masks to uint32_t for unsigned long values Bill Wendling
2020-02-26  9:44   ` [kvm-unit-tests PATCH 7/7] x86: VMX: the "noclone" attribute is gcc-specific Bill Wendling
2020-02-28 11:16     ` Paolo Bonzini
2020-02-28 18:19       ` Oliver Upton
2020-02-28 18:24         ` Paolo Bonzini
2020-02-28 18:40           ` Oliver Upton
2020-02-26 19:02   ` [kvm-unit-tests PATCH v2 0/7] Fixes for clang builds Oliver Upton
2020-02-26 20:12   ` [kvm-unit-tests PATCH v3 " Bill Wendling
2020-02-26 20:12     ` [kvm-unit-tests PATCH v3 1/7] x86: emulator: use "SSE2" for the target Bill Wendling
2020-02-26 20:12     ` [kvm-unit-tests PATCH v3 2/7] pci: cast masks to uint32_t for unsigned long values Bill Wendling
2020-02-26 20:12     ` [kvm-unit-tests PATCH v3 3/7] x86: realmode: syscall: add explicit size suffix to ambiguous instructions Bill Wendling
2020-02-26 20:12     ` [kvm-unit-tests PATCH v3 4/7] svm: change operand to output-only for matching constraint Bill Wendling
2020-02-26 20:12     ` [kvm-unit-tests PATCH v3 5/7] svm: convert neg shift to unsigned shift Bill Wendling
2020-02-26 20:12     ` [kvm-unit-tests PATCH v3 6/7] x86: VMX: use inline asm to get stack pointer Bill Wendling
2020-02-26 20:12     ` [kvm-unit-tests PATCH v3 7/7] x86: VMX: the "noclone" attribute is gcc-specific Bill Wendling
2020-02-27  2:05       ` Oliver Upton
2020-02-28 11:19   ` [kvm-unit-tests PATCH v2 0/7] Fixes for clang builds Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200226094433.210968-7-morbo@google.com \
    --to=morbo@google.com \
    --cc=drjones@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=oupton@google.com \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).