aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xg_private.h
diff options
context:
space:
mode:
authorEmmanuel Ackaouy <ack@xensource.com>2007-01-25 22:16:52 +0000
committerEmmanuel Ackaouy <ack@xensource.com>2007-01-25 22:16:52 +0000
commita62512128bdc7632982ddc0b3285703e5ab66c98 (patch)
tree10c04492bdb81e4ffbbc5b348fca52b1295228d0 /tools/libxc/xg_private.h
parent8db57dddd13e4298f78635ed9936496136244537 (diff)
downloadxen-a62512128bdc7632982ddc0b3285703e5ab66c98.tar.gz
xen-a62512128bdc7632982ddc0b3285703e5ab66c98.tar.bz2
xen-a62512128bdc7632982ddc0b3285703e5ab66c98.zip
libxc header fixups.
Make some arch-specific #defines for page table handling available unconditionally, add a suffix to avoid name clashes. The versions without suffix are defined depending on the architecture like they used to, so code using them continues to work. Signed-off-by: Gerd Hoffmann <kraxel@suse.de> --- tools/libxc/xg_private.h | 114 +++++++++++++++++++++++++++-------------------- 1 file changed, 67 insertions(+), 47 deletions(-)
Diffstat (limited to 'tools/libxc/xg_private.h')
-rw-r--r--tools/libxc/xg_private.h118
1 files changed, 69 insertions, 49 deletions
diff --git a/tools/libxc/xg_private.h b/tools/libxc/xg_private.h
index 4b0f5c9124..231126aab2 100644
--- a/tools/libxc/xg_private.h
+++ b/tools/libxc/xg_private.h
@@ -46,37 +46,41 @@ unsigned long csum_page (void * page);
#define _PAGE_PSE 0x080
#define _PAGE_GLOBAL 0x100
-#define L1_PAGETABLE_SHIFT_PAE 12
-#define L2_PAGETABLE_SHIFT_PAE 21
-#define L3_PAGETABLE_SHIFT_PAE 30
-
-#define L2_PAGETABLE_SHIFT_I386 22
-
-#if defined(__i386__)
-#define L1_PAGETABLE_SHIFT 12
-#define L2_PAGETABLE_SHIFT 22
-#elif defined(__x86_64__)
-#define L1_PAGETABLE_SHIFT 12
-#define L2_PAGETABLE_SHIFT 21
-#define L3_PAGETABLE_SHIFT 30
-#define L4_PAGETABLE_SHIFT 39
-#endif
-
-#define L1_PAGETABLE_ENTRIES_PAE 512
-#define L2_PAGETABLE_ENTRIES_PAE 512
-#define L3_PAGETABLE_ENTRIES_PAE 4
-
-#define L1_PAGETABLE_ENTRIES_I386 1024
-#define L2_PAGETABLE_ENTRIES_I386 1024
+#define L1_PAGETABLE_SHIFT_I386 12
+#define L2_PAGETABLE_SHIFT_I386 22
+#define L1_PAGETABLE_ENTRIES_I386 1024
+#define L2_PAGETABLE_ENTRIES_I386 1024
+
+#define L1_PAGETABLE_SHIFT_PAE 12
+#define L2_PAGETABLE_SHIFT_PAE 21
+#define L3_PAGETABLE_SHIFT_PAE 30
+#define L1_PAGETABLE_ENTRIES_PAE 512
+#define L2_PAGETABLE_ENTRIES_PAE 512
+#define L3_PAGETABLE_ENTRIES_PAE 4
+
+#define L1_PAGETABLE_SHIFT_X86_64 12
+#define L2_PAGETABLE_SHIFT_X86_64 21
+#define L3_PAGETABLE_SHIFT_X86_64 30
+#define L4_PAGETABLE_SHIFT_X86_64 39
+#define L1_PAGETABLE_ENTRIES_X86_64 512
+#define L2_PAGETABLE_ENTRIES_X86_64 512
+#define L3_PAGETABLE_ENTRIES_X86_64 512
+#define L4_PAGETABLE_ENTRIES_X86_64 512
#if defined(__i386__)
-#define L1_PAGETABLE_ENTRIES 1024
-#define L2_PAGETABLE_ENTRIES 1024
+#define L1_PAGETABLE_SHIFT L1_PAGETABLE_SHIFT_I386
+#define L2_PAGETABLE_SHIFT L2_PAGETABLE_SHIFT_I386
+#define L1_PAGETABLE_ENTRIES L1_PAGETABLE_ENTRIES_I386
+#define L2_PAGETABLE_ENTRIES L2_PAGETABLE_ENTRIES_I386
#elif defined(__x86_64__)
-#define L1_PAGETABLE_ENTRIES 512
-#define L2_PAGETABLE_ENTRIES 512
-#define L3_PAGETABLE_ENTRIES 512
-#define L4_PAGETABLE_ENTRIES 512
+#define L1_PAGETABLE_SHIFT L1_PAGETABLE_SHIFT_X86_64
+#define L2_PAGETABLE_SHIFT L2_PAGETABLE_SHIFT_X86_64
+#define L3_PAGETABLE_SHIFT L3_PAGETABLE_SHIFT_X86_64
+#define L4_PAGETABLE_SHIFT L4_PAGETABLE_SHIFT_X86_64
+#define L1_PAGETABLE_ENTRIES L1_PAGETABLE_ENTRIES_X86_64
+#define L2_PAGETABLE_ENTRIES L2_PAGETABLE_ENTRIES_X86_64
+#define L3_PAGETABLE_ENTRIES L3_PAGETABLE_ENTRIES_X86_64
+#define L4_PAGETABLE_ENTRIES L4_PAGETABLE_ENTRIES_X86_64
#endif
typedef uint32_t l1_pgentry_32_t;
@@ -84,13 +88,23 @@ typedef uint32_t l2_pgentry_32_t;
typedef uint64_t l1_pgentry_64_t;
typedef uint64_t l2_pgentry_64_t;
typedef uint64_t l3_pgentry_64_t;
-typedef unsigned long l1_pgentry_t;
-typedef unsigned long l2_pgentry_t;
-#if defined(__x86_64__)
-typedef unsigned long l3_pgentry_t;
-typedef unsigned long l4_pgentry_t;
+typedef uint64_t l4_pgentry_64_t;
+
+#if defined(__i386__)
+typedef l1_pgentry_32_t l1_pgentry_t;
+typedef l2_pgentry_32_t l2_pgentry_t;
+#elif defined(__x86_64__)
+typedef l1_pgentry_64_t l1_pgentry_t;
+typedef l2_pgentry_64_t l2_pgentry_t;
+typedef l3_pgentry_64_t l3_pgentry_t;
+typedef l4_pgentry_64_t l4_pgentry_t;
#endif
+#define l1_table_offset_i386(_a) \
+ (((_a) >> L1_PAGETABLE_SHIFT_I386) & (L1_PAGETABLE_ENTRIES_I386 - 1))
+#define l2_table_offset_i386(_a) \
+ (((_a) >> L2_PAGETABLE_SHIFT_I386) & (L2_PAGETABLE_ENTRIES_I386 - 1))
+
#define l1_table_offset_pae(_a) \
(((_a) >> L1_PAGETABLE_SHIFT_PAE) & (L1_PAGETABLE_ENTRIES_PAE - 1))
#define l2_table_offset_pae(_a) \
@@ -98,27 +112,33 @@ typedef unsigned long l4_pgentry_t;
#define l3_table_offset_pae(_a) \
(((_a) >> L3_PAGETABLE_SHIFT_PAE) & (L3_PAGETABLE_ENTRIES_PAE - 1))
-#define l1_table_offset_i386(_a) \
- (((_a) >> L1_PAGETABLE_SHIFT) & (L1_PAGETABLE_ENTRIES_I386 - 1))
-#define l2_table_offset_i386(_a) \
- (((_a) >> L2_PAGETABLE_SHIFT_I386) & (L2_PAGETABLE_ENTRIES_I386 - 1))
+#define l1_table_offset_x86_64(_a) \
+ (((_a) >> L1_PAGETABLE_SHIFT_X86_64) & (L1_PAGETABLE_ENTRIES_X86_64 - 1))
+#define l2_table_offset_x86_64(_a) \
+ (((_a) >> L2_PAGETABLE_SHIFT_X86_64) & (L2_PAGETABLE_ENTRIES_X86_64 - 1))
+#define l3_table_offset_x86_64(_a) \
+ (((_a) >> L3_PAGETABLE_SHIFT_X86_64) & (L3_PAGETABLE_ENTRIES_X86_64 - 1))
+#define l4_table_offset_x86_64(_a) \
+ (((_a) >> L4_PAGETABLE_SHIFT_X86_64) & (L4_PAGETABLE_ENTRIES_X86_64 - 1))
#if defined(__i386__)
-#define l1_table_offset(_a) \
- (((_a) >> L1_PAGETABLE_SHIFT) & (L1_PAGETABLE_ENTRIES - 1))
-#define l2_table_offset(_a) \
- ((_a) >> L2_PAGETABLE_SHIFT)
+#define l1_table_offset(_a) l1_table_offset_i386(_a)
+#define l2_table_offset(_a) l2_table_offset_i386(_a)
#elif defined(__x86_64__)
-#define l1_table_offset(_a) \
- (((_a) >> L1_PAGETABLE_SHIFT) & (L1_PAGETABLE_ENTRIES - 1))
-#define l2_table_offset(_a) \
- (((_a) >> L2_PAGETABLE_SHIFT) & (L2_PAGETABLE_ENTRIES - 1))
-#define l3_table_offset(_a) \
- (((_a) >> L3_PAGETABLE_SHIFT) & (L3_PAGETABLE_ENTRIES - 1))
-#define l4_table_offset(_a) \
- (((_a) >> L4_PAGETABLE_SHIFT) & (L4_PAGETABLE_ENTRIES - 1))
+#define l1_table_offset(_a) l1_table_offset_x86_64(_a)
+#define l2_table_offset(_a) l2_table_offset_x86_64(_a)
+#define l3_table_offset(_a) l3_table_offset_x86_64(_a)
+#define l4_table_offset(_a) l4_table_offset_x86_64(_a)
#endif
+#define PAGE_SHIFT_X86 12
+#define PAGE_SIZE_X86 (1UL << PAGE_SHIFT_X86)
+#define PAGE_MASK_X86 (~(PAGE_SIZE_X86-1))
+
+#define PAGE_SHIFT_IA64 14
+#define PAGE_SIZE_IA64 (1UL << PAGE_SHIFT_IA64)
+#define PAGE_MASK_IA64 (~(PAGE_SIZE_IA64-1))
+
struct domain_setup_info
{
uint64_t v_start;