aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Wendling <morbo@google.com>2020-02-26 01:44:25 -0800
committerPaolo Bonzini <pbonzini@redhat.com>2020-02-28 12:11:04 +0100
commit576718d036f52b93dbd8a517e6761c08ada09e2f (patch)
tree4451499203d1cdd58643fc12019f800ad5bcedc0
parentb2402d33d42b092d65845fc956e3cdbe01628eca (diff)
downloadkvm-unit-tests-576718d036f52b93dbd8a517e6761c08ada09e2f.tar.gz
x86: realmode: syscall: add explicit size suffix to ambiguous instructions
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> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--x86/realmode.c6
-rw-r--r--x86/syscall.c2
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");