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;
25 int vnet_lock_init(vnet_lock_t * lock) {
26 if((host_hooks) && host_hooks->mutex_alloc){
27 *lock = (addr_t)(host_hooks->mutex_alloc());
38 struct vnet_thread * vnet_start_thread(int (*func)(void *), void *arg, char * name){
39 if((host_hooks) && host_hooks->thread_start){
40 struct vnet_thread * thread = Vnet_Malloc(sizeof(struct vnet_thread));
41 thread->host_thread = host_hooks->thread_start(func, arg, name);
43 if(thread->host_thread){
54 struct vnet_timer * vnet_create_timer(unsigned long interval,
55 void (* timer_fun)(void * priv_data),
57 if((host_hooks) && host_hooks->timer_create){
58 struct vnet_timer * timer = Vnet_Malloc(sizeof(struct vnet_timer));
59 timer->host_timer = host_hooks->timer_create(interval, timer_fun, priv_data);
67 void init_vnet(struct vnet_host_hooks * hooks){