Index: usr.sbin/bhyve/bhyverun.c =================================================================== --- usr.sbin/bhyve/bhyverun.c +++ usr.sbin/bhyve/bhyverun.c @@ -388,13 +388,11 @@ static int vmexit_spinup_ap(struct vmctx *ctx, struct vm_exit *vme, int *pvcpu) { - int newcpu; - int retval = VMEXIT_CONTINUE; - newcpu = spinup_ap(ctx, *pvcpu, - vme->u.spinup_ap.vcpu, vme->u.spinup_ap.rip); + (void)spinup_ap(ctx, *pvcpu, + vme->u.spinup_ap.vcpu, vme->u.spinup_ap.rip); - return (retval); + return (VMEXIT_CONTINUE); } #define DEBUG_EPT_MISCONFIG Index: usr.sbin/bhyve/pci_ahci.c =================================================================== --- usr.sbin/bhyve/pci_ahci.c +++ usr.sbin/bhyve/pci_ahci.c @@ -1717,19 +1717,25 @@ ahci_handle_slot(struct ahci_port *p, int slot) { struct ahci_cmd_hdr *hdr; +#ifdef AHCI_DEBUG struct ahci_prdt_entry *prdt; +#endif struct pci_ahci_softc *sc; uint8_t *cfis; +#ifdef AHCI_DEBUG int cfl; +#endif sc = p->pr_sc; hdr = (struct ahci_cmd_hdr *)(p->cmd_lst + slot * AHCI_CL_SIZE); +#ifdef AHCI_DEBUG cfl = (hdr->flags & 0x1f) * 4; +#endif cfis = paddr_guest2host(ahci_ctx(sc), hdr->ctba, 0x80 + hdr->prdtl * sizeof(struct ahci_prdt_entry)); +#ifdef AHCI_DEBUG prdt = (struct ahci_prdt_entry *)(cfis + 0x80); -#ifdef AHCI_DEBUG DPRINTF("\ncfis:"); for (i = 0; i < cfl; i++) { if (i % 10 == 0) Index: usr.sbin/bhyve/pci_emul.c =================================================================== --- usr.sbin/bhyve/pci_emul.c +++ usr.sbin/bhyve/pci_emul.c @@ -755,13 +755,21 @@ return (err); } +#ifdef __GNU_C__ +#define WRAPPED_CTASSERT(x) CTASSERT(x) __unused +#else +#define WRAPPED_CTASSERT(x) CTASSERT(x) +#endif + +WRAPPED_CTASSERT(sizeof(struct msicap) == 14); +WRAPPED_CTASSERT(sizeof(struct msixcap) == 12); +WRAPPED_CTASSERT(sizeof(struct pciecap) == 60); + void pci_populate_msicap(struct msicap *msicap, int msgnum, int nextptr) { int mmc; - CTASSERT(sizeof(struct msicap) == 14); - /* Number of msi messages must be a power of 2 between 1 and 32 */ assert((msgnum & (msgnum - 1)) == 0 && msgnum >= 1 && msgnum <= 32); mmc = ffs(msgnum) - 1; @@ -786,7 +794,6 @@ pci_populate_msixcap(struct msixcap *msixcap, int msgnum, int barnum, uint32_t msix_tab_size) { - CTASSERT(sizeof(struct msixcap) == 12); assert(msix_tab_size % 4096 == 0); @@ -937,8 +944,6 @@ int err; struct pciecap pciecap; - CTASSERT(sizeof(struct pciecap) == 60); - if (type != PCIEM_TYPE_ROOT_PORT) return (-1); Index: usr.sbin/bhyve/pci_passthru.c =================================================================== --- usr.sbin/bhyve/pci_passthru.c +++ usr.sbin/bhyve/pci_passthru.c @@ -361,7 +361,7 @@ uint64_t *dest64; size_t entry_offset; uint32_t vector_control; - int error, index; + int index; pi = sc->psc_pi; if (offset >= pi->pi_msix.pba_offset && @@ -416,8 +416,8 @@ /* If the entry is masked, don't set it up */ if ((entry->vector_control & PCIM_MSIX_VCTRL_MASK) == 0 || (vector_control & PCIM_MSIX_VCTRL_MASK) == 0) { - error = vm_setup_pptdev_msix(ctx, vcpu, - sc->psc_sel.pc_bus, sc->psc_sel.pc_dev, + (void)vm_setup_pptdev_msix(ctx, vcpu, + sc->psc_sel.pc_bus, sc->psc_sel.pc_dev, sc->psc_sel.pc_func, index, entry->addr, entry->msg_data, entry->vector_control); } Index: usr.sbin/bhyve/pci_xhci.c =================================================================== --- usr.sbin/bhyve/pci_xhci.c +++ usr.sbin/bhyve/pci_xhci.c @@ -143,10 +143,10 @@ #define MASK_64_HI(x) ((x) & ~0xFFFFFFFFULL) #define MASK_64_LO(x) ((x) & 0xFFFFFFFFULL) -#define FIELD_REPLACE(a,b,m,s) ((a) & ~((m) << (s)) | \ - ((b) & (m)) << (s)) -#define FIELD_COPY(a,b,m,s) ((a) & ~((m) << (s)) | \ - ((b) & ((m) << (s)))) +#define FIELD_REPLACE(a,b,m,s) (((a) & ~((m) << (s))) | \ + (((b) & (m)) << (s))) +#define FIELD_COPY(a,b,m,s) (((a) & ~((m) << (s))) | \ + (((b) & ((m) << (s))))) struct pci_xhci_trb_ring { uint64_t ringaddr; /* current dequeue guest address */ @@ -1700,7 +1700,7 @@ struct xhci_trb *setup_trb; struct usb_data_xfer *xfer; struct usb_data_xfer_block *xfer_block; - uint64_t val, setup_addr, status_addr; + uint64_t val; uint32_t trbflags; int do_intr, err; int do_retry; @@ -1718,8 +1718,6 @@ do_retry = 0; do_intr = 0; setup_trb = NULL; - setup_addr = 0; - status_addr = 0; while (1) { pci_xhci_dump_trb(trb); @@ -1754,7 +1752,6 @@ goto errout; } setup_trb = trb; - setup_addr = addr; val = trb->qwTrb0; if (!xfer->ureq) @@ -1786,7 +1783,6 @@ break; case XHCI_TRB_TYPE_STATUS_STAGE: - status_addr = addr; xfer_block = usb_data_xfer_append(xfer, NULL, 0, (void *)addr, ccs); break; @@ -1842,7 +1838,6 @@ err = USB_ERR_NOT_STARTED; if (dev->dev_ue->ue_request != NULL) err = dev->dev_ue->ue_request(dev->dev_sc, xfer); - status_addr = 0; setup_trb = NULL; } else { /* handle data transfer */ Index: usr.sbin/bhyve/ps2kbd.c =================================================================== --- usr.sbin/bhyve/ps2kbd.c +++ usr.sbin/bhyve/ps2kbd.c @@ -93,15 +93,6 @@ fifo->size = sizeof(((struct fifo *)0)->buf); } -static int -fifo_available(struct ps2kbd_softc *sc) -{ - struct fifo *fifo; - - fifo = &sc->fifo; - return (fifo->num < fifo->size); -} - static void fifo_put(struct ps2kbd_softc *sc, uint8_t val) { Index: usr.sbin/bhyve/rfb.c =================================================================== --- usr.sbin/bhyve/rfb.c +++ usr.sbin/bhyve/rfb.c @@ -28,10 +28,12 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include #include -#include +#include +#include #include #include @@ -46,7 +48,6 @@ #include #include -#include #include "bhyvegc.h" #include "console.h" @@ -177,7 +178,6 @@ { struct bhyvegc_image *gc_image; struct rfb_srvr_info sinfo; - int len; gc_image = console_get_image(); @@ -194,8 +194,8 @@ sinfo.pixfmt.green_shift = 8; sinfo.pixfmt.blue_shift = 0; sinfo.namelen = htonl(strlen("bhyve")); - len = stream_write(cfd, &sinfo, sizeof(sinfo)); - len = stream_write(cfd, "bhyve", strlen("bhyve")); + (void)stream_write(cfd, &sinfo, sizeof(sinfo)); + (void)stream_write(cfd, "bhyve", strlen("bhyve")); } static void @@ -223,9 +223,8 @@ rfb_recv_set_pixfmt_msg(struct rfb_softc *rc, int cfd) { struct rfb_pixfmt_msg pixfmt_msg; - int len; - len = stream_read(cfd, ((void *)&pixfmt_msg)+1, sizeof(pixfmt_msg)-1); + (void)stream_read(cfd, ((void *)&pixfmt_msg)+1, sizeof(pixfmt_msg)-1); } @@ -233,14 +232,14 @@ rfb_recv_set_encodings_msg(struct rfb_softc *rc, int cfd) { struct rfb_enc_msg enc_msg; - int len, i; + int i; uint32_t encoding; assert((sizeof(enc_msg) - 1) == 3); - len = stream_read(cfd, ((void *)&enc_msg)+1, sizeof(enc_msg)-1); + (void)stream_read(cfd, ((void *)&enc_msg)+1, sizeof(enc_msg)-1); for (i = 0; i < htons(enc_msg.numencs); i++) { - len = stream_read(cfd, &encoding, sizeof(encoding)); + (void)stream_read(cfd, &encoding, sizeof(encoding)); switch (htonl(encoding)) { case RFB_ENCODING_RAW: rc->enc_raw_ok = true; @@ -256,27 +255,6 @@ } } -static void -rfb_resize_update(struct rfb_softc *rc, int fd) -{ - struct rfb_srvr_updt_msg supdt_msg; - struct rfb_srvr_rect_hdr srect_hdr; - - /* Number of rectangles: 1 */ - supdt_msg.type = 0; - supdt_msg.pad = 0; - supdt_msg.numrects = htons(1); - stream_write(fd, &supdt_msg, sizeof(struct rfb_srvr_updt_msg)); - - /* Rectangle header */ - srect_hdr.x = htons(0); - srect_hdr.y = htons(0); - srect_hdr.width = htons(rc->width); - srect_hdr.height = htons(rc->height); - srect_hdr.encoding = htonl(RFB_ENCODING_RESIZE); - stream_write(fd, &srect_hdr, sizeof(struct rfb_srvr_rect_hdr)); -} - /* * Calculate CRC32 using SSE4.2; Intel or AMD Bulldozer+ CPUs only */ @@ -636,9 +614,8 @@ { struct rfb_updt_msg updt_msg; struct bhyvegc_image *gc_image; - int len; - len = stream_read(cfd, ((void *)&updt_msg) + 1 , sizeof(updt_msg) - 1); + (void)stream_read(cfd, ((void *)&updt_msg) + 1 , sizeof(updt_msg) - 1); console_refresh(); gc_image = console_get_image(); @@ -666,9 +643,8 @@ rfb_recv_key_msg(struct rfb_softc *rc, int cfd) { struct rfb_key_msg key_msg; - int len; - len = stream_read(cfd, ((void *)&key_msg) + 1, sizeof(key_msg) - 1); + (void)stream_read(cfd, ((void *)&key_msg) + 1, sizeof(key_msg) - 1); console_key_event(key_msg.down, htonl(key_msg.code)); } @@ -677,9 +653,8 @@ rfb_recv_ptr_msg(struct rfb_softc *rc, int cfd) { struct rfb_ptr_msg ptr_msg; - int len; - len = stream_read(cfd, ((void *)&ptr_msg) + 1, sizeof(ptr_msg) - 1); + (void)stream_read(cfd, ((void *)&ptr_msg) + 1, sizeof(ptr_msg) - 1); console_ptr_event(ptr_msg.button, htons(ptr_msg.x), htons(ptr_msg.y)); } @@ -876,13 +851,15 @@ } static int -sse42_supported() +sse42_supported(void) { - unsigned int eax, ebx, ecx, edx; - - __get_cpuid(1, &eax, &ebx, &ecx, &edx); - - return ((ecx & bit_SSE42) != 0); + u_int cpu_registers[4], ecx; + + do_cpuid(1, cpu_registers); + + ecx = cpu_registers[2]; + + return ((ecx & CPUID2_SSE42) != 0); } int Index: usr.sbin/bhyve/usb_mouse.c =================================================================== --- usr.sbin/bhyve/usb_mouse.c +++ usr.sbin/bhyve/usb_mouse.c @@ -297,9 +297,6 @@ umouse_init(struct usb_hci *hci, char *opt) { struct umouse_softc *sc; - char *mopt; - - mopt = opt; sc = calloc(1, sizeof(struct umouse_softc)); sc->hci = hci;