ia64/xen-unstable

changeset 13638:50d9e2ddc377

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(-)
author Emmanuel Ackaouy <ack@xensource.com>
date Thu Jan 25 22:16:52 2007 +0000 (2007-01-25)
parents 985384fd424c
children fd50500eee7c
files tools/libxc/xg_private.h
line diff
     1.1 --- a/tools/libxc/xg_private.h	Thu Jan 25 22:16:52 2007 +0000
     1.2 +++ b/tools/libxc/xg_private.h	Thu Jan 25 22:16:52 2007 +0000
     1.3 @@ -46,37 +46,41 @@ unsigned long csum_page (void * page);
     1.4  #define _PAGE_PSE       0x080
     1.5  #define _PAGE_GLOBAL    0x100
     1.6  
     1.7 -#define L1_PAGETABLE_SHIFT_PAE   12
     1.8 -#define L2_PAGETABLE_SHIFT_PAE   21
     1.9 -#define L3_PAGETABLE_SHIFT_PAE   30
    1.10 +#define L1_PAGETABLE_SHIFT_I386       12
    1.11 +#define L2_PAGETABLE_SHIFT_I386       22
    1.12 +#define L1_PAGETABLE_ENTRIES_I386   1024
    1.13 +#define L2_PAGETABLE_ENTRIES_I386   1024
    1.14  
    1.15 -#define L2_PAGETABLE_SHIFT_I386  22
    1.16 +#define L1_PAGETABLE_SHIFT_PAE        12
    1.17 +#define L2_PAGETABLE_SHIFT_PAE        21
    1.18 +#define L3_PAGETABLE_SHIFT_PAE        30
    1.19 +#define L1_PAGETABLE_ENTRIES_PAE     512
    1.20 +#define L2_PAGETABLE_ENTRIES_PAE     512
    1.21 +#define L3_PAGETABLE_ENTRIES_PAE       4
    1.22 +
    1.23 +#define L1_PAGETABLE_SHIFT_X86_64     12
    1.24 +#define L2_PAGETABLE_SHIFT_X86_64     21
    1.25 +#define L3_PAGETABLE_SHIFT_X86_64     30
    1.26 +#define L4_PAGETABLE_SHIFT_X86_64     39
    1.27 +#define L1_PAGETABLE_ENTRIES_X86_64  512
    1.28 +#define L2_PAGETABLE_ENTRIES_X86_64  512
    1.29 +#define L3_PAGETABLE_ENTRIES_X86_64  512
    1.30 +#define L4_PAGETABLE_ENTRIES_X86_64  512
    1.31  
    1.32  #if defined(__i386__)
    1.33 -#define L1_PAGETABLE_SHIFT       12
    1.34 -#define L2_PAGETABLE_SHIFT       22
    1.35 +#define L1_PAGETABLE_SHIFT     L1_PAGETABLE_SHIFT_I386
    1.36 +#define L2_PAGETABLE_SHIFT     L2_PAGETABLE_SHIFT_I386
    1.37 +#define L1_PAGETABLE_ENTRIES   L1_PAGETABLE_ENTRIES_I386
    1.38 +#define L2_PAGETABLE_ENTRIES   L2_PAGETABLE_ENTRIES_I386
    1.39  #elif defined(__x86_64__)
    1.40 -#define L1_PAGETABLE_SHIFT       12
    1.41 -#define L2_PAGETABLE_SHIFT       21
    1.42 -#define L3_PAGETABLE_SHIFT       30
    1.43 -#define L4_PAGETABLE_SHIFT       39
    1.44 -#endif
    1.45 -
    1.46 -#define L1_PAGETABLE_ENTRIES_PAE  512
    1.47 -#define L2_PAGETABLE_ENTRIES_PAE  512
    1.48 -#define L3_PAGETABLE_ENTRIES_PAE    4
    1.49 -
    1.50 -#define L1_PAGETABLE_ENTRIES_I386 1024
    1.51 -#define L2_PAGETABLE_ENTRIES_I386 1024
    1.52 -
    1.53 -#if defined(__i386__)
    1.54 -#define L1_PAGETABLE_ENTRIES   1024
    1.55 -#define L2_PAGETABLE_ENTRIES   1024
    1.56 -#elif defined(__x86_64__)
    1.57 -#define L1_PAGETABLE_ENTRIES    512
    1.58 -#define L2_PAGETABLE_ENTRIES    512
    1.59 -#define L3_PAGETABLE_ENTRIES    512
    1.60 -#define L4_PAGETABLE_ENTRIES    512
    1.61 +#define L1_PAGETABLE_SHIFT     L1_PAGETABLE_SHIFT_X86_64
    1.62 +#define L2_PAGETABLE_SHIFT     L2_PAGETABLE_SHIFT_X86_64
    1.63 +#define L3_PAGETABLE_SHIFT     L3_PAGETABLE_SHIFT_X86_64
    1.64 +#define L4_PAGETABLE_SHIFT     L4_PAGETABLE_SHIFT_X86_64
    1.65 +#define L1_PAGETABLE_ENTRIES   L1_PAGETABLE_ENTRIES_X86_64
    1.66 +#define L2_PAGETABLE_ENTRIES   L2_PAGETABLE_ENTRIES_X86_64
    1.67 +#define L3_PAGETABLE_ENTRIES   L3_PAGETABLE_ENTRIES_X86_64
    1.68 +#define L4_PAGETABLE_ENTRIES   L4_PAGETABLE_ENTRIES_X86_64
    1.69  #endif
    1.70  
    1.71  typedef uint32_t l1_pgentry_32_t;
    1.72 @@ -84,13 +88,23 @@ typedef uint32_t l2_pgentry_32_t;
    1.73  typedef uint64_t l1_pgentry_64_t;
    1.74  typedef uint64_t l2_pgentry_64_t;
    1.75  typedef uint64_t l3_pgentry_64_t;
    1.76 -typedef unsigned long l1_pgentry_t;
    1.77 -typedef unsigned long l2_pgentry_t;
    1.78 -#if defined(__x86_64__)
    1.79 -typedef unsigned long l3_pgentry_t;
    1.80 -typedef unsigned long l4_pgentry_t;
    1.81 +typedef uint64_t l4_pgentry_64_t;
    1.82 +
    1.83 +#if defined(__i386__)
    1.84 +typedef l1_pgentry_32_t l1_pgentry_t;
    1.85 +typedef l2_pgentry_32_t l2_pgentry_t;
    1.86 +#elif defined(__x86_64__)
    1.87 +typedef l1_pgentry_64_t l1_pgentry_t;
    1.88 +typedef l2_pgentry_64_t l2_pgentry_t;
    1.89 +typedef l3_pgentry_64_t l3_pgentry_t;
    1.90 +typedef l4_pgentry_64_t l4_pgentry_t;
    1.91  #endif
    1.92  
    1.93 +#define l1_table_offset_i386(_a) \
    1.94 +  (((_a) >> L1_PAGETABLE_SHIFT_I386) & (L1_PAGETABLE_ENTRIES_I386 - 1))
    1.95 +#define l2_table_offset_i386(_a) \
    1.96 +  (((_a) >> L2_PAGETABLE_SHIFT_I386) & (L2_PAGETABLE_ENTRIES_I386 - 1))
    1.97 +
    1.98  #define l1_table_offset_pae(_a) \
    1.99    (((_a) >> L1_PAGETABLE_SHIFT_PAE) & (L1_PAGETABLE_ENTRIES_PAE - 1))
   1.100  #define l2_table_offset_pae(_a) \
   1.101 @@ -98,27 +112,33 @@ typedef unsigned long l4_pgentry_t;
   1.102  #define l3_table_offset_pae(_a) \
   1.103    (((_a) >> L3_PAGETABLE_SHIFT_PAE) & (L3_PAGETABLE_ENTRIES_PAE - 1))
   1.104  
   1.105 -#define l1_table_offset_i386(_a) \
   1.106 -  (((_a) >> L1_PAGETABLE_SHIFT) & (L1_PAGETABLE_ENTRIES_I386 - 1))
   1.107 -#define l2_table_offset_i386(_a) \
   1.108 -  (((_a) >> L2_PAGETABLE_SHIFT_I386) & (L2_PAGETABLE_ENTRIES_I386 - 1))
   1.109 +#define l1_table_offset_x86_64(_a) \
   1.110 +  (((_a) >> L1_PAGETABLE_SHIFT_X86_64) & (L1_PAGETABLE_ENTRIES_X86_64 - 1))
   1.111 +#define l2_table_offset_x86_64(_a) \
   1.112 +  (((_a) >> L2_PAGETABLE_SHIFT_X86_64) & (L2_PAGETABLE_ENTRIES_X86_64 - 1))
   1.113 +#define l3_table_offset_x86_64(_a) \
   1.114 +  (((_a) >> L3_PAGETABLE_SHIFT_X86_64) & (L3_PAGETABLE_ENTRIES_X86_64 - 1))
   1.115 +#define l4_table_offset_x86_64(_a) \
   1.116 +  (((_a) >> L4_PAGETABLE_SHIFT_X86_64) & (L4_PAGETABLE_ENTRIES_X86_64 - 1))
   1.117  
   1.118  #if defined(__i386__)
   1.119 -#define l1_table_offset(_a) \
   1.120 -          (((_a) >> L1_PAGETABLE_SHIFT) & (L1_PAGETABLE_ENTRIES - 1))
   1.121 -#define l2_table_offset(_a) \
   1.122 -          ((_a) >> L2_PAGETABLE_SHIFT)
   1.123 +#define l1_table_offset(_a) l1_table_offset_i386(_a)
   1.124 +#define l2_table_offset(_a) l2_table_offset_i386(_a)
   1.125  #elif defined(__x86_64__)
   1.126 -#define l1_table_offset(_a) \
   1.127 -  (((_a) >> L1_PAGETABLE_SHIFT) & (L1_PAGETABLE_ENTRIES - 1))
   1.128 -#define l2_table_offset(_a) \
   1.129 -  (((_a) >> L2_PAGETABLE_SHIFT) & (L2_PAGETABLE_ENTRIES - 1))
   1.130 -#define l3_table_offset(_a) \
   1.131 -  (((_a) >> L3_PAGETABLE_SHIFT) & (L3_PAGETABLE_ENTRIES - 1))
   1.132 -#define l4_table_offset(_a) \
   1.133 -  (((_a) >> L4_PAGETABLE_SHIFT) & (L4_PAGETABLE_ENTRIES - 1))
   1.134 +#define l1_table_offset(_a) l1_table_offset_x86_64(_a)
   1.135 +#define l2_table_offset(_a) l2_table_offset_x86_64(_a)
   1.136 +#define l3_table_offset(_a) l3_table_offset_x86_64(_a)
   1.137 +#define l4_table_offset(_a) l4_table_offset_x86_64(_a)
   1.138  #endif
   1.139  
   1.140 +#define PAGE_SHIFT_X86          12
   1.141 +#define PAGE_SIZE_X86           (1UL << PAGE_SHIFT_X86)
   1.142 +#define PAGE_MASK_X86           (~(PAGE_SIZE_X86-1))
   1.143 +
   1.144 +#define PAGE_SHIFT_IA64         14
   1.145 +#define PAGE_SIZE_IA64          (1UL << PAGE_SHIFT_IA64)
   1.146 +#define PAGE_MASK_IA64          (~(PAGE_SIZE_IA64-1))
   1.147 +
   1.148  struct domain_setup_info
   1.149  {
   1.150      uint64_t v_start;