diff options
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/vmd/i8253.c | 4 | ||||
-rw-r--r-- | usr.sbin/vmd/i8259.c | 2 | ||||
-rw-r--r-- | usr.sbin/vmd/ns8250.c | 48 | ||||
-rw-r--r-- | usr.sbin/vmd/pci.c | 16 | ||||
-rw-r--r-- | usr.sbin/vmd/vmm.c | 28 |
5 files changed, 49 insertions, 49 deletions
diff --git a/usr.sbin/vmd/i8253.c b/usr.sbin/vmd/i8253.c index 4f6d6f3a488..bd96c1b3a18 100644 --- a/usr.sbin/vmd/i8253.c +++ b/usr.sbin/vmd/i8253.c @@ -83,7 +83,7 @@ vcpu_exit_i8253(struct vm_run_params *vrp) union vm_exit *vei = vrp->vrp_exit; if (vei->vei.vei_port == TIMER_CTRL) { - if (vei->vei.vei_dir == 0) { /* OUT instruction */ + if (vei->vei.vei_dir == VEI_DIR_OUT) { /* OUT instruction */ out_data = vei->vei.vei_data; sel = out_data & (TIMER_SEL0 | TIMER_SEL1 | TIMER_SEL2); @@ -147,7 +147,7 @@ vcpu_exit_i8253(struct vm_run_params *vrp) "selected", __func__, sel); } - if (vei->vei.vei_dir == 0) { /* OUT instruction */ + if (vei->vei.vei_dir == VEI_DIR_OUT) { /* OUT instruction */ if (i8253_counter[sel].last_w == 0) { out_data = vei->vei.vei_data; i8253_counter[sel].ilatch |= (out_data & 0xff); diff --git a/usr.sbin/vmd/i8259.c b/usr.sbin/vmd/i8259.c index aad10f5bcb9..175c9452823 100644 --- a/usr.sbin/vmd/i8259.c +++ b/usr.sbin/vmd/i8259.c @@ -613,7 +613,7 @@ vcpu_exit_i8259(struct vm_run_params *vrp) { union vm_exit *vei = vrp->vrp_exit; - if (vei->vei.vei_dir == 0) { + if (vei->vei.vei_dir == VEI_DIR_OUT) { i8259_io_write(vei); } else { vei->vei.vei_data = i8259_io_read(vei); diff --git a/usr.sbin/vmd/ns8250.c b/usr.sbin/vmd/ns8250.c index 363c90ad6e3..3adf0d8a8e3 100644 --- a/usr.sbin/vmd/ns8250.c +++ b/usr.sbin/vmd/ns8250.c @@ -49,14 +49,14 @@ void vcpu_process_com_data(union vm_exit *vei) { /* - * vei_dir == 0 : out instruction + * vei_dir == VEI_DIR_OUT : out instruction * * The guest wrote to the data register. Since we are emulating a * no-fifo chip, write the character immediately to the pty and * assert TXRDY in IIR (if the guest has requested TXRDY interrupt * reporting) */ - if (vei->vei.vei_dir == 0) { + if (vei->vei.vei_dir == VEI_DIR_OUT) { write(com1_regs.fd, &vei->vei.vei_data, 1); if (com1_regs.ier & 0x2) { /* Set TXRDY */ @@ -66,7 +66,7 @@ vcpu_process_com_data(union vm_exit *vei) } } else { /* - * vei_dir == 1 : in instruction + * vei_dir == VEI_DIR_IN : in instruction * * The guest read from the data register. Check to see if * there is data available (RXRDY) and if so, consume the @@ -108,15 +108,15 @@ void vcpu_process_com_lcr(union vm_exit *vei) { /* - * vei_dir == 0 : out instruction + * vei_dir == VEI_DIR_OUT : out instruction * * Write content to line control register */ - if (vei->vei.vei_dir == 0) { + if (vei->vei.vei_dir == VEI_DIR_OUT) { com1_regs.lcr = (uint8_t)vei->vei.vei_data; } else { /* - * vei_dir == 1 : in instruction + * vei_dir == VEI_DIR_IN : in instruction * * Read line control register */ @@ -140,15 +140,15 @@ void vcpu_process_com_iir(union vm_exit *vei) { /* - * vei_dir == 0 : out instruction + * vei_dir == VEI_DIR_OUT : out instruction * * Write to FCR */ - if (vei->vei.vei_dir == 0) { + if (vei->vei.vei_dir == VEI_DIR_OUT) { com1_regs.fcr = vei->vei.vei_data; } else { /* - * vei_dir == 1 : in instruction + * vei_dir == VEI_DIR_IN : in instruction * * Read IIR. Reading the IIR resets the TXRDY bit in the IIR * after the data is read. @@ -179,15 +179,15 @@ void vcpu_process_com_mcr(union vm_exit *vei) { /* - * vei_dir == 0 : out instruction + * vei_dir == VEI_DIR_OUT : out instruction * * Write to MCR */ - if (vei->vei.vei_dir == 0) { + if (vei->vei.vei_dir == VEI_DIR_OUT) { com1_regs.mcr = vei->vei.vei_data; } else { /* - * vei_dir == 1 : in instruction + * vei_dir == VEI_DIR_IN : in instruction * * Read from MCR */ @@ -208,17 +208,17 @@ void vcpu_process_com_lsr(union vm_exit *vei) { /* - * vei_dir == 0 : out instruction + * vei_dir == VEI_DIR_OUT : out instruction * * Write to LSR. This is an illegal operation, so we just log it and * continue. */ - if (vei->vei.vei_dir == 0) { + if (vei->vei.vei_dir == VEI_DIR_OUT) { log_warnx("%s: LSR UART write 0x%x unsupported", __progname, vei->vei.vei_data); } else { /* - * vei_dir == 1 : in instruction + * vei_dir == VEI_DIR_IN : in instruction * * Read from LSR. We always report TXRDY and TSRE since we * can process output characters immediately (at any time). @@ -240,17 +240,17 @@ void vcpu_process_com_msr(union vm_exit *vei) { /* - * vei_dir == 0 : out instruction + * vei_dir == VEI_DIR_OUT : out instruction * * Write to MSR. This is an illegal operation, so we just log it and * continue. */ - if (vei->vei.vei_dir == 0) { + if (vei->vei.vei_dir == VEI_DIR_OUT) { log_warnx("%s: MSR UART write 0x%x unsupported", __progname, vei->vei.vei_data); } else { /* - * vei_dir == 1 : in instruction + * vei_dir == VEI_DIR_IN : in instruction * * Read from MSR. We always report DCD, DSR, and CTS. */ @@ -275,15 +275,15 @@ void vcpu_process_com_scr(union vm_exit *vei) { /* - * vei_dir == 0 : out instruction + * vei_dir == VEI_DIR_OUT : out instruction * * Write to SCR */ - if (vei->vei.vei_dir == 0) { + if (vei->vei.vei_dir == VEI_DIR_OUT) { com1_regs.scr = vei->vei.vei_data; } else { /* - * vei_dir == 1 : in instruction + * vei_dir == VEI_DIR_IN : in instruction * * Read from SCR. To make sure we don't accidentally simulate * a real scratch register, we negate what was written on @@ -307,15 +307,15 @@ void vcpu_process_com_ier(union vm_exit *vei) { /* - * vei_dir == 0 : out instruction + * vei_dir == VEI_DIR_OUT : out instruction * * Write to IER */ - if (vei->vei.vei_dir == 0) { + if (vei->vei.vei_dir == VEI_DIR_OUT) { com1_regs.ier = vei->vei.vei_data; } else { /* - * vei_dir == 1 : in instruction + * vei_dir == VEI_DIR_IN : in instruction * * Read from IER */ diff --git a/usr.sbin/vmd/pci.c b/usr.sbin/vmd/pci.c index 80d67402b70..cfd24eca438 100644 --- a/usr.sbin/vmd/pci.c +++ b/usr.sbin/vmd/pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci.c,v 1.8 2016/09/01 13:08:47 mlarkin Exp $ */ +/* $OpenBSD: pci.c,v 1.9 2016/09/01 16:40:06 mlarkin Exp $ */ /* * Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org> @@ -189,15 +189,15 @@ pci_handle_address_reg(struct vm_run_params *vrp) union vm_exit *vei = vrp->vrp_exit; /* - * vei_dir == 0 : out instruction + * vei_dir == VEI_DIR_OUT : out instruction * * The guest wrote to the address register. */ - if (vei->vei.vei_dir == 0) { + if (vei->vei.vei_dir == VEI_DIR_OUT) { pci.pci_addr_reg = vei->vei.vei_data; } else { /* - * vei_dir == 1 : in instruction + * vei_dir == VEI_DIR_IN : in instruction * * The guest read the address register */ @@ -268,7 +268,7 @@ pci_handle_data_reg(struct vm_run_params *vrp) /* abort if the address register is wack */ if (!(pci.pci_addr_reg & PCI_MODE1_ENABLE)) { /* if read, return FFs */ - if (vei->vei.vei_dir == 1) + if (vei->vei.vei_dir == VEI_DIR_IN) vei->vei.vei_data = 0xffffffff; log_warnx("invalid address register during pci read: " "0x%llx", (uint64_t)pci.pci_addr_reg); @@ -292,12 +292,12 @@ pci_handle_data_reg(struct vm_run_params *vrp) /* No config space function, fallback to default simple r/w impl. */ /* - * vei_dir == 0 : out instruction + * vei_dir == VEI_DIR_OUT : out instruction * * The guest wrote to the config space location denoted by the current * value in the address register. */ - if (vei->vei.vei_dir == 0) { + if (vei->vei.vei_dir == VEI_DIR_OUT) { if ((o >= 0x10 && o <= 0x24) && vei->vei.vei_data == 0xffffffff) { /* @@ -318,7 +318,7 @@ pci_handle_data_reg(struct vm_run_params *vrp) pci.pci_devices[d].pd_cfg_space[o / 4] = vei->vei.vei_data; } else { /* - * vei_dir == 1 : in instruction + * vei_dir == VEI_DIR_IN : in instruction * * The guest read from the config space location determined by * the current value in the address register. diff --git a/usr.sbin/vmd/vmm.c b/usr.sbin/vmd/vmm.c index 3c4562e6108..646c1d610da 100644 --- a/usr.sbin/vmd/vmm.c +++ b/usr.sbin/vmd/vmm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmm.c,v 1.39 2016/09/01 16:04:47 stefan Exp $ */ +/* $OpenBSD: vmm.c,v 1.40 2016/09/01 16:40:06 mlarkin Exp $ */ /* * Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org> @@ -423,14 +423,14 @@ start_vm(struct imsg *imsg, uint32_t *id) struct vcpu_reg_state vrs; if ((vm = vm_getbyvmid(imsg->hdr.peerid)) == NULL) { - log_warn("%s: can't find vm", __func__); + log_warnx("%s: can't find vm", __func__); ret = ENOENT; goto err; } vcp = &vm->vm_params; if ((vm->vm_tty = imsg->fd) == -1) { - log_warn("%s: can't get tty", __func__); + log_warnx("%s: can't get tty", __func__); goto err; } @@ -442,7 +442,7 @@ start_vm(struct imsg *imsg, uint32_t *id) /* Start child failed? - cleanup and leave */ if (ret == -1) { - log_warn("%s: start child failed", __func__); + log_warnx("%s: start child failed", __func__); ret = EIO; goto err; } @@ -954,22 +954,22 @@ run_vm(int *child_disks, int *child_taps, struct vm_create_params *vcp, vrp[i]->vrp_vm_id = vcp->vcp_id; vrp[i]->vrp_vcpu_id = i; - if (vcpu_reset(vcp->vcp_id, i, vrs)) { - log_warn("%s: cannot reset VCPU %zu - exiting.", + if (vcpu_reset(vcp->vcp_id, i, vis)) { + log_warnx("%s: cannot reset VCPU %zu - exiting.", __progname, i); return (EIO); } ret = pthread_cond_init(&vcpu_run_cond[i], NULL); if (ret) { - log_warn("%s: cannot initialize cond var (%d)", + log_warnx("%s: cannot initialize cond var (%d)", __progname, ret); return (ret); } ret = pthread_mutex_init(&vcpu_run_mtx[i], NULL); if (ret) { - log_warn("%s: cannot initialize mtx (%d)", + log_warnx("%s: cannot initialize mtx (%d)", __progname, ret); return (ret); } @@ -993,7 +993,7 @@ run_vm(int *child_disks, int *child_taps, struct vm_create_params *vcp, /* Wait for all the threads to exit */ for (i = 0; i < vcp->vcp_ncpus; i++) { if (pthread_join(tid[i], &exit_status)) { - log_warn("%s: failed to join thread %zd - " + log_warnx("%s: failed to join thread %zd - " "exiting", __progname, i); return (EIO); } @@ -1037,7 +1037,7 @@ vcpu_run_loop(void *arg) ret = pthread_mutex_lock(&vcpu_run_mtx[n]); if (ret) { - log_warn("%s: can't lock vcpu run mtx (%d)", + log_warnx("%s: can't lock vcpu run mtx (%d)", __func__, (int)ret); return ((void *)ret); } @@ -1048,7 +1048,7 @@ vcpu_run_loop(void *arg) &vcpu_run_mtx[n]); if (ret) { - log_warn("%s: can't wait on cond (%d)", + log_warnx("%s: can't wait on cond (%d)", __func__, (int)ret); pthread_mutex_unlock(&vcpu_run_mtx[n]); return ((void *)ret); @@ -1079,8 +1079,8 @@ vcpu_run_loop(void *arg) if (ioctl(env->vmd_fd, VMM_IOC_RUN, vrp) < 0) { /* If run ioctl failed, exit */ ret = errno; - log_warn("%s: vm %d / vcpu %d run ioctl failed (%d)", - __func__, vrp->vrp_vm_id, n, errno); + log_warn("%s: vm %d / vcpu %d run ioctl failed", + __func__, vrp->vrp_vm_id, n); return ((void *)ret); } @@ -1174,7 +1174,7 @@ vcpu_exit_inout(struct vm_run_params *vrp) if (ioports_map[vei->vei.vei_port] != NULL) intr = ioports_map[vei->vei.vei_port](vrp); - else if (vei->vei.vei_dir == 1) + else if (vei->vei.vei_dir == VEI_DIR_IN) vei->vei.vei_data = 0xFFFFFFFF; if (intr != 0xFF) |