提交 8c0d577e 编写于 作者: B Blue Swirl

kvm: avoid collision with dprintf macro in stdio.h, spotted by clang

Fixes clang errors:
  CC    i386-softmmu/kvm.o
/src/qemu/target-i386/kvm.c:40:9: error: 'dprintf' macro redefined
In file included from /src/qemu/target-i386/kvm.c:21:
In file included from /src/qemu/qemu-common.h:27:
In file included from /usr/include/stdio.h:910:
/usr/include/bits/stdio2.h:189:12: note: previous definition is here
  CC    i386-softmmu/kvm-all.o
/src/qemu/kvm-all.c:39:9: error: 'dprintf' macro redefined
In file included from /src/qemu/kvm-all.c:23:
In file included from /src/qemu/qemu-common.h:27:
In file included from /usr/include/stdio.h:910:
/usr/include/bits/stdio2.h:189:12: note: previous definition is here
Signed-off-by: NBlue Swirl <blauwirbel@gmail.com>
上级 6ad6135d
...@@ -33,10 +33,10 @@ ...@@ -33,10 +33,10 @@
//#define DEBUG_KVM //#define DEBUG_KVM
#ifdef DEBUG_KVM #ifdef DEBUG_KVM
#define dprintf(fmt, ...) \ #define DPRINTF(fmt, ...) \
do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0) do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0)
#else #else
#define dprintf(fmt, ...) \ #define DPRINTF(fmt, ...) \
do { } while (0) do { } while (0)
#endif #endif
...@@ -173,11 +173,11 @@ int kvm_init_vcpu(CPUState *env) ...@@ -173,11 +173,11 @@ int kvm_init_vcpu(CPUState *env)
long mmap_size; long mmap_size;
int ret; int ret;
dprintf("kvm_init_vcpu\n"); DPRINTF("kvm_init_vcpu\n");
ret = kvm_vm_ioctl(s, KVM_CREATE_VCPU, env->cpu_index); ret = kvm_vm_ioctl(s, KVM_CREATE_VCPU, env->cpu_index);
if (ret < 0) { if (ret < 0) {
dprintf("kvm_create_vcpu failed\n"); DPRINTF("kvm_create_vcpu failed\n");
goto err; goto err;
} }
...@@ -186,7 +186,7 @@ int kvm_init_vcpu(CPUState *env) ...@@ -186,7 +186,7 @@ int kvm_init_vcpu(CPUState *env)
mmap_size = kvm_ioctl(s, KVM_GET_VCPU_MMAP_SIZE, 0); mmap_size = kvm_ioctl(s, KVM_GET_VCPU_MMAP_SIZE, 0);
if (mmap_size < 0) { if (mmap_size < 0) {
dprintf("KVM_GET_VCPU_MMAP_SIZE failed\n"); DPRINTF("KVM_GET_VCPU_MMAP_SIZE failed\n");
goto err; goto err;
} }
...@@ -194,7 +194,7 @@ int kvm_init_vcpu(CPUState *env) ...@@ -194,7 +194,7 @@ int kvm_init_vcpu(CPUState *env)
env->kvm_fd, 0); env->kvm_fd, 0);
if (env->kvm_run == MAP_FAILED) { if (env->kvm_run == MAP_FAILED) {
ret = -errno; ret = -errno;
dprintf("mmap'ing vcpu state failed\n"); DPRINTF("mmap'ing vcpu state failed\n");
goto err; goto err;
} }
...@@ -325,7 +325,7 @@ static int kvm_physical_sync_dirty_bitmap(target_phys_addr_t start_addr, ...@@ -325,7 +325,7 @@ static int kvm_physical_sync_dirty_bitmap(target_phys_addr_t start_addr,
d.slot = mem->slot; d.slot = mem->slot;
if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) { if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) {
dprintf("ioctl failed %d\n", errno); DPRINTF("ioctl failed %d\n", errno);
ret = -1; ret = -1;
break; break;
} }
...@@ -768,12 +768,12 @@ int kvm_cpu_exec(CPUState *env) ...@@ -768,12 +768,12 @@ int kvm_cpu_exec(CPUState *env)
struct kvm_run *run = env->kvm_run; struct kvm_run *run = env->kvm_run;
int ret; int ret;
dprintf("kvm_cpu_exec()\n"); DPRINTF("kvm_cpu_exec()\n");
do { do {
#ifndef CONFIG_IOTHREAD #ifndef CONFIG_IOTHREAD
if (env->exit_request) { if (env->exit_request) {
dprintf("interrupt exit requested\n"); DPRINTF("interrupt exit requested\n");
ret = 0; ret = 0;
break; break;
} }
...@@ -792,13 +792,13 @@ int kvm_cpu_exec(CPUState *env) ...@@ -792,13 +792,13 @@ int kvm_cpu_exec(CPUState *env)
if (ret == -EINTR || ret == -EAGAIN) { if (ret == -EINTR || ret == -EAGAIN) {
cpu_exit(env); cpu_exit(env);
dprintf("io window exit\n"); DPRINTF("io window exit\n");
ret = 0; ret = 0;
break; break;
} }
if (ret < 0) { if (ret < 0) {
dprintf("kvm run failed %s\n", strerror(-ret)); DPRINTF("kvm run failed %s\n", strerror(-ret));
abort(); abort();
} }
...@@ -807,7 +807,7 @@ int kvm_cpu_exec(CPUState *env) ...@@ -807,7 +807,7 @@ int kvm_cpu_exec(CPUState *env)
ret = 0; /* exit loop */ ret = 0; /* exit loop */
switch (run->exit_reason) { switch (run->exit_reason) {
case KVM_EXIT_IO: case KVM_EXIT_IO:
dprintf("handle_io\n"); DPRINTF("handle_io\n");
ret = kvm_handle_io(run->io.port, ret = kvm_handle_io(run->io.port,
(uint8_t *)run + run->io.data_offset, (uint8_t *)run + run->io.data_offset,
run->io.direction, run->io.direction,
...@@ -815,7 +815,7 @@ int kvm_cpu_exec(CPUState *env) ...@@ -815,7 +815,7 @@ int kvm_cpu_exec(CPUState *env)
run->io.count); run->io.count);
break; break;
case KVM_EXIT_MMIO: case KVM_EXIT_MMIO:
dprintf("handle_mmio\n"); DPRINTF("handle_mmio\n");
cpu_physical_memory_rw(run->mmio.phys_addr, cpu_physical_memory_rw(run->mmio.phys_addr,
run->mmio.data, run->mmio.data,
run->mmio.len, run->mmio.len,
...@@ -823,24 +823,24 @@ int kvm_cpu_exec(CPUState *env) ...@@ -823,24 +823,24 @@ int kvm_cpu_exec(CPUState *env)
ret = 1; ret = 1;
break; break;
case KVM_EXIT_IRQ_WINDOW_OPEN: case KVM_EXIT_IRQ_WINDOW_OPEN:
dprintf("irq_window_open\n"); DPRINTF("irq_window_open\n");
break; break;
case KVM_EXIT_SHUTDOWN: case KVM_EXIT_SHUTDOWN:
dprintf("shutdown\n"); DPRINTF("shutdown\n");
qemu_system_reset_request(); qemu_system_reset_request();
ret = 1; ret = 1;
break; break;
case KVM_EXIT_UNKNOWN: case KVM_EXIT_UNKNOWN:
dprintf("kvm_exit_unknown\n"); DPRINTF("kvm_exit_unknown\n");
break; break;
case KVM_EXIT_FAIL_ENTRY: case KVM_EXIT_FAIL_ENTRY:
dprintf("kvm_exit_fail_entry\n"); DPRINTF("kvm_exit_fail_entry\n");
break; break;
case KVM_EXIT_EXCEPTION: case KVM_EXIT_EXCEPTION:
dprintf("kvm_exit_exception\n"); DPRINTF("kvm_exit_exception\n");
break; break;
case KVM_EXIT_DEBUG: case KVM_EXIT_DEBUG:
dprintf("kvm_exit_debug\n"); DPRINTF("kvm_exit_debug\n");
#ifdef KVM_CAP_SET_GUEST_DEBUG #ifdef KVM_CAP_SET_GUEST_DEBUG
if (kvm_arch_debug(&run->debug.arch)) { if (kvm_arch_debug(&run->debug.arch)) {
gdb_set_stop_cpu(env); gdb_set_stop_cpu(env);
...@@ -853,7 +853,7 @@ int kvm_cpu_exec(CPUState *env) ...@@ -853,7 +853,7 @@ int kvm_cpu_exec(CPUState *env)
#endif /* KVM_CAP_SET_GUEST_DEBUG */ #endif /* KVM_CAP_SET_GUEST_DEBUG */
break; break;
default: default:
dprintf("kvm_arch_handle_exit\n"); DPRINTF("kvm_arch_handle_exit\n");
ret = kvm_arch_handle_exit(env, run); ret = kvm_arch_handle_exit(env, run);
break; break;
} }
......
...@@ -34,10 +34,10 @@ ...@@ -34,10 +34,10 @@
//#define DEBUG_KVM //#define DEBUG_KVM
#ifdef DEBUG_KVM #ifdef DEBUG_KVM
#define dprintf(fmt, ...) \ #define DPRINTF(fmt, ...) \
do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0) do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0)
#else #else
#define dprintf(fmt, ...) \ #define DPRINTF(fmt, ...) \
do { } while (0) do { } while (0)
#endif #endif
...@@ -957,7 +957,7 @@ int kvm_arch_pre_run(CPUState *env, struct kvm_run *run) ...@@ -957,7 +957,7 @@ int kvm_arch_pre_run(CPUState *env, struct kvm_run *run)
struct kvm_interrupt intr; struct kvm_interrupt intr;
intr.irq = irq; intr.irq = irq;
/* FIXME: errors */ /* FIXME: errors */
dprintf("injected interrupt %d\n", irq); DPRINTF("injected interrupt %d\n", irq);
kvm_vcpu_ioctl(env, KVM_INTERRUPT, &intr); kvm_vcpu_ioctl(env, KVM_INTERRUPT, &intr);
} }
} }
...@@ -971,7 +971,7 @@ int kvm_arch_pre_run(CPUState *env, struct kvm_run *run) ...@@ -971,7 +971,7 @@ int kvm_arch_pre_run(CPUState *env, struct kvm_run *run)
else else
run->request_interrupt_window = 0; run->request_interrupt_window = 0;
dprintf("setting tpr\n"); DPRINTF("setting tpr\n");
run->cr8 = cpu_get_apic_tpr(env); run->cr8 = cpu_get_apic_tpr(env);
return 0; return 0;
...@@ -1009,7 +1009,7 @@ int kvm_arch_handle_exit(CPUState *env, struct kvm_run *run) ...@@ -1009,7 +1009,7 @@ int kvm_arch_handle_exit(CPUState *env, struct kvm_run *run)
switch (run->exit_reason) { switch (run->exit_reason) {
case KVM_EXIT_HLT: case KVM_EXIT_HLT:
dprintf("handle_hlt\n"); DPRINTF("handle_hlt\n");
ret = kvm_handle_halt(env); ret = kvm_handle_halt(env);
break; break;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册