// The externally visible state is just the callbacks
v3_rw_lock_t event_callback_lock;
struct list_head event_callback_list;
+ int inited;
};
/* We track memory hooks via a hash table */
/* keyed to the memory region pointer */
struct hashtable * reg_table;
+
+ int inited; // structure needs to be deinited
};
{
INIT_LIST_HEAD(&(vm->passthrough_impl.event_callback_list));
v3_rw_lock_init(&(vm->passthrough_impl.event_callback_lock));
+ vm->passthrough_impl.inited=1;
return 0;
}
struct passthrough_event_callback *cb,*temp;
addr_t flags;
+ if (!vm->passthrough_impl.inited) {
+ return 0;
+ }
+
flags=v3_write_lock_irqsave(&(vm->passthrough_impl.event_callback_lock));
list_for_each_entry_safe(cb,
hooks->reg_table = v3_create_htable(0, mem_hash_fn, mem_eq_fn);
+ hooks->inited=1;
+
return 0;
}
struct mem_hook * tmp = NULL;
+ if (!hooks->inited) {
+ return 0;
+ }
+
// This is nasty...
// We delete the hook info but leave its memory region intact
// We rely on the memory map to clean up any orphaned regions as a result of this