X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvm_dev.c;h=9078f66e20ca1b06e123b85dec696384a338cdd4;hb=1bafb4aec89c2c611117ec6ccc17d0f22f392254;hp=8cb45b4fa200d65cd8dc3311878796a4debd28c0;hpb=2b1f4ef19d766727f873476861c64339c8836a40;p=palacios.git diff --git a/palacios/src/palacios/vm_dev.c b/palacios/src/palacios/vm_dev.c index 8cb45b4..9078f66 100644 --- a/palacios/src/palacios/vm_dev.c +++ b/palacios/src/palacios/vm_dev.c @@ -1,42 +1,53 @@ -#include -#include - +/* + * This file is part of the Palacios Virtual Machine Monitor developed + * by the V3VEE Project with funding from the United States National + * Science Foundation and the Department of Energy. + * + * The V3VEE Project is a joint project between Northwestern University + * and the University of New Mexico. You can find out more at + * http://www.v3vee.org + * + * Copyright (c) 2008, Jack Lange + * Copyright (c) 2008, The V3VEE Project + * All rights reserved. + * + * Author: Jack Lange + * + * This is free software. You are permitted to use, + * redistribute, and modify it as specified in the file "V3VEE_LICENSE". + */ -struct vm_device * allocate_device() { +#include +#include - struct vm_device * dev = NULL; - V3_Malloc(struct vm_device *, dev, sizeof(struct vm_device)); - dev->ops = NULL; - memset(dev->name, 0, 32); - dev->vm = NULL; - dev->private_data = NULL; +static struct vm_device * v3_allocate_device() { + struct vm_device * dev = NULL; + dev = (struct vm_device*)V3_Malloc(sizeof(struct vm_device)); - INIT_LIST_HEAD(&(dev->io_hooks)); - dev->num_io_hooks = 0; + V3_ASSERT(dev != NULL); - INIT_LIST_HEAD(&(dev->mem_hooks)); - dev->num_mem_hooks = 0; - - INIT_LIST_HEAD(&(dev->irq_hooks)); - dev->num_irq_hooks = 0; + dev->ops = NULL; + memset(dev->name, 0, 32); + dev->vm = NULL; + dev->private_data = NULL; - return dev; + return dev; } -struct vm_device * create_device(char * name, struct vm_device_ops * ops, void * private_data) { - struct vm_device * dev = allocate_device(); +struct vm_device * v3_create_device(char * name, struct vm_device_ops * ops, void * private_data) { + struct vm_device * dev = v3_allocate_device(); - strncpy(dev->name, name, 32); - dev->ops = ops; - dev->private_data = private_data; + strncpy(dev->name, name, 32); + dev->ops = ops; + dev->private_data = private_data; - return dev; + return dev; } -void free_device(struct vm_device * dev) { - V3_Free(dev); +void v3_free_device(struct vm_device * dev) { + V3_Free(dev); }