[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] libxc header fixups.



# HG changeset patch
# User Emmanuel Ackaouy <ack@xxxxxxxxxxxxx>
# Date 1169763412 0
# Node ID 50d9e2ddc377a746eb094578b264bba67045cbce
# Parent  985384fd424cd3192c14399d6df31a648b8eebb2
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@xxxxxxx>
---
 tools/libxc/xg_private.h |  134 +++++++++++++++++++++++++++--------------------
 1 files changed, 77 insertions(+), 57 deletions(-)

diff -r 985384fd424c -r 50d9e2ddc377 tools/libxc/xg_private.h
--- a/tools/libxc/xg_private.h  Thu Jan 25 22:16:52 2007 +0000
+++ b/tools/libxc/xg_private.h  Thu Jan 25 22:16:52 2007 +0000
@@ -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
-
-#if defined(__i386__)
-#define L1_PAGETABLE_ENTRIES   1024
-#define L2_PAGETABLE_ENTRIES   1024
-#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_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_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_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,12 +88,22 @@ typedef uint64_t l1_pgentry_64_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;
-#endif
+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))
@@ -98,26 +112,32 @@ 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))
-
-#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)
-#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))
-#endif
+#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) l1_table_offset_i386(_a)
+#define l2_table_offset(_a) l2_table_offset_i386(_a)
+#elif defined(__x86_64__)
+#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
 {

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.