]> xenbits.xensource.com Git - xtf.git/commitdiff
Basic memory management for PV guests, sufficient to obtain the console ring virtual...
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 20 Mar 2015 21:28:24 +0000 (22:28 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 28 Sep 2015 13:53:02 +0000 (14:53 +0100)
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
include/arch/x86/mm.h [new file with mode: 0644]
include/xen/arch-x86/xen-x86_32.h [new file with mode: 0644]
include/xen/arch-x86/xen-x86_64.h [new file with mode: 0644]
include/xen/arch-x86/xen.h

diff --git a/include/arch/x86/mm.h b/include/arch/x86/mm.h
new file mode 100644 (file)
index 0000000..f5a61d9
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef XTF_X86_MM_H
+#define XTF_X86_MM_H
+
+#include <stdint.h>
+
+#include <arch/x86/config.h>
+#include <arch/x86/page.h>
+
+#include <xen/xen.h>
+
+/*
+ * XTF memory layout.
+ *
+ * Wherever possible, identity layout for simplicity.
+ *
+ * PV guests: VIRT_OFFSET is 0 which causes all linked virtual addresses to be
+ * contiguous in the pagetables created by the domain builder.  Therefore,
+ * virt == pfn << PAGE_SHIFT for any pfn constructed by the domain builder.
+ */
+
+#if defined(CONFIG_ENV_pv)
+
+#define m2p ((unsigned long *)MACH2PHYS_VIRT_START)
+
+static inline void *mfn_to_virt(unsigned long mfn)
+{
+    return (void *)(m2p[mfn] << PAGE_SHIFT);
+}
+
+#undef m2p
+
+#endif /* CONFIG_ENV_pv */
+
+#endif /* XTF_X86_MM_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/include/xen/arch-x86/xen-x86_32.h b/include/xen/arch-x86/xen-x86_32.h
new file mode 100644 (file)
index 0000000..175b0a8
--- /dev/null
@@ -0,0 +1,16 @@
+#ifndef XEN_PUBLIC_ARCH_X86_XEN_X86_32_H
+#define XEN_PUBLIC_ARCH_X86_XEN_X86_32_H
+
+#define MACH2PHYS_VIRT_START 0xF5800000UL
+
+#endif /* XEN_PUBLIC_ARCH_X86_XEN_X86_32_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/include/xen/arch-x86/xen-x86_64.h b/include/xen/arch-x86/xen-x86_64.h
new file mode 100644 (file)
index 0000000..c8838b2
--- /dev/null
@@ -0,0 +1,16 @@
+#ifndef XEN_PUBLIC_ARCH_X86_XEN_X86_64_H
+#define XEN_PUBLIC_ARCH_X86_XEN_X86_64_H
+
+#define MACH2PHYS_VIRT_START 0xFFFF800000000000UL
+
+#endif /* XEN_PUBLIC_ARCH_X86_XEN_X86_64_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
index da19b16fe4698896fe2552125e0ffe20dacf74e8..b9e97f813f6e297f183b27aa8b0851ee474f4a11 100644 (file)
@@ -5,6 +5,14 @@
 #ifndef XEN_PUBLIC_ARCH_X86_XEN_H
 #define XEN_PUBLIC_ARCH_X86_XEN_H
 
+#if defined (__i386__)
+# include "xen-x86_32.h"
+#elif defined (__x86_64__)
+# include "xen-x86_64.h"
+#else
+# error Bad architecture
+#endif
+
 #ifndef __ASSEMBLY__
 typedef unsigned long xen_pfn_t;
 #endif