-/* $OpenBSD: vmm.c,v 1.36 2016/08/17 05:07:13 deraadt Exp $ */
+/* $OpenBSD: vmm.c,v 1.37 2016/08/31 06:55:39 mlarkin Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
* vcpu_exit_inout
*
* Handle all I/O exits that need to be emulated in vmd. This includes the
- * i8253 PIT and the com1 ns8250 UART.
+ * i8253 PIT, the com1 ns8250 UART, and the MC146818 RTC/NVRAM device.
*
* Parameters:
* vrp: vcpu run parameters containing guest state for this exit
*
* Return values:
* 0: the exit was handled successfully
- * 1: an error occurred (exit not handled)
+ * 1: an error occurred (eg, unknown exit reason passed in 'vrp')
*/
int
vcpu_exit(struct vm_run_params *vrp)
/*
* write_mem
*
- * Pushes data from 'buf' into the guest VM's memory at paddr 'dst'.
+ * Copies data from 'buf' into the guest VM's memory at paddr 'dst'.
*
* Parameters:
- * dst: the destination paddr_t in the guest VM to push into.
- * buf: data to push
- * len: size of 'buf'
+ * dst: the destination paddr_t in the guest VM
+ * buf: data to copy
+ * len: number of bytes to copy
*
* Return values:
* 0: success
vmr = find_gpa_range(¤t_vm->vm_params, dst, len);
if (vmr == NULL) {
errno = EINVAL;
- log_warn("writepage ioctl failed: "
- "invalid memory range dst = 0x%lx, len = 0x%zx", dst, len);
+ log_warn("%s: failed - invalid memory range dst = 0x%lx, "
+ "len = 0x%zx", __func__, dst, len);
return (EINVAL);
}
* Parameters:
* src: the source paddr_t in the guest VM to read from.
* buf: destination (local) buffer
- * len: size of 'buf'
+ * len: number of bytes to read
*
* Return values:
* 0: success
vmr = find_gpa_range(¤t_vm->vm_params, src, len);
if (vmr == NULL) {
errno = EINVAL;
- log_warn("readpage ioctl failed: "
- "invalid memory range src = 0x%lx, len = 0x%zx", src, len);
+ log_warn("%s: failed - invalid memory range src = 0x%lx, "
+ "len = 0x%zx", __func__, src, len);
return (EINVAL);
}
/*
* fd_hasdata
*
- * Returns 1 if data can be read from an fd, or 0 otherwise.
+ * Determines if data can be read from a file descriptor.
+ *
+ * Parameters:
+ * fd: the fd to check
+ *
+ * Return values:
+ * 1 if data can be read from an fd, or 0 otherwise.
*/
int
fd_hasdata(int fd)