From: kraxel@suse.de
To: xen-devel@lists.xensource.com
Subject: [patch] libxc header fixups.
Date: Fri, 20 Oct 2006 10:40:35 +0200 [thread overview]
Message-ID: <20061020084027.673148000@suse.de> (raw)
[-- Attachment #1: tools-domain-builder-header-libxc.diff --]
[-- Type: text/plain, Size: 6359 bytes --]
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(-)
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;
--
reply other threads:[~2006-10-20 8:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061020084027.673148000@suse.de \
--to=kraxel@suse.de \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.