-/* $OpenBSD: atomicio.h,v 1.1 2017/05/08 09:08:40 reyk Exp $ */
+/* $OpenBSD: atomicio.h,v 1.2 2021/06/16 16:55:02 dv Exp $ */
/*
* Copyright (c) 2006 Damien Miller. All rights reserved.
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <sys/uio.h>
+
#ifndef _ATOMICIO_H
#define _ATOMICIO_H
-/* $OpenBSD: control.c,v 1.36 2021/06/10 19:50:05 dv Exp $ */
+/* $OpenBSD: control.c,v 1.37 2021/06/16 16:55:02 dv Exp $ */
/*
* Copyright (c) 2010-2015 Reyk Floeter <reyk@openbsd.org>
#include <errno.h>
#include <event.h>
#include <fcntl.h>
+#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <signal.h>
#include "proc.h"
#include "vmd.h"
-/* $OpenBSD: dhcp.c,v 1.10 2021/06/08 14:37:48 dv Exp $ */
+/* $OpenBSD: dhcp.c,v 1.11 2021/06/16 16:55:02 dv Exp $ */
/*
* Copyright (c) 2017 Reyk Floeter <reyk@openbsd.org>
#include <string.h>
#include <stddef.h>
-#include "proc.h"
-#include "vmd.h"
#include "dhcp.h"
#include "virtio.h"
+#include "vmd.h"
#define OPTIONS_OFFSET offsetof(struct dhcp_packet, options)
#define OPTIONS_MAX_LEN \
-/* $OpenBSD: fw_cfg.c,v 1.2 2019/10/11 15:25:40 jsg Exp $ */
+/* $OpenBSD: fw_cfg.c,v 1.3 2021/06/16 16:55:02 dv Exp $ */
/*
* Copyright (c) 2018 Claudio Jeker <claudio@openbsd.org>
*
#include <unistd.h>
#include "atomicio.h"
-#include "proc.h"
#include "vmd.h"
#include "vmm.h"
#include "fw_cfg.h"
-/* $OpenBSD: fw_cfg.h,v 1.1 2018/12/10 21:30:33 claudio Exp $ */
+/* $OpenBSD: fw_cfg.h,v 1.2 2021/06/16 16:55:02 dv Exp $ */
/*
* Copyright (c) 2018 Claudio Jeker <claudio@openbsd.org>
*
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include "vmd.h"
+
+#ifndef _FW_CFG_H_
+#define _FW_CFG_H_
+
#define FW_CFG_IO_SELECT 0x510
#define FW_CFG_IO_DATA 0x511
#define FW_CFG_IO_DMA_ADDR_HIGH 0x514
uint8_t vcpu_exit_fw_cfg(struct vm_run_params *);
uint8_t vcpu_exit_fw_cfg_dma(struct vm_run_params *);
void fw_cfg_add_file(const char *, const void *, size_t);
+
+#endif /* _FW_CFG_H_ */
-/* $OpenBSD: i8253.c,v 1.33 2021/03/29 13:09:41 dv Exp $ */
+/* $OpenBSD: i8253.c,v 1.34 2021/06/16 16:55:02 dv Exp $ */
/*
* Copyright (c) 2016 Mike Larkin <mlarkin@openbsd.org>
*
#include <unistd.h>
#include "i8253.h"
-#include "proc.h"
#include "vmd.h"
#include "vmm.h"
#include "atomicio.h"
-/* $OpenBSD: i8259.c,v 1.19 2018/07/12 10:15:44 mlarkin Exp $ */
+/* $OpenBSD: i8259.c,v 1.20 2021/06/16 16:55:02 dv Exp $ */
/*
* Copyright (c) 2016 Mike Larkin <mlarkin@openbsd.org>
*
#include <unistd.h>
#include <pthread.h>
-#include "proc.h"
-#include "i8259.h"
-#include "vmm.h"
+
#include "atomicio.h"
+#include "i8259.h"
#include "vmd.h"
+#include "vmm.h"
struct i8259 {
uint8_t irr;
/* $NetBSD: loadfile.h,v 1.1 1999/04/28 09:08:50 christos Exp $ */
-/* $OpenBSD: loadfile.h,v 1.14 2021/04/05 18:09:48 dv Exp $ */
+/* $OpenBSD: loadfile.h,v 1.15 2021/06/16 16:55:02 dv Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
#include <zlib.h>
+#include "vmd.h"
+
+#ifndef _LOADFILE_H_
+#define _LOADFILE_H_
+
/*
* Array indices in the u_long position array
*/
int loadfile_elf(gzFile, struct vm_create_params *, struct vcpu_reg_state *);
size_t mread(gzFile, paddr_t, size_t);
+
+#endif /* _LOADFILE_H_ */
-/* $OpenBSD: mc146818.c,v 1.23 2021/03/29 13:09:41 dv Exp $ */
+/* $OpenBSD: mc146818.c,v 1.24 2021/06/16 16:55:02 dv Exp $ */
/*
* Copyright (c) 2016 Mike Larkin <mlarkin@openbsd.org>
*
#include <time.h>
#include <unistd.h>
-#include "vmd.h"
+#include "atomicio.h"
#include "mc146818.h"
-#include "proc.h"
#include "virtio.h"
+#include "vmd.h"
#include "vmm.h"
-#include "atomicio.h"
#define MC_DIVIDER_MASK 0xe0
#define MC_RATE_MASK 0xf
-/* $OpenBSD: ns8250.c,v 1.30 2021/03/29 13:09:41 dv Exp $ */
+/* $OpenBSD: ns8250.c,v 1.31 2021/06/16 16:55:02 dv Exp $ */
/*
* Copyright (c) 2016 Mike Larkin <mlarkin@openbsd.org>
*
#include <string.h>
#include <unistd.h>
+#include "atomicio.h"
#include "ns8250.h"
-#include "proc.h"
#include "vmd.h"
#include "vmm.h"
-#include "atomicio.h"
extern char *__progname;
struct ns8250_dev com1_dev;
-/* $OpenBSD: packet.c,v 1.3 2021/06/15 10:38:53 claudio Exp $ */
+/* $OpenBSD: packet.c,v 1.4 2021/06/16 16:55:02 dv Exp $ */
/* Packet assembly code, originally contributed by Archie Cobbs. */
#include "dhcp.h"
#include "vmd.h"
-#include "proc.h"
u_int32_t checksum(unsigned char *, u_int32_t, u_int32_t);
u_int32_t wrapsum(u_int32_t);
-/* $OpenBSD: parse.y,v 1.57 2021/06/02 14:40:46 dv Exp $ */
+/* $OpenBSD: parse.y,v 1.58 2021/06/16 16:55:02 dv Exp $ */
/*
* Copyright (c) 2007-2016 Reyk Floeter <reyk@openbsd.org>
#include <pwd.h>
#include <grp.h>
-#include "proc.h"
#include "vmd.h"
TAILQ_HEAD(files, file) files = TAILQ_HEAD_INITIALIZER(files);
free($3);
YYERROR;
}
-
+
free($2);
name = $3;
vmc.vmc_flags |= VMOP_CREATE_INSTANCE;
-/* $OpenBSD: pci.c,v 1.28 2019/10/16 02:47:34 mlarkin Exp $ */
+/* $OpenBSD: pci.c,v 1.29 2021/06/16 16:55:02 dv Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
#include <string.h>
#include <unistd.h>
+
#include "vmd.h"
#include "pci.h"
#include "vmm.h"
-/* $OpenBSD: pci.h,v 1.8 2020/09/08 20:09:43 kettenis Exp $ */
+/* $OpenBSD: pci.h,v 1.9 2021/06/16 16:55:02 dv Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <sys/types.h>
+
+#include <dev/pci/pcireg.h>
+
+#include "vmd.h"
+
+#ifndef _PCI_H_
+#define _PCI_H_
+
#define PCI_MODE1_ENABLE 0x80000000UL
#define PCI_MODE1_ADDRESS_REG 0x0cf8
#define PCI_MODE1_DATA_REG 0x0cfc
uint8_t pci_get_dev_irq(uint8_t);
int pci_dump(int);
int pci_restore(int);
+
+#endif /* _PCI_H_ */
-/* $OpenBSD: proc.h,v 1.19 2021/04/20 21:11:56 dv Exp $ */
+/* $OpenBSD: proc.h,v 1.20 2021/06/16 16:55:02 dv Exp $ */
/*
* Copyright (c) 2010-2015 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/socket.h>
#include <sys/queue.h>
+#include <sys/socket.h>
#include <sys/uio.h>
-#include <imsg.h>
#include <event.h>
+#include <imsg.h>
#ifndef _PROC_H
#define _PROC_H
-/* $OpenBSD: vioqcow2.c,v 1.15 2021/04/29 23:27:10 dv Exp $ */
+/* $OpenBSD: vioqcow2.c,v 1.16 2021/06/16 16:55:02 dv Exp $ */
/*
* Copyright (c) 2018 Ori Bernstein <ori@eigenstate.org>
#include <sys/types.h>
#include <sys/stat.h>
-#include <machine/vmmvar.h>
#include <dev/pci/pcireg.h>
+#include <machine/vmmvar.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
#include <assert.h>
-#include <libgen.h>
#include <err.h>
#include <errno.h>
+#include <fcntl.h>
+#include <libgen.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
-#include "vmd.h"
-#include "vmm.h"
#include "virtio.h"
#define QCOW2_COMPRESSED 0x4000000000000000ull
-/* $OpenBSD: vioraw.c,v 1.5 2018/11/26 10:39:30 reyk Exp $ */
+/* $OpenBSD: vioraw.c,v 1.6 2021/06/16 16:55:02 dv Exp $ */
/*
* Copyright (c) 2018 Ori Bernstein <ori@eigenstate.org>
*
#include <sys/types.h>
#include <sys/stat.h>
-#include <machine/vmmvar.h>
-#include <dev/pci/pcireg.h>
-
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
-#include "vmd.h"
-#include "vmm.h"
#include "virtio.h"
static ssize_t
-/* $OpenBSD: vioscsi.c,v 1.18 2021/05/18 11:06:43 dv Exp $ */
+/* $OpenBSD: vioscsi.c,v 1.19 2021/06/16 16:55:02 dv Exp $ */
/*
* Copyright (c) 2017 Carlos Cardenas <ccardenas@openbsd.org>
*/
#include <sys/types.h>
+
#include <dev/pci/virtio_pcireg.h>
#include <dev/pv/vioscsireg.h>
#include <scsi/scsi_all.h>
-/* $OpenBSD: virtio.c,v 1.88 2021/06/11 21:46:00 dv Exp $ */
+/* $OpenBSD: virtio.c,v 1.89 2021/06/16 16:55:02 dv Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
#include <string.h>
#include <unistd.h>
+#include "atomicio.h"
#include "pci.h"
+#include "vioscsi.h"
+#include "virtio.h"
#include "vmd.h"
#include "vmm.h"
-#include "virtio.h"
-#include "vioscsi.h"
-#include "loadfile.h"
-#include "atomicio.h"
extern char *__progname;
struct viornd_dev viornd;
-/* $OpenBSD: virtio.h,v 1.38 2021/04/21 18:27:36 dv Exp $ */
+/* $OpenBSD: virtio.h,v 1.39 2021/06/16 16:55:02 dv Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <sys/types.h>
+
#include <dev/pv/virtioreg.h>
+#include <event.h>
+
+#include "vmd.h"
+
+#ifndef _VIRTIO_H_
+#define _VIRTIO_H_
+
#define VIRTQUEUE_ALIGN(n) (((n)+(VIRTIO_PAGE_SIZE-1))& \
~(VIRTIO_PAGE_SIZE-1))
#define ALIGNSZ(sz, align) ((sz + align - 1) & ~(align - 1))
int vioscsi_notifyq(struct vioscsi_dev *);
void virtio_stop(struct vm_create_params *vcp);
void virtio_start(struct vm_create_params *vcp);
+
+#endif /* _VIRTIO_H_ */
-/* $OpenBSD: vm.c,v 1.62 2021/04/05 18:09:48 dv Exp $ */
+/* $OpenBSD: vm.c,v 1.63 2021/06/16 16:55:02 dv Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
#include <unistd.h>
#include <util.h>
-#include "vmd.h"
-#include "vmm.h"
-#include "loadfile.h"
-#include "pci.h"
-#include "virtio.h"
-#include "proc.h"
+#include "atomicio.h"
+#include "fw_cfg.h"
#include "i8253.h"
#include "i8259.h"
-#include "ns8250.h"
+#include "loadfile.h"
#include "mc146818.h"
-#include "fw_cfg.h"
-#include "atomicio.h"
+#include "ns8250.h"
+#include "pci.h"
+#include "virtio.h"
+#include "vmd.h"
+#include "vmm.h"
io_fn_t ioports_map[MAX_PORTS];