# HG changeset patch
# User Jerone Young <[EMAIL PROTECTED]>
# Date 1194027872 18000
# Node ID 8e77064ea82d0b7fbd8bb77429bbfd62f99c00f6
# Parent  02f38e54018070bafd501df846147f4ae7661109
Move kvm_create_phys_mem to libkvm-x86.c

This patch moves kvm_create_phys_mem to libkvm-x86.c

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

diff --git a/libkvm/kvm-common.h b/libkvm/kvm-common.h
--- a/libkvm/kvm-common.h
+++ b/libkvm/kvm-common.h
@@ -34,4 +34,8 @@ struct kvm_context {
        int irqchip_in_kernel;
 };
 
+#ifdef KVM_CAP_USER_MEMORY
+void *kvm_create_userspace_phys_mem(kvm_context_t kvm, unsigned long 
phys_start,
+                       unsigned long len, int log, int writable);
 #endif
+#endif
diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -306,3 +306,19 @@ void *kvm_create_kernel_phys_mem(kvm_con
        return ptr;
 }
 
+void *kvm_create_phys_mem(kvm_context_t kvm, unsigned long phys_start,
+                         unsigned long len, int log, int writable)
+{
+#ifdef KVM_CAP_USER_MEMORY
+       int r;
+
+       r = ioctl(kvm->fd, KVM_CHECK_EXTENSION, KVM_CAP_USER_MEMORY);
+       if (r > 0)
+               return kvm_create_userspace_phys_mem(kvm, phys_start, len,
+                                                               log, writable);
+       else
+#endif
+               return kvm_create_kernel_phys_mem(kvm, phys_start, len,
+                                                               log, writable);
+}
+
diff --git a/libkvm/libkvm-x86.h b/libkvm/libkvm-x86.h
new file mode 100644
--- /dev/null
+++ b/libkvm/libkvm-x86.h
@@ -0,0 +1,11 @@
+/* This header is for x86 functions & variables that will be exposed to users.
+ * DO NOT PLACE FUNCTIONS OR VARIABLES HERE THAT ARE NOT GOING TO EXPOSED TO 
+ * USERS.
+ */
+#ifndef LIBKVM_X86_H
+#define LIBKVM_X86_H
+
+void *kvm_create_phys_mem(kvm_context_t, unsigned long phys_start, 
+                         unsigned long len, int log, int writable);
+
+#endif
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -415,21 +415,6 @@ void *kvm_create_userspace_phys_mem(kvm_
 
 #endif
 
-void *kvm_create_phys_mem(kvm_context_t kvm, unsigned long phys_start,
-                         unsigned long len, int log, int writable)
-{
-#ifdef KVM_CAP_USER_MEMORY
-       int r;
-
-       r = ioctl(kvm->fd, KVM_CHECK_EXTENSION, KVM_CAP_USER_MEMORY);
-       if (r > 0)
-               return kvm_create_userspace_phys_mem(kvm, phys_start, len,
-                                                               log, writable);
-       else
-#endif
-               return kvm_create_kernel_phys_mem(kvm, phys_start, len,
-                                                               log, writable);
-}
 
 int kvm_register_userspace_phys_mem(kvm_context_t kvm,
                        unsigned long phys_start, void *userspace_addr,
diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
--- a/libkvm/libkvm.h
+++ b/libkvm/libkvm.h
@@ -26,6 +26,11 @@ struct kvm_context;
 struct kvm_context;
 
 typedef struct kvm_context *kvm_context_t;
+
+#if defined(__x86_64__) || defined(__i386__)
+#include "libkvm-x86.h"
+#endif
+
 
 /*!
  * \brief KVM callbacks structure
@@ -413,8 +418,6 @@ void kvm_show_regs(kvm_context_t kvm, in
 void kvm_show_regs(kvm_context_t kvm, int vcpu);
 
 
-void *kvm_create_phys_mem(kvm_context_t, unsigned long phys_start, 
-                         unsigned long len, int log, int writable);
 void kvm_destroy_phys_mem(kvm_context_t, unsigned long phys_start, 
                          unsigned long len);
 int kvm_register_userspace_phys_mem(kvm_context_t kvm,

-------------------------------------------------------------------------
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