WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [patch 3/6] libxc header fixups.

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [patch 3/6] libxc header fixups.
From: Gerd Hoffmann <kraxel@xxxxxxx>
Date: Thu, 25 Jan 2007 17:19:19 +0100
Cc: ack@xxxxxxxxxxxxx
Delivery-date: Fri, 26 Jan 2007 01:54:21 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20070125161916.736076000@xxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: quilt/0.46-14
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 |  114 +++++++++++++++++++++++++++--------------------
 1 file changed, 67 insertions(+), 47 deletions(-)

Index: build-32-unstable-11822/tools/libxc/xg_private.h
===================================================================
--- build-32-unstable-11822.orig/tools/libxc/xg_private.h
+++ build-32-unstable-11822/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_SHIFT_I386       12
+#define L2_PAGETABLE_SHIFT_I386       22
+#define L1_PAGETABLE_ENTRIES_I386   1024
+#define L2_PAGETABLE_ENTRIES_I386   1024
 
-#define L1_PAGETABLE_ENTRIES_PAE  512
-#define L2_PAGETABLE_ENTRIES_PAE  512
-#define L3_PAGETABLE_ENTRIES_PAE    4
+#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_ENTRIES_I386 1024
-#define L2_PAGETABLE_ENTRIES_I386 1024
+#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;

-- 

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