# HG changeset patch
# User Jerone Young <[EMAIL PROTECTED]>
# Date 1194367649 21600
# Node ID cb186258bc6ecf05ded03d81a3d2ee820e58f605
# Parent  7ea01f673a05fe66cb0d9c514b5a43ddcd72c07f
Move kvm_create_memory_alias & kvm_destroy_memory_alias to libkvm-x86.c

Signed-off-by: Jerone Young <[EMAIL PROTECTED]>

diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -294,3 +294,32 @@ void *kvm_create_kernel_phys_mem(kvm_con
        return ptr;
 }
 
+int kvm_create_memory_alias(kvm_context_t kvm,
+                           uint64_t phys_addr,
+                           uint64_t phys_start,
+                           uint64_t len,
+                           uint64_t target_phys)
+{
+       struct kvm_memory_alias alias = {
+               .flags = 0,
+               .guest_phys_addr = phys_start,
+               .memory_size = len,
+               .target_phys_addr = target_phys,
+       };
+       int fd = kvm->vm_fd;
+       int r;
+
+       alias.slot = get_slot(phys_addr);
+
+       r = ioctl(fd, KVM_SET_MEMORY_ALIAS, &alias);
+       if (r == -1)
+           return -errno;
+
+       return 0;
+}
+
+int kvm_destroy_memory_alias(kvm_context_t kvm, uint64_t phys_addr)
+{
+       return kvm_create_memory_alias(kvm, phys_addr, 0, 0, 0);
+}
+

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to