[PATCH] qemu: fix some warnings

Jan Kiszka
2008-01-21T12:46:11Z

Here are 4 more warnings fixes (actually, I should sent 2 of them to
qemu...). Nothing critical, just less noise during compilation.

At this chance, can anyone comment on these uint32_t types?

static int subpage_register (subpage_t *mmio, uint32_t start, uint32_t end,
int memory);
static void *subpage_init (target_phys_addr_t base, uint32_t *phys,
int orig_memory);

Shouldn't they be target_phys_addr_t? Can't this cause troubles when
building 64-bit targets? Looks like it's even a generic qemu issue.

Jan

---
qemu/hw/pc.c | 31 -------------------------------
qemu/kvm-tpr-opt.c | 13 -------------
qemu/migration.c | 4 ++--
qemu/vl.c | 2 +-
4 files changed, 3 insertions(+), 47 deletions(-)

Index: b/qemu/hw/pc.c
===================================================================
--- a/qemu/hw/pc.c
+++ b/qemu/hw/pc.c
@@ -450,37 +450,6 @@ static void generate_bootsect(uint32_t g
bdrv_set_boot_sector(drives_table[hda].bdrv, bootsect, sizeof(bootsect));
}

-static int load_kernel(const char *filename, uint8_t *addr,
- uint8_t *real_addr)
-{
- int fd, size;
- int setup_sects;
-
- fd = open(filename, O_RDONLY | O_BINARY);
- if (fd < 0)
- return -1;
-
- /* load 16 bit code */
- if (read(fd, real_addr, 512) != 512)
- goto fail;
- setup_sects = real_addr[0x1F1];
- if (!setup_sects)
- setup_sects = 4;
- if (read(fd, real_addr + 512, setup_sects * 512) !=
- setup_sects * 512)
- goto fail;
-
- /* load 32 bit code */
- size = read(fd, addr, 16 * 1024 * 1024);
- if (size < 0)
- goto fail;
- close(fd);
- return size;
- fail:
- close(fd);
- return -1;
-}
-
static long get_file_size(FILE *f)
{
long where, size;
Index: b/qemu/kvm-tpr-opt.c
===================================================================
--- a/qemu/kvm-tpr-opt.c
+++ b/qemu/kvm-tpr-opt.c
@@ -76,19 +76,6 @@ static void write_byte_virt(CPUState *en
stb_phys(map_addr(&sregs, virt, NULL), b);
}

-static uint32_t get_bios_map(CPUState *env, unsigned *perms)
-{
- uint32_t v;
- struct kvm_sregs sregs;
-
- kvm_get_sregs(kvm_context, env->cpu_index, &sregs);
-
- for (v = -4096u; v != 0; v -= 4096)
- if (map_addr(&sregs, v, perms) == 0xe0000)
- return v;
- return -1u;
-}
-
struct vapic_bios {
char signature[8];
uint32_t virt_base;
Index: b/qemu/migration.c
===================================================================
--- a/qemu/migration.c
+++ b/qemu/migration.c
@@ -808,7 +808,7 @@ static int migrate_incoming_fd(int fd)

size = qemu_get_be32(f);
if (size != phys_ram_size) {
- fprintf(stderr, "migration: memory size mismatch: recv %u mine %u\n",
+ fprintf(stderr, "migration: memory size mismatch: recv %u mine %lu\n",
size, phys_ram_size);
return MIG_STAT_DST_MEM_SIZE_MISMATCH;
}
@@ -1063,7 +1063,7 @@ void do_info_migration(void)
term_printf("Transfer rate %3.1f mb/s\n",
(double)s->bps / (1024 * 1024));
term_printf("Iteration %d\n", s->iteration);
- term_printf("Transferred %d/%d pages\n", s->updated_pages, phys_ram_size >> TARGET_PAGE_BITS);
+ term_printf("Transferred %d/%lu pages\n", s->updated_pages, phys_ram_size >> TARGET_PAGE_BITS);
if (s->iteration)
term_printf("Last iteration found %d dirty pages\n", s->last_updated_pages);
} else {
Index: b/qemu/vl.c
===================================================================
--- a/qemu/vl.c
+++ b/qemu/vl.c
@@ -8862,7 +8862,7 @@ int main(int argc, char **argv)
if (ram_size <= 0)
help(1);
if (ram_size > PHYS_RAM_MAX_SIZE) {
- fprintf(stderr, "qemu: at most %d MB RAM can be simulated\n",
+ fprintf(stderr, "qemu: at most %llu MB RAM can be simulated\n",
PHYS_RAM_MAX_SIZE / (1024 * 1024));
exit(1);