X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Finclude%2Fvnet%2Fvnet_host.h;h=3519cf49349ef17b300e958ac2d1422029345baf;hb=e39ac677ad4eb2c2db111ce08eb6172c61f5001f;hp=47f6481781c597e489910d030623bd0643e03064;hpb=f904d129c5f7f44493bba3c9a82c150bbb613217;p=palacios.releases.git diff --git a/palacios/include/vnet/vnet_host.h b/palacios/include/vnet/vnet_host.h index 47f6481..3519cf4 100644 --- a/palacios/include/vnet/vnet_host.h +++ b/palacios/include/vnet/vnet_host.h @@ -20,6 +20,7 @@ #ifndef __VNET_HOST_H__ #define __VNET_HOST_H__ +#include #include struct vnet_thread { @@ -30,21 +31,27 @@ struct vnet_timer { void * host_timer; }; -typedef addr_t vnet_lock_t; +typedef unsigned long vnet_lock_t; struct vnet_host_hooks { - void *(*thread_start)(int (*fn)(void * arg), void * arg, char * thread_name); - void (*thread_sleep)(int timeout); + void *(*thread_start)(int (*fn)(void * arg), + void * arg, + char * thread_name); + + void (*thread_sleep)(long timeout); void (*thread_wakeup)(void * thread); void (*thread_stop)(void * thread); - int (*thread_should_stop)(); + int (*thread_should_stop)(void); + + void *(*timer_create)(unsigned long interval, + void (* timer_fun)(void * priv_data), + void * data); - void *(*timer_create)(unsigned long interval, void (* timer_fun)(void * priv_data), void * data); void (*timer_del)(void * timer); - int (*timer_start)(void * timer); - int (*timer_stop)(void * timer); + void (*timer_start)(void * timer); + void (*timer_stop)(void * timer); void (*timer_reset)(void * timer, unsigned long interval); void (*udelay)(unsigned long usecs); @@ -71,6 +78,8 @@ struct vnet_host_hooks { +#ifdef __V3VEE__ + extern struct vnet_host_hooks * host_hooks; @@ -101,7 +110,7 @@ static inline void * Vnet_VAddr(void * addr) { return NULL; } -static inline void * Vnet_PAddr(void *addr) { +static inline void * Vnet_PAddr(void * addr) { if ((host_hooks) && host_hooks->vaddr_to_paddr) { return host_hooks->vaddr_to_paddr(addr); } @@ -124,7 +133,7 @@ static inline void Vnet_Free(void * addr){ } -static inline void Vnet_Yield(){ +static inline void Vnet_Yield(void){ if ((host_hooks) && (host_hooks)->yield_cpu) { host_hooks->yield_cpu(); } @@ -132,7 +141,7 @@ static inline void Vnet_Yield(){ /* THREAD FUNCTIONS */ struct vnet_thread * vnet_start_thread(int (*func)(void *), - void *arg, char * name); + void * arg, char * name); static inline void vnet_thread_sleep(long timeout){ if((host_hooks) && host_hooks->thread_sleep){ @@ -153,7 +162,7 @@ static inline void vnet_thread_stop(struct vnet_thread * thread){ } } -static inline int vnet_thread_should_stop(){ +static inline int vnet_thread_should_stop(void){ if((host_hooks) && host_hooks->thread_should_stop){ return host_hooks->thread_should_stop(); } @@ -180,23 +189,20 @@ static inline void vnet_del_timer(struct vnet_timer * timer){ } } -static inline int vnet_start_timer(struct vnet_timer * timer){ +static inline void vnet_start_timer(struct vnet_timer * timer){ if((host_hooks) && host_hooks->timer_start){ - return host_hooks->timer_start(timer->host_timer); + host_hooks->timer_start(timer->host_timer); } - - return -1; } -static inline int vnet_stop_timer(struct vnet_timer * timer){ +static inline void vnet_stop_timer(struct vnet_timer * timer){ if((host_hooks) && host_hooks->timer_stop){ - return host_hooks->timer_stop(timer->host_timer); + host_hooks->timer_stop(timer->host_timer); } - - return -1; } -static inline void vnet_reset_timer(struct vnet_timer * timer, unsigned long new_interval){ +static inline void vnet_reset_timer(struct vnet_timer * timer, + unsigned long new_interval){ if((host_hooks) && host_hooks->timer_reset){ host_hooks->timer_reset(timer->host_timer, new_interval); } @@ -206,8 +212,8 @@ static inline void vnet_reset_timer(struct vnet_timer * timer, unsigned long new #define Vnet_Print(level, fmt, args...) \ do { \ - extern int vnet_debug; \ - if(level <= vnet_debug) { \ + extern int net_debug; \ + if(level <= net_debug) { \ extern struct vnet_host_hooks * host_hooks; \ if ((host_hooks) && (host_hooks)->print) { \ (host_hooks)->print((fmt), ##args); \ @@ -218,14 +224,15 @@ static inline void vnet_reset_timer(struct vnet_timer * timer, unsigned long new #define Vnet_Debug(fmt, args...) \ do { \ - extern struct vnet_host_hooks * host_hooks; \ - if ((host_hooks) && (host_hooks)->print) { \ - (host_hooks)->print((fmt), ##args); \ - } \ + extern struct vnet_host_hooks * host_hooks; \ + if ((host_hooks) && (host_hooks)->print) { \ + (host_hooks)->print((fmt), ##args); \ + } \ } while (0) + /* Lock Utilities */ int vnet_lock_init(vnet_lock_t * lock); @@ -242,18 +249,19 @@ static inline void vnet_unlock(vnet_lock_t lock) { host_hooks->mutex_unlock((void *)lock); } -static inline addr_t vnet_lock_irqsave(vnet_lock_t lock) { - addr_t irq_state = v3_irq_save(); +static inline unsigned long vnet_lock_irqsave(vnet_lock_t lock) { + //addr_t irq_state = v3_irq_save(); host_hooks->mutex_lock((void *)lock, 1); - return irq_state; + return 0; } static inline void vnet_unlock_irqrestore(vnet_lock_t lock, addr_t irq_state) { host_hooks->mutex_unlock((void *)lock); - v3_irq_restore(irq_state); + //v3_irq_restore(irq_state); } +#endif void init_vnet(struct vnet_host_hooks * hooks);