aboutsummaryrefslogtreecommitdiffstats
path: root/tools/internal/mem_defs.h
diff options
context:
space:
mode:
authortlh20@elite.cl.cam.ac.uk <tlh20@elite.cl.cam.ac.uk>2003-05-06 09:36:15 +0000
committertlh20@elite.cl.cam.ac.uk <tlh20@elite.cl.cam.ac.uk>2003-05-06 09:36:15 +0000
commitfd347f1b55d1a77969f2624f0063152568dabab0 (patch)
treee90591937b99940e1237421f9a6e047d5dbca521 /tools/internal/mem_defs.h
parent5379a4b2d0213f3a323dc6c0340845b6353cd273 (diff)
downloadxen-fd347f1b55d1a77969f2624f0063152568dabab0.tar.gz
xen-fd347f1b55d1a77969f2624f0063152568dabab0.tar.bz2
xen-fd347f1b55d1a77969f2624f0063152568dabab0.zip
bitkeeper revision 1.206 (3eb7820fjxOimwW6NMSeo6KyAdqZUQ)
Many files: new file domctl, xi_ tools, updated domain builder, /proc/xeno/domains
Diffstat (limited to 'tools/internal/mem_defs.h')
-rw-r--r--tools/internal/mem_defs.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/tools/internal/mem_defs.h b/tools/internal/mem_defs.h
new file mode 100644
index 0000000000..a9a1441d61
--- /dev/null
+++ b/tools/internal/mem_defs.h
@@ -0,0 +1,45 @@
+/*
+ * memory related definitions needed for userspace domain builder dom0 application. these _need_ to
+ * be kept in sync with the kernel .h files they were copied over from or something horrible will
+ * happen. remmember: god kills a kitten every time you forget to keep these in sync.
+ *
+ * KAF: Boris, these constants are all fixed by x86 hardware. So the kittens are safe for now :-)
+ *
+ * Copyright 2002 by B Dragovic
+ */
+
+/* copied over from hypervisor: include/asm-i386/page.h */
+
+#define _PAGE_PRESENT 0x001
+#define _PAGE_RW 0x002
+#define _PAGE_USER 0x004
+#define _PAGE_PWT 0x008
+#define _PAGE_PCD 0x010
+#define _PAGE_ACCESSED 0x020
+#define _PAGE_DIRTY 0x040
+#define _PAGE_PAT 0x080
+#define _PAGE_PSE 0x080
+#define _PAGE_GLOBAL 0x100
+
+
+#define L1_PAGETABLE_SHIFT 12
+#define L2_PAGETABLE_SHIFT 22
+
+#define ENTRIES_PER_L1_PAGETABLE 1024
+#define ENTRIES_PER_L2_PAGETABLE 1024
+
+#define PAGE_SHIFT L1_PAGETABLE_SHIFT
+#define PAGE_SIZE (1UL << PAGE_SHIFT)
+#define PAGE_MASK (~(PAGE_SIZE-1))
+
+typedef struct { unsigned long l1_lo; } l1_pgentry_t;
+typedef struct { unsigned long l2_lo; } l2_pgentry_t;
+
+#define l1_table_offset(_a) \
+ (((_a) >> L1_PAGETABLE_SHIFT) & (ENTRIES_PER_L1_PAGETABLE - 1))
+#define l2_table_offset(_a) \
+ ((_a) >> L2_PAGETABLE_SHIFT)
+
+/* local definitions */
+
+#define nr_2_page(x) (x << PAGE_SHIFT)