diff --git a/qemu/block-raw-posix.c b/qemu/block-raw-posix.c
index 0c25787..aac1fb4 100644
--- a/qemu/block-raw-posix.c
+++ b/qemu/block-raw-posix.c
@@ -527,7 +527,6 @@ static int posix_aio_init(void)
 {
     sigset_t mask;
     PosixAioState *s;
-    int fds[2];
     struct qemu_paioinit ai;
   
     if (posix_aio_state)
diff --git a/qemu/block.c b/qemu/block.c
index 62b1e93..495b9a5 100644
--- a/qemu/block.c
+++ b/qemu/block.c
@@ -1005,16 +1005,6 @@ void bdrv_flush(BlockDriverState *bs)
         bdrv_flush(bs->backing_hd);
 }
 
-void bdrv_iterate_writeable(void (*it)(BlockDriverState *bs))
-{
-    BlockDriverState *bs;
-
-    for (bs = bdrv_first; bs != NULL; bs = bs->next)
-        if (bs->drv && !bdrv_is_read_only(bs) && 
-            (!bdrv_is_removable(bs) || bdrv_is_inserted(bs)))
-	    it(bs);
-}
-
 void bdrv_flush_all(void)
 {
     BlockDriverState *bs;
diff --git a/qemu/hw/extboot.c b/qemu/hw/extboot.c
index 056fb59..ada0fdd 100644
--- a/qemu/hw/extboot.c
+++ b/qemu/hw/extboot.c
@@ -76,7 +76,7 @@ static void extboot_write_cmd(void *opaque, uint32_t addr, uint32_t value)
     union extboot_cmd *cmd = (void *)(phys_ram_base + ((value & 0xFFFF) << 4));
     BlockDriverState *bs = opaque;
     int cylinders, heads, sectors, err;
-    int64_t nb_sectors;
+    uint64_t nb_sectors;
 
     get_translated_chs(bs, &cylinders, &heads, &sectors);
 
diff --git a/qemu/kvm-tpr-opt.c b/qemu/kvm-tpr-opt.c
index 44b453f..246e08d 100644
--- a/qemu/kvm-tpr-opt.c
+++ b/qemu/kvm-tpr-opt.c
@@ -112,7 +112,7 @@ static struct vapic_bios vapic_bios;
 static uint32_t real_tpr;
 static uint32_t bios_addr;
 static uint32_t vapic_phys;
-static int bios_enabled;
+static uint32_t bios_enabled;
 static uint32_t vbios_desc_phys;
 
 static void update_vbios_real_tpr(void)
diff --git a/qemu/net.c b/qemu/net.c
index 9841197..6f2b31c 100644
--- a/qemu/net.c
+++ b/qemu/net.c
@@ -752,7 +752,7 @@ static int tap_can_send(void *opaque)
 
 static int tap_send_packet(TAPState *s)
 {
-    uint8_t *buf = s->buf;
+    uint8_t *buf = (uint8_t *)s->buf;
     int size = s->size;
 
 #ifdef IFF_VNET_HDR
diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c
index 5ff63ad..ffdee6e 100644
--- a/qemu/qemu-kvm.c
+++ b/qemu/qemu-kvm.c
@@ -102,12 +102,12 @@ static void on_vcpu(CPUState *env, void (*func)(void *data), void *data)
 
 static void inject_interrupt(void *data)
 {
-    cpu_interrupt(current_env, (int)data);
+    cpu_interrupt(current_env, (long)data);
 }
 
 void kvm_inject_interrupt(CPUState *env, int mask)
 {
-    on_vcpu(env, inject_interrupt, (void *)mask);
+    on_vcpu(env, inject_interrupt, (void *)(long)mask);
 }
 
 void kvm_update_interrupt_request(CPUState *env)
@@ -612,7 +612,8 @@ int kvm_main_loop(void)
 }
 
 #ifdef KVM_CAP_SET_GUEST_DEBUG
-int kvm_debug(void *opaque, void *data, struct kvm_debug_exit_arch *arch_info)
+static int kvm_debug(void *opaque, void *data,
+                     struct kvm_debug_exit_arch *arch_info)
 {
     int handle = kvm_arch_debug(arch_info);
     struct CPUState *env = data;
@@ -1002,7 +1003,7 @@ struct kvm_set_guest_debug_data {
     int err;
 };
 
-void kvm_invoke_set_guest_debug(void *data)
+static void kvm_invoke_set_guest_debug(void *data)
 {
     struct kvm_set_guest_debug_data *dbg_data = data;
 
diff --git a/qemu/target-i386/cpu.h b/qemu/target-i386/cpu.h
index 944e386..400a7e5 100644
--- a/qemu/target-i386/cpu.h
+++ b/qemu/target-i386/cpu.h
@@ -640,7 +640,7 @@ typedef struct CPUX86State {
     /* in order to simplify APIC support, we leave this pointer to the
        user */
     struct APICState *apic_state;
-    int mp_state;
+    uint32_t mp_state;
 } CPUX86State;
 
 CPUX86State *cpu_x86_init(const char *cpu_model);
diff --git a/qemu/vl.c b/qemu/vl.c
index 7db9c12..f256bb5 100644
--- a/qemu/vl.c
+++ b/qemu/vl.c
@@ -4703,7 +4703,7 @@ void qemu_get_launch_info(int *argc, char ***argv, int *opt_daemonize, const cha
     *opt_incoming = incoming;
 }
 
-
+#ifdef USE_KVM
 static int gethugepagesize(void)
 {
     int ret, fd;
@@ -4779,13 +4779,14 @@ static void *alloc_mem_area(size_t memory, unsigned long *len, const char *path)
     *len = memory;
     return area;
 }
+#endif
 
 static void *qemu_alloc_physram(unsigned long memory)
 {
     void *area = NULL;
+#ifdef USE_KVM
     unsigned long map_len = memory;
 
-#ifdef USE_KVM
     if (mem_path)
 	area = alloc_mem_area(memory, &map_len, mem_path);
 #endif
@@ -5632,7 +5633,7 @@ int main(int argc, char **argv, char **envp)
     }
 #endif
 
-#if USE_KVM
+#ifdef USE_KVM
     if (kvm_enabled()) {
 	if (kvm_qemu_init() < 0) {
 	    fprintf(stderr, "Could not initialize KVM, will disable KVM support\n");
diff --git a/user/test/x86/access.c b/user/test/x86/access.c
index 0e61597..49f74b3 100644
--- a/user/test/x86/access.c
+++ b/user/test/x86/access.c
@@ -551,7 +551,7 @@ int ac_test_exec(ac_test_t *at)
     return r;
 }
 
-int ac_test_run()
+int ac_test_run(void)
 {
     static ac_test_t at;
     int tests, successes;
@@ -574,7 +574,7 @@ int main()
     int r;
 
     printf("starting test\n\n");
-    smp_init(ac_test_run);
+    smp_init((void(*)(void))ac_test_run);
     r = ac_test_run();
     return r ? 0 : 1;
 }
diff --git a/user/test/x86/emulator.c b/user/test/x86/emulator.c
index bbe55a7..c6adbb5 100644
--- a/user/test/x86/emulator.c
+++ b/user/test/x86/emulator.c
@@ -134,7 +134,6 @@ void test_pop(void *mem)
 {
 	unsigned long tmp;
 	unsigned long *stack_top = mem + 4096;
-	unsigned long *new_stack_top;
 	unsigned long memw = 0x123456789abcdeful;
 	static unsigned long tmp2;
 
diff --git a/user/test/x86/vmexit.c b/user/test/x86/vmexit.c
index 0662f34..bd57bfa 100644
--- a/user/test/x86/vmexit.c
+++ b/user/test/x86/vmexit.c
@@ -1,5 +1,5 @@
 
-#include "printf.h"
+#include "libcflat.h"
 
 static inline unsigned long long rdtsc()
 {
