X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_mem.c;h=5d9b4ea4c229f3b1d62bca7fa7a2abfacdff951b;hb=57de08049d9a345445d26741c5ee0f7f9e5c2fcc;hp=659fd279b8471d60ef3c5750c64d47b2bc7ccf9a;hpb=b06d0d0e5e57f5c4163a69efcabe6f96594ad814;p=palacios.git diff --git a/palacios/src/palacios/vmm_mem.c b/palacios/src/palacios/vmm_mem.c index 659fd27..5d9b4ea 100644 --- a/palacios/src/palacios/vmm_mem.c +++ b/palacios/src/palacios/vmm_mem.c @@ -150,6 +150,22 @@ int v3_hook_full_mem(struct guest_info * info, addr_t guest_addr_start, addr_t g } +// This will unhook the memory hook registered at start address +// We do not support unhooking subregions +int v3_unhook_mem(struct guest_info * info, addr_t guest_addr_start) { + struct v3_shadow_region * reg = v3_get_shadow_region(info, guest_addr_start); + + if ((reg->host_type != SHDW_REGION_FULL_HOOK) || + (reg->host_type != SHDW_REGION_WRITE_HOOK)) { + PrintError("Trying to unhook a non hooked memory region (addr=%p)\n", (void *)guest_addr_start); + return -1; + } + + v3_delete_shadow_region(info, reg); + + return 0; +} + static inline @@ -194,7 +210,7 @@ struct v3_shadow_region * insert_shadow_region(struct guest_info * info, // flush virtual page tables // 3 cases shadow, shadow passthrough, and nested if (info->shdw_pg_mode == SHADOW_PAGING) { - v3_vm_mem_mode_t mem_mode = v3_get_mem_mode(info); + v3_mem_mode_t mem_mode = v3_get_mem_mode(info); if (mem_mode == PHYSICAL_MEM) { addr_t cur_addr; @@ -322,7 +338,7 @@ void v3_delete_shadow_region(struct guest_info * info, struct v3_shadow_region * // flush virtual page tables // 3 cases shadow, shadow passthrough, and nested if (info->shdw_pg_mode == SHADOW_PAGING) { - v3_vm_mem_mode_t mem_mode = v3_get_mem_mode(info); + v3_mem_mode_t mem_mode = v3_get_mem_mode(info); if (mem_mode == PHYSICAL_MEM) { addr_t cur_addr;