2 * This file is part of the Palacios Virtual Machine Monitor developed
3 * by the V3VEE Project with funding from the United States National
4 * Science Foundation and the Department of Energy.
6 * The V3VEE Project is a joint project between Northwestern University
7 * and the University of New Mexico. You can find out more at
10 * Copyright (c) 2011, Lei Xia <lxia@northwestern.edu>
11 * Copyright (c) 2011, The V3VEE Project <http://www.v3vee.org>
12 * All rights reserved.
14 * Author: Lei Xia <lxia@northwestern.edu>
16 * This is free software. You are permitted to use,
17 * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
20 #include <vnet/vnet_host.h>
21 #include <vnet/vnet.h>
23 struct vnet_host_hooks * host_hooks;
26 int vnet_lock_init(vnet_lock_t * lock) {
27 *lock = (addr_t)(host_hooks->mutex_alloc());
37 struct vnet_thread * vnet_start_thread(int (*func)(void *), void *arg, char * name){
38 struct vnet_thread * thread;
40 thread = Vnet_Malloc(sizeof(struct vnet_thread));
42 thread->host_thread = host_hooks->thread_start(func, arg, name);
44 if(thread->host_thread == NULL){
54 struct vnet_timer * vnet_create_timer(unsigned long interval,
55 void (* timer_fun)(void * priv_data),
57 struct vnet_timer * timer = NULL;
59 if((host_hooks) && host_hooks->timer_create){
60 timer = Vnet_Malloc(sizeof(struct vnet_timer));
62 timer->host_timer = host_hooks->timer_create(interval, timer_fun, priv_data);
69 void init_vnet(struct vnet_host_hooks * hooks){