Index: block-vvfat.c =================================================================== --- block-vvfat.c (revision 5805) +++ block-vvfat.c (working copy) @@ -1780,7 +1780,7 @@ } for (i = 0; i < 0x10 * s->sectors_per_cluster; i++) { - int cluster_count; + int cluster_count = 0; DLOG(fprintf(stderr, "check direntry %d: \n", i); print_direntry(direntries + i)); if (is_volume_label(direntries + i) || is_dot(direntries + i) || Index: usb-bsd.c =================================================================== --- usb-bsd.c (revision 5805) +++ usb-bsd.c (working copy) @@ -68,7 +68,7 @@ ep = UE_GET_ADDR(ep); if (dev->ep_fd[ep] < 0) { -#if __FreeBSD__ +#ifdef __FreeBSD__ snprintf(buf, sizeof(buf) - 1, "%s.%d", dev->devpath, ep); #else snprintf(buf, sizeof(buf) - 1, "%s.%02d", dev->devpath, ep); @@ -321,7 +321,7 @@ return NULL; } -#if __FreeBSD__ +#ifdef __FreeBSD__ snprintf(ctlpath, PATH_MAX, "/dev/%s", bus_info.udi_devnames[0]); #else snprintf(ctlpath, PATH_MAX, "/dev/%s.00", bus_info.udi_devnames[0]); @@ -413,7 +413,7 @@ if (strncmp(bus_info.udi_devnames[0], "ugen", 4) != 0) continue; -#if __FreeBSD__ +#ifdef __FreeBSD__ snprintf(devbuf, sizeof(devbuf) - 1, "/dev/%s", bus_info.udi_devnames[0]); #else snprintf(devbuf, sizeof(devbuf) - 1, "/dev/%s.00", bus_info.udi_devnames[0]); Index: cpu-exec.c =================================================================== --- cpu-exec.c (revision 5805) +++ cpu-exec.c (working copy) @@ -1188,17 +1188,32 @@ #elif defined(__x86_64__) +#ifdef __NetBSD__ +#define REG_ERR _REG_ERR +#define REG_TRAPNO _REG_TRAPNO + +#define QEMU_UC_MCONTEXT_GREGS(uc, reg) (uc)->uc_mcontext.__gregs[(reg)] +#define QEMU_UC_MACHINE_PC(uc) _UC_MACHINE_PC(uc) +#else +#define QEMU_UC_MCONTEXT_GREGS(uc, reg) (uc)->uc_mcontext.gregs[(reg)] +#define QEMU_UC_MACHINE_PC(uc) QEMU_UC_MCONTEXT_GREGS(uc, REG_RIP) +#endif + int cpu_signal_handler(int host_signum, void *pinfo, void *puc) { siginfo_t *info = pinfo; + unsigned long pc; +#ifdef __NetBSD__ + ucontext_t *uc = puc; +#else struct ucontext *uc = puc; - unsigned long pc; +#endif - pc = uc->uc_mcontext.gregs[REG_RIP]; + pc = QEMU_UC_MACHINE_PC(uc); return handle_cpu_signal(pc, (unsigned long)info->si_addr, - uc->uc_mcontext.gregs[REG_TRAPNO] == 0xe ? - (uc->uc_mcontext.gregs[REG_ERR] >> 1) & 1 : 0, + QEMU_UC_MCONTEXT_GREGS(uc, REG_TRAPNO) == 0xe ? + (QEMU_UC_MCONTEXT_GREGS(uc, REG_ERR) >> 1) & 1 : 0, &uc->uc_sigmask, puc); } Index: block.c =================================================================== --- block.c (revision 5805) +++ block.c (working copy) @@ -760,7 +764,7 @@ int ret, i, heads, sectors, cylinders; struct partition *p; uint32_t nr_sects; - int64_t nb_sectors; + uint64_t nb_sectors; bdrv_get_geometry(bs, &nb_sectors); @@ -800,7 +804,7 @@ { int translation, lba_detected = 0; int cylinders, heads, secs; - int64_t nb_sectors; + uint64_t nb_sectors; /* if a geometry hint is available, use it */ bdrv_get_geometry(bs, &nb_sectors); Index: hw/mpcore.c =================================================================== --- hw/mpcore.c (revision 5805) +++ hw/mpcore.c (working copy) @@ -105,6 +105,8 @@ return s->control; case 12: /* Interrupt status. */ return s->status; + default: + return 0; } }