mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-09 15:24:32 +08:00
372d070845
Change the mov in KVM_ASM_SAFE() that zeroes @vector to a movb to
make it unambiguous.
This fixes a build failure with Clang since, unlike the GNU assembler,
the LLVM integrated assembler rejects ambiguous X86 instructions that
don't have suffixes:
In file included from x86_64/hyperv_features.c:13:
include/x86_64/processor.h:825:9: error: ambiguous instructions require an explicit suffix (could be 'movb', 'movw', 'movl', or 'movq')
return kvm_asm_safe("wrmsr", "a"(val & -1u), "d"(val >> 32), "c"(msr));
^
include/x86_64/processor.h:802:15: note: expanded from macro 'kvm_asm_safe'
asm volatile(KVM_ASM_SAFE(insn) \
^
include/x86_64/processor.h:788:16: note: expanded from macro 'KVM_ASM_SAFE'
"1: " insn "\n\t" \
^
<inline asm>:5:2: note: instantiated into assembly here
mov $0, 15(%rsp)
^
It seems like this change could introduce undesirable behavior in the
future, e.g. if someone used a type larger than a u8 for @vector, since
KVM_ASM_SAFE() will only zero the bottom byte. I tried changing the type
of @vector to an int to see what would happen. GCC failed to compile due
to a size mismatch between `movb` and `%eax`. Clang succeeded in
compiling, but the generated code looked correct, so perhaps it will not
be an issue. That being said it seems like there could be a better
solution to this issue that does not assume @vector is a u8.
Fixes:
|
||
---|---|---|
.. | ||
aarch64 | ||
include | ||
lib | ||
s390x | ||
x86_64 | ||
.gitignore | ||
access_tracking_perf_test.c | ||
config | ||
demand_paging_test.c | ||
dirty_log_perf_test.c | ||
dirty_log_test.c | ||
hardware_disable_test.c | ||
kvm_binary_stats_test.c | ||
kvm_create_max_vcpus.c | ||
kvm_page_table_test.c | ||
Makefile | ||
max_guest_memory_test.c | ||
memslot_modification_stress_test.c | ||
memslot_perf_test.c | ||
rseq_test.c | ||
set_memory_region_test.c | ||
settings | ||
steal_time.c | ||
system_counter_offset_test.c |