X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_extensions.c;h=b46af1b85f50d83c9f6e4f37688087d7a1883e84;hb=1c000bda0560742ad6be011722fa226771b656ff;hp=de1cfa0b3f52cbd4a825644334d0db3eb57e6b12;hpb=f18097c35ddc13572ab41e03ad7a14430cff11ac;p=palacios.git diff --git a/palacios/src/palacios/vmm_extensions.c b/palacios/src/palacios/vmm_extensions.c index de1cfa0..b46af1b 100644 --- a/palacios/src/palacios/vmm_extensions.c +++ b/palacios/src/palacios/vmm_extensions.c @@ -26,6 +26,14 @@ static struct hashtable * ext_table = NULL; +/* + * This is a place holder to ensure that the _v3_extensions section gets created by gcc + */ +static struct {} null_ext __attribute__((__used__)) \ + __attribute__((unused, __section__ ("_v3_extensions"), \ + aligned(sizeof(addr_t)))); + + static uint_t ext_hash_fn(addr_t key) { char * name = (char *)key; @@ -69,6 +77,8 @@ int V3_init_extensions() { } + + int V3_deinit_extensions() { v3_free_htable(ext_table, 0, 0); return 0; @@ -85,6 +95,15 @@ int v3_init_ext_manager(struct v3_vm_info * vm) { return 0; } + +int v3_deinit_ext_manager(struct v3_vm_info * vm) { + + PrintError("I should really do something here... \n"); + return -1; +} + + + int v3_add_extension(struct v3_vm_info * vm, const char * name, v3_cfg_tree_t * cfg) { struct v3_extension_impl * impl = NULL; struct v3_extension * ext = NULL; @@ -125,3 +144,34 @@ int v3_add_extension(struct v3_vm_info * vm, const char * name, v3_cfg_tree_t * return 0; } + +int v3_init_core_extensions(struct guest_info * core) { + struct v3_extension * ext = NULL; + + list_for_each_entry(ext, &(core->vm_info->extensions.extensions), node) { + if ((ext->impl) && (ext->impl->core_init)) { + if (ext->impl->core_init(core, ext->priv_data) == -1) { + PrintError("Error configuring per core extension %s on core %d\n", + ext->impl->name, core->vcpu_id); + return -1; + } + } + } + + return 0; +} + + + + +void * v3_get_extension_state(struct v3_vm_info * vm, const char * name) { + struct v3_extension * ext = NULL; + + list_for_each_entry(ext, &(vm->extensions.extensions), node) { + if (strncmp(ext->impl->name, name, strlen(ext->impl->name)) == 0) { + return ext->priv_data; + } + } + + return NULL; +}