summaryrefslogtreecommitdiff
path: root/libkvm
diff options
context:
space:
mode:
authorZhang Xiantao <xiantao.zhang@intel.com>2007-12-03 13:57:07 +0800
committerAvi Kivity <avi@qumranet.com>2007-12-04 12:05:13 +0200
commit78788ac9cfdbb6df64c5a232974b116cc0f437cb (patch)
tree5d5bd0427c0501a06cada8e99d14d8b76b216b1c /libkvm
parent34a42b8b4c73b561ab7e6d7fad28e5fb29406b3e (diff)
kvm: libkvm: Add kvm-ia64.h.
This patch adds kvm-ia64.h, and use getpagesize to get host page size, since ia64 can use multiple type of page size in kernel. Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'libkvm')
-rw-r--r--libkvm/kvm-ia64.h28
-rw-r--r--libkvm/libkvm.c6
2 files changed, 34 insertions, 0 deletions
diff --git a/libkvm/kvm-ia64.h b/libkvm/kvm-ia64.h
new file mode 100644
index 00000000..304496d5
--- /dev/null
+++ b/libkvm/kvm-ia64.h
@@ -0,0 +1,28 @@
+/*
+ * This header is for functions & variables that will ONLY be
+ * used inside libkvm for x86.
+ * THESE ARE NOT EXPOSED TO THE USER AND ARE ONLY FOR USE
+ * WITHIN LIBKVM.
+ *
+ * derived from libkvm.c
+ *
+ * Copyright (C) 2006 Qumranet, Inc.
+ *
+ * Authors:
+ * Avi Kivity <avi@qumranet.com>
+ * Yaniv Kamay <yaniv@qumranet.com>
+ *
+ * This work is licensed under the GNU LGPL license, version 2.
+ */
+
+#ifndef KVM_IA64_H
+#define KVM_IA64_H
+
+#include "kvm-common.h"
+
+extern int kvm_page_size;
+
+#define PAGE_SIZE kvm_page_size
+#define PAGE_MASK (~(kvm_page_size - 1))
+
+#endif
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
index cfedaa4b..f24eaec4 100644
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -41,7 +41,12 @@
#include "kvm-x86.h"
#endif
+#if defined(__ia64__)
+#include "kvm-ia64.h"
+#endif
+
int kvm_abi = EXPECTED_KVM_API_VERSION;
+int kvm_page_size;
struct slot_info {
unsigned long phys_addr;
@@ -230,6 +235,7 @@ kvm_context_t kvm_init(struct kvm_callbacks *callbacks,
goto out_close;
}
kvm_abi = r;
+ kvm_page_size = getpagesize();
kvm = malloc(sizeof(*kvm));
kvm->fd = fd;
kvm->vm_fd = -1;