ia64/xen-unstable

changeset 17618:8bd776540ab3

i386: Remove non-PAE hypervisor build target.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu May 08 14:32:11 2008 +0100 (2008-05-08)
parents b0d7780794eb
children c99a88623eda
files Config.mk Makefile buildconfigs/mk.linux-2.6-common buildconfigs/mk.linux-2.6.5-SLES-xen buildconfigs/mk.linux-2.6.9-RHEL-xen extras/mini-os/Config.mk extras/mini-os/arch/x86/arch.mk extras/mini-os/arch/x86/mm.c extras/mini-os/arch/x86/setup.c extras/mini-os/arch/x86/traps.c extras/mini-os/arch/x86/x86_32.S extras/mini-os/include/types.h extras/mini-os/include/x86/arch_limits.h extras/mini-os/include/x86/arch_mm.h extras/mini-os/include/x86/x86_32/hypercall-x86_32.h xen/arch/x86/Rules.mk xen/arch/x86/boot/head.S xen/arch/x86/boot/trampoline.S xen/arch/x86/boot/wakeup.S xen/arch/x86/boot/x86_32.S xen/arch/x86/domain_build.c xen/arch/x86/hvm/vmx/vmcs.c xen/arch/x86/hvm/vmx/vmx.c xen/arch/x86/mm.c xen/arch/x86/mm/hap/hap.c xen/arch/x86/mm/p2m.c xen/arch/x86/mm/shadow/Makefile xen/arch/x86/mm/shadow/common.c xen/arch/x86/mm/shadow/multi.c xen/arch/x86/mm/shadow/private.h xen/arch/x86/setup.c xen/arch/x86/traps.c xen/arch/x86/x86_32/mm.c xen/arch/x86/x86_32/traps.c xen/include/asm-x86/config.h xen/include/asm-x86/domain.h xen/include/asm-x86/fixmap.h xen/include/asm-x86/mm.h xen/include/asm-x86/page.h xen/include/asm-x86/types.h xen/include/asm-x86/x86_32/page-2level.h xen/include/asm-x86/x86_32/page-3level.h xen/include/asm-x86/x86_32/page.h xen/include/public/arch-x86/xen-x86_32.h
line diff
     1.1 --- a/Config.mk	Thu May 08 13:40:40 2008 +0100
     1.2 +++ b/Config.mk	Thu May 08 14:32:11 2008 +0100
     1.3 @@ -8,10 +8,6 @@ XEN_COMPILE_ARCH    ?= $(shell uname -m 
     1.4  XEN_TARGET_ARCH     ?= $(XEN_COMPILE_ARCH)
     1.5  XEN_OS              ?= $(shell uname -s)
     1.6  
     1.7 -ifeq ($(XEN_TARGET_ARCH),x86_32)
     1.8 -XEN_TARGET_X86_PAE  ?= y
     1.9 -endif
    1.10 -
    1.11  CONFIG_$(XEN_OS) := y
    1.12  
    1.13  SHELL     ?= /bin/sh
     2.1 --- a/Makefile	Thu May 08 13:40:40 2008 +0100
     2.2 +++ b/Makefile	Thu May 08 14:32:11 2008 +0100
     2.3 @@ -13,10 +13,6 @@ SUBARCH := $(subst x86_32,i386,$(XEN_TAR
     2.4  export XEN_TARGET_ARCH SUBARCH XEN_SYSTYPE
     2.5  include buildconfigs/Rules.mk
     2.6  
     2.7 -ifeq ($(XEN_TARGET_X86_PAE),y)
     2.8 -export pae=y
     2.9 -endif
    2.10 -
    2.11  # build and install everything into the standard system directories
    2.12  .PHONY: install
    2.13  install: install-xen install-kernels install-tools install-docs
     3.1 --- a/buildconfigs/mk.linux-2.6-common	Thu May 08 13:40:40 2008 +0100
     3.2 +++ b/buildconfigs/mk.linux-2.6-common	Thu May 08 14:32:11 2008 +0100
     3.3 @@ -91,11 +91,7 @@ ifneq ($(XEN_LINUX_CONFIG_UPDATE),)
     3.4  	sh $(XEN_LINUX_CONFIG_UPDATE) $(CONFIG_FILE)
     3.5  endif
     3.6  ifeq ($(XEN_TARGET_ARCH),x86_32)
     3.7 -ifeq ($(pae),y)
     3.8  	sed -e 's!^CONFIG_HIGHMEM4G=y$$!\# CONFIG_HIGHMEM4G is not set!;s!^\# CONFIG_HIGHMEM64G is not set$$!CONFIG_HIGHMEM64G=y!' $(CONFIG_FILE) > $(CONFIG_FILE)- && mv $(CONFIG_FILE)- $(CONFIG_FILE)
     3.9 -else
    3.10 -	grep '^CONFIG_HIGHMEM64G=y' $(CONFIG_FILE) >/dev/null && ( sed -e 's!^CONFIG_HIGHMEM64G=y$$!\# CONFIG_HIGHMEM64G is not set!;s!^\# CONFIG_HIGHMEM4G is not set$$!CONFIG_HIGHMEM4G=y!' $(CONFIG_FILE) > $(CONFIG_FILE)- && mv $(CONFIG_FILE)- $(CONFIG_FILE) ) || true
    3.11 -endif
    3.12  endif
    3.13  ifneq ($(EXTRAVERSION),)
    3.14  	echo "$(EXTRAVERSION)" >$(LINUX_DIR)/localversion-xen
     4.1 --- a/buildconfigs/mk.linux-2.6.5-SLES-xen	Thu May 08 13:40:40 2008 +0100
     4.2 +++ b/buildconfigs/mk.linux-2.6.5-SLES-xen	Thu May 08 14:32:11 2008 +0100
     4.3 @@ -1,6 +1,4 @@
     4.4 -# This tree only supports PAE
     4.5  XEN_TARGET_ARCH = x86_32
     4.6 -XEN_TARGET_X86_PAE = y
     4.7  
     4.8  EXTRAVERSION = -xen
     4.9  LINUX_VER = 2.6.5-SLES
     5.1 --- a/buildconfigs/mk.linux-2.6.9-RHEL-xen	Thu May 08 13:40:40 2008 +0100
     5.2 +++ b/buildconfigs/mk.linux-2.6.9-RHEL-xen	Thu May 08 14:32:11 2008 +0100
     5.3 @@ -1,6 +1,4 @@
     5.4 -# This tree only supports PAE
     5.5  XEN_TARGET_ARCH = x86_32
     5.6 -XEN_TARGET_X86_PAE = y
     5.7  
     5.8  EXTRAVERSION = -xen
     5.9  LINUX_VER = 2.6.9-RHEL
     6.1 --- a/extras/mini-os/Config.mk	Thu May 08 13:40:40 2008 +0100
     6.2 +++ b/extras/mini-os/Config.mk	Thu May 08 14:32:11 2008 +0100
     6.3 @@ -2,9 +2,6 @@
     6.4  MINI-OS_ROOT=$(XEN_ROOT)/extras/mini-os
     6.5  export MINI-OS_ROOT
     6.6  
     6.7 -ifeq ($(XEN_TARGET_ARCH),x86_32)
     6.8 -export pae ?= y
     6.9 -endif
    6.10  libc = $(stubdom)
    6.11  
    6.12  XEN_INTERFACE_VERSION := 0x00030205
    6.13 @@ -25,7 +22,6 @@ TARGET_ARCH_DIR := arch/$(TARGET_ARCH_FA
    6.14  # Export these variables for possible use in architecture dependent makefiles.
    6.15  export TARGET_ARCH_DIR
    6.16  export TARGET_ARCH_FAM
    6.17 -export XEN_TARGET_X86_PAE 
    6.18  
    6.19  # This is used for architecture specific links.
    6.20  # This can be overwritten from arch specific rules.
    6.21 @@ -70,7 +66,3 @@ endif
    6.22  ifneq ($(CAMLDIR),)
    6.23  caml=y
    6.24  endif
    6.25 -
    6.26 -ifeq ($(pae),y)
    6.27 -DEF_CPPFLAGS += -DCONFIG_X86_PAE
    6.28 -endif
     7.1 --- a/extras/mini-os/arch/x86/arch.mk	Thu May 08 13:40:40 2008 +0100
     7.2 +++ b/extras/mini-os/arch/x86/arch.mk	Thu May 08 14:32:11 2008 +0100
     7.3 @@ -9,11 +9,6 @@ ARCH_LDFLAGS := -m elf_i386
     7.4  ARCH_ASFLAGS := -m32
     7.5  EXTRA_INC += $(TARGET_ARCH_FAM)/$(XEN_TARGET_ARCH)
     7.6  EXTRA_SRC += arch/$(EXTRA_INC)
     7.7 -
     7.8 -ifeq ($(XEN_TARGET_X86_PAE),y)
     7.9 -ARCH_CFLAGS  += -DCONFIG_X86_PAE=1
    7.10 -ARCH_ASFLAGS += -DCONFIG_X86_PAE=1
    7.11 -endif
    7.12  endif
    7.13  
    7.14  ifeq ($(XEN_TARGET_ARCH),x86_64)
     8.1 --- a/extras/mini-os/arch/x86/mm.c	Thu May 08 13:40:40 2008 +0100
     8.2 +++ b/extras/mini-os/arch/x86/mm.c	Thu May 08 14:32:11 2008 +0100
     8.3 @@ -79,13 +79,11 @@ void new_pt_frame(unsigned long *pt_pfn,
     8.4           prot_t = L2_PROT;
     8.5           pincmd = MMUEXT_PIN_L1_TABLE;
     8.6           break;
     8.7 -#if defined(__x86_64__) || defined(CONFIG_X86_PAE)
     8.8      case L2_FRAME:
     8.9           prot_e = L2_PROT;
    8.10           prot_t = L3_PROT;
    8.11           pincmd = MMUEXT_PIN_L2_TABLE;
    8.12           break;
    8.13 -#endif
    8.14  #if defined(__x86_64__)
    8.15      case L3_FRAME:
    8.16           prot_e = L3_PROT;
    8.17 @@ -102,11 +100,8 @@ void new_pt_frame(unsigned long *pt_pfn,
    8.18      /* Update the entry */
    8.19  #if defined(__x86_64__)
    8.20      tab = pte_to_virt(tab[l4_table_offset(pt_page)]);
    8.21 -    tab = pte_to_virt(tab[l3_table_offset(pt_page)]);
    8.22  #endif
    8.23 -#if defined(CONFIG_X86_PAE)
    8.24      tab = pte_to_virt(tab[l3_table_offset(pt_page)]);
    8.25 -#endif
    8.26  
    8.27      mmu_updates[0].ptr = ((pgentry_t)tab[l2_table_offset(pt_page)] & PAGE_MASK) + 
    8.28                           sizeof(pgentry_t) * l1_table_offset(pt_page);
    8.29 @@ -164,7 +159,6 @@ static int need_pt_frame(unsigned long v
    8.30      } else
    8.31  #endif
    8.32  
    8.33 -#if defined(__x86_64__) || defined(CONFIG_X86_PAE)
    8.34      if(level == L2_FRAME)
    8.35      {
    8.36  #if defined(__x86_64__)
    8.37 @@ -181,7 +175,6 @@ static int need_pt_frame(unsigned long v
    8.38  
    8.39          return 1;
    8.40      } else 
    8.41 -#endif /* defined(__x86_64__) || defined(CONFIG_X86_PAE) */
    8.42  
    8.43      /* Always need l1 frames */
    8.44      if(level == L1_FRAME)
    8.45 @@ -236,7 +229,6 @@ void build_pagetable(unsigned long *star
    8.46          mfn = pte_to_mfn(page);
    8.47          tab = to_virt(mfn_to_pfn(mfn) << PAGE_SHIFT);
    8.48  #endif
    8.49 -#if defined(__x86_64__) || defined(CONFIG_X86_PAE)
    8.50          offset = l3_table_offset(start_address);
    8.51          /* Need new L2 pt frame */
    8.52          if(!(start_address & L2_MASK))
    8.53 @@ -246,7 +238,6 @@ void build_pagetable(unsigned long *star
    8.54          page = tab[offset];
    8.55          mfn = pte_to_mfn(page);
    8.56          tab = to_virt(mfn_to_pfn(mfn) << PAGE_SHIFT);
    8.57 -#endif
    8.58          offset = l2_table_offset(start_address);        
    8.59          /* Need new L1 pt frame */
    8.60          if(!(start_address & L1_MASK))
    8.61 @@ -298,12 +289,10 @@ static void set_readonly(void *text, voi
    8.62          mfn = pte_to_mfn(page);
    8.63          tab = to_virt(mfn_to_pfn(mfn) << PAGE_SHIFT);
    8.64  #endif
    8.65 -#if defined(__x86_64__) || defined(CONFIG_X86_PAE)
    8.66          offset = l3_table_offset(start_address);
    8.67          page = tab[offset];
    8.68          mfn = pte_to_mfn(page);
    8.69          tab = to_virt(mfn_to_pfn(mfn) << PAGE_SHIFT);
    8.70 -#endif
    8.71          offset = l2_table_offset(start_address);        
    8.72          page = tab[offset];
    8.73          mfn = pte_to_mfn(page);
    8.74 @@ -382,13 +371,11 @@ static pgentry_t *get_pgt(unsigned long 
    8.75      mfn = pte_to_mfn(tab[offset]);
    8.76      tab = mfn_to_virt(mfn);
    8.77  #endif
    8.78 -#if defined(__x86_64__) || defined(CONFIG_X86_PAE)
    8.79      offset = l3_table_offset(addr);
    8.80      if (!(tab[offset] & _PAGE_PRESENT))
    8.81          return NULL;
    8.82      mfn = pte_to_mfn(tab[offset]);
    8.83      tab = mfn_to_virt(mfn);
    8.84 -#endif
    8.85      offset = l2_table_offset(addr);
    8.86      if (!(tab[offset] & _PAGE_PRESENT))
    8.87          return NULL;
    8.88 @@ -418,7 +405,6 @@ static pgentry_t *need_pgt(unsigned long
    8.89      mfn = pte_to_mfn(tab[offset]);
    8.90      tab = mfn_to_virt(mfn);
    8.91  #endif
    8.92 -#if defined(__x86_64__) || defined(CONFIG_X86_PAE)
    8.93      offset = l3_table_offset(addr);
    8.94      if (!(tab[offset] & _PAGE_PRESENT)) {
    8.95          pt_pfn = virt_to_pfn(alloc_page());
    8.96 @@ -427,7 +413,6 @@ static pgentry_t *need_pgt(unsigned long
    8.97      ASSERT(tab[offset] & _PAGE_PRESENT);
    8.98      mfn = pte_to_mfn(tab[offset]);
    8.99      tab = mfn_to_virt(mfn);
   8.100 -#endif
   8.101      offset = l2_table_offset(addr);
   8.102      if (!(tab[offset] & _PAGE_PRESENT)) {
   8.103          pt_pfn = virt_to_pfn(alloc_page());
     9.1 --- a/extras/mini-os/arch/x86/setup.c	Thu May 08 13:40:40 2008 +0100
     9.2 +++ b/extras/mini-os/arch/x86/setup.c	Thu May 08 14:32:11 2008 +0100
     9.3 @@ -53,7 +53,7 @@ extern char shared_info[PAGE_SIZE];
     9.4  void hypervisor_callback(void);
     9.5  void failsafe_callback(void);
     9.6  
     9.7 -#if !defined(CONFIG_X86_PAE)
     9.8 +#if defined(__x86_64__)
     9.9  #define __pte(x) ((pte_t) { (x) } )
    9.10  #else
    9.11  #define __pte(x) ({ unsigned long long _x = (x);        \
    10.1 --- a/extras/mini-os/arch/x86/traps.c	Thu May 08 13:40:40 2008 +0100
    10.2 +++ b/extras/mini-os/arch/x86/traps.c	Thu May 08 14:32:11 2008 +0100
    10.3 @@ -104,11 +104,9 @@ void page_walk(unsigned long virt_addres
    10.4          tab = pte_to_virt(page);
    10.5          printk(" L4 = %"PRIpte" (%p)  [offset = %lx]\n", page, tab, l4_table_offset(addr));
    10.6  #endif
    10.7 -#if defined(__x86_64__) || defined(CONFIG_X86_PAE)
    10.8          page = tab[l3_table_offset(addr)];
    10.9          tab = pte_to_virt(page);
   10.10          printk("  L3 = %"PRIpte" (%p)  [offset = %lx]\n", page, tab, l3_table_offset(addr));
   10.11 -#endif
   10.12          page = tab[l2_table_offset(addr)];
   10.13          tab = pte_to_virt(page);
   10.14          printk("   L2 = %"PRIpte" (%p)  [offset = %lx]\n", page, tab, l2_table_offset(addr));
   10.15 @@ -129,12 +127,11 @@ static int handle_cow(unsigned long addr
   10.16  	    return 0;
   10.17          tab = pte_to_virt(page);
   10.18  #endif
   10.19 -#if defined(__x86_64__) || defined(CONFIG_X86_PAE)
   10.20          page = tab[l3_table_offset(addr)];
   10.21  	if (!(page & _PAGE_PRESENT))
   10.22  	    return 0;
   10.23          tab = pte_to_virt(page);
   10.24 -#endif
   10.25 +
   10.26          page = tab[l2_table_offset(addr)];
   10.27  	if (!(page & _PAGE_PRESENT))
   10.28  	    return 0;
    11.1 --- a/extras/mini-os/arch/x86/x86_32.S	Thu May 08 13:40:40 2008 +0100
    11.2 +++ b/extras/mini-os/arch/x86/x86_32.S	Thu May 08 14:32:11 2008 +0100
    11.3 @@ -8,11 +8,7 @@
    11.4  	.ascii	",VIRT_BASE=0x0" /* &_text from minios_x86_32.lds */
    11.5  	.ascii	",ELF_PADDR_OFFSET=0x0"
    11.6  	.ascii	",HYPERCALL_PAGE=0x2"
    11.7 -#ifdef CONFIG_X86_PAE
    11.8  	.ascii	",PAE=yes"
    11.9 -#else
   11.10 -	.ascii	",PAE=no"
   11.11 -#endif
   11.12  	.ascii	",LOADER=generic"
   11.13  	.byte	0
   11.14  .text
    12.1 --- a/extras/mini-os/include/types.h	Thu May 08 13:40:40 2008 +0100
    12.2 +++ b/extras/mini-os/include/types.h	Thu May 08 14:32:11 2008 +0100
    12.3 @@ -43,11 +43,7 @@ typedef unsigned long       u_long;
    12.4  typedef long long           quad_t;
    12.5  typedef unsigned long long  u_quad_t;
    12.6  
    12.7 -#if !defined(CONFIG_X86_PAE)
    12.8 -typedef struct { unsigned long pte_low; } pte_t;
    12.9 -#else
   12.10  typedef struct { unsigned long pte_low, pte_high; } pte_t;
   12.11 -#endif /* CONFIG_X86_PAE */
   12.12  
   12.13  #elif defined(__x86_64__) || defined(__ia64__)
   12.14  typedef long                quad_t;
   12.15 @@ -56,7 +52,7 @@ typedef unsigned long       u_quad_t;
   12.16  typedef struct { unsigned long pte; } pte_t;
   12.17  #endif /* __i386__ || __x86_64__ */
   12.18  
   12.19 -#if !defined(CONFIG_X86_PAE)
   12.20 +#ifdef __x86_64__
   12.21  #define __pte(x) ((pte_t) { (x) } )
   12.22  #else
   12.23  #define __pte(x) ({ unsigned long long _x = (x);        \
    13.1 --- a/extras/mini-os/include/x86/arch_limits.h	Thu May 08 13:40:40 2008 +0100
    13.2 +++ b/extras/mini-os/include/x86/arch_limits.h	Thu May 08 14:32:11 2008 +0100
    13.3 @@ -7,7 +7,7 @@
    13.4  #ifdef __ASSEMBLY__
    13.5  #define __PAGE_SIZE       (1 << __PAGE_SHIFT)
    13.6  #else
    13.7 -#ifndef CONFIG_X86_PAE
    13.8 +#ifdef __x86_64__
    13.9  #define __PAGE_SIZE       (1UL << __PAGE_SHIFT)
   13.10  #else
   13.11  #define __PAGE_SIZE       (1ULL << __PAGE_SHIFT)
    14.1 --- a/extras/mini-os/include/x86/arch_mm.h	Thu May 08 13:40:40 2008 +0100
    14.2 +++ b/extras/mini-os/include/x86/arch_mm.h	Thu May 08 14:32:11 2008 +0100
    14.3 @@ -44,24 +44,6 @@
    14.4  
    14.5  #if defined(__i386__)
    14.6  
    14.7 -#if !defined(CONFIG_X86_PAE)
    14.8 -
    14.9 -#define L2_PAGETABLE_SHIFT      22
   14.10 -
   14.11 -#define L1_PAGETABLE_ENTRIES    1024
   14.12 -#define L2_PAGETABLE_ENTRIES    1024
   14.13 -
   14.14 -#define PADDR_BITS              32
   14.15 -#define PADDR_MASK              (~0UL)
   14.16 -
   14.17 -#define NOT_L1_FRAMES           1
   14.18 -#define PRIpte "08lx"
   14.19 -#ifndef __ASSEMBLY__
   14.20 -typedef unsigned long pgentry_t;
   14.21 -#endif
   14.22 -
   14.23 -#else /* defined(CONFIG_X86_PAE) */
   14.24 -
   14.25  #define L2_PAGETABLE_SHIFT      21
   14.26  #define L3_PAGETABLE_SHIFT      30
   14.27  
   14.28 @@ -85,8 +67,6 @@ typedef unsigned long pgentry_t;
   14.29  typedef uint64_t pgentry_t;
   14.30  #endif
   14.31  
   14.32 -#endif /* !defined(CONFIG_X86_PAE) */
   14.33 -
   14.34  #elif defined(__x86_64__)
   14.35  
   14.36  #define L2_PAGETABLE_SHIFT      21
   14.37 @@ -122,10 +102,8 @@ typedef unsigned long pgentry_t;
   14.38    (((_a) >> L1_PAGETABLE_SHIFT) & (L1_PAGETABLE_ENTRIES - 1))
   14.39  #define l2_table_offset(_a) \
   14.40    (((_a) >> L2_PAGETABLE_SHIFT) & (L2_PAGETABLE_ENTRIES - 1))
   14.41 -#if defined(__x86_64__) || defined(CONFIG_X86_PAE)
   14.42  #define l3_table_offset(_a) \
   14.43    (((_a) >> L3_PAGETABLE_SHIFT) & (L3_PAGETABLE_ENTRIES - 1))
   14.44 -#endif
   14.45  #if defined(__x86_64__)
   14.46  #define l4_table_offset(_a) \
   14.47    (((_a) >> L4_PAGETABLE_SHIFT) & (L4_PAGETABLE_ENTRIES - 1))
   14.48 @@ -146,9 +124,7 @@ typedef unsigned long pgentry_t;
   14.49  #define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED)
   14.50  #define L1_PROT_RO (_PAGE_PRESENT|_PAGE_ACCESSED)
   14.51  #define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY |_PAGE_USER)
   14.52 -#if defined(CONFIG_X86_PAE)
   14.53  #define L3_PROT (_PAGE_PRESENT)
   14.54 -#endif /* CONFIG_X86_PAE */
   14.55  #elif defined(__x86_64__)
   14.56  #define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_USER)
   14.57  #define L1_PROT_RO (_PAGE_PRESENT|_PAGE_ACCESSED|_PAGE_USER)
   14.58 @@ -172,7 +148,7 @@ typedef unsigned long pgentry_t;
   14.59  
   14.60  #ifndef __ASSEMBLY__
   14.61  /* Definitions for machine and pseudophysical addresses. */
   14.62 -#ifdef CONFIG_X86_PAE
   14.63 +#ifdef __i386__
   14.64  typedef unsigned long long paddr_t;
   14.65  typedef unsigned long long maddr_t;
   14.66  #else
   14.67 @@ -225,14 +201,10 @@ static __inline__ paddr_t machine_to_phy
   14.68  #define virtual_to_l3(_virt)	   PT_BASE
   14.69  #endif
   14.70  
   14.71 -#if defined(__x86_64__) || defined(CONFIG_X86_PAE)
   14.72  #define virtual_to_l2(_virt)	   ({ \
   14.73  	unsigned long __virt2 = (_virt); \
   14.74  	(pgentry_t *) pte_to_virt(virtual_to_l3(__virt2)[l3_table_offset(__virt2)]); \
   14.75  })
   14.76 -#else
   14.77 -#define virtual_to_l2(_virt)	   PT_BASE
   14.78 -#endif
   14.79  
   14.80  #define virtual_to_l1(_virt)	   ({ \
   14.81  	unsigned long __virt1 = (_virt); \
    15.1 --- a/extras/mini-os/include/x86/x86_32/hypercall-x86_32.h	Thu May 08 13:40:40 2008 +0100
    15.2 +++ b/extras/mini-os/include/x86/x86_32/hypercall-x86_32.h	Thu May 08 14:32:11 2008 +0100
    15.3 @@ -220,12 +220,8 @@ static inline int
    15.4  HYPERVISOR_update_va_mapping(
    15.5  	unsigned long va, pte_t new_val, unsigned long flags)
    15.6  {
    15.7 -	unsigned long pte_hi = 0;
    15.8 -#ifdef CONFIG_X86_PAE
    15.9 -	pte_hi = new_val.pte_high;
   15.10 -#endif
   15.11  	return _hypercall4(int, update_va_mapping, va,
   15.12 -			   new_val.pte_low, pte_hi, flags);
   15.13 +			   new_val.pte_low, new_val.pte_high, flags);
   15.14  }
   15.15  
   15.16  static inline int
   15.17 @@ -267,12 +263,8 @@ static inline int
   15.18  HYPERVISOR_update_va_mapping_otherdomain(
   15.19  	unsigned long va, pte_t new_val, unsigned long flags, domid_t domid)
   15.20  {
   15.21 -	unsigned long pte_hi = 0;
   15.22 -#ifdef CONFIG_X86_PAE
   15.23 -	pte_hi = new_val.pte_high;
   15.24 -#endif
   15.25  	return _hypercall5(int, update_va_mapping_otherdomain, va,
   15.26 -			   new_val.pte_low, pte_hi, flags, domid);
   15.27 +			   new_val.pte_low, new_val.pte_high, flags, domid);
   15.28  }
   15.29  
   15.30  static inline int
    16.1 --- a/xen/arch/x86/Rules.mk	Thu May 08 13:40:40 2008 +0100
    16.2 +++ b/xen/arch/x86/Rules.mk	Thu May 08 14:32:11 2008 +0100
    16.3 @@ -9,7 +9,6 @@ xenoprof := y
    16.4  # If you change any of these configuration options then you must
    16.5  # 'make clean' before rebuilding.
    16.6  #
    16.7 -pae ?= n
    16.8  supervisor_mode_kernel ?= n
    16.9  
   16.10  # Solaris grabs stdarg.h and friends from the system include directory.
   16.11 @@ -31,10 +30,6 @@ CFLAGS += $(call cc-option,$(CC),-nopie,
   16.12  CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,)
   16.13  CFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,)
   16.14  
   16.15 -ifeq ($(TARGET_SUBARCH)$(pae),x86_32y)
   16.16 -CFLAGS += -DCONFIG_X86_PAE=1
   16.17 -endif
   16.18 -
   16.19  ifeq ($(supervisor_mode_kernel),y)
   16.20  CFLAGS += -DCONFIG_X86_SUPERVISOR_MODE_KERNEL=1
   16.21  endif
    17.1 --- a/xen/arch/x86/boot/head.S	Thu May 08 13:40:40 2008 +0100
    17.2 +++ b/xen/arch/x86/boot/head.S	Thu May 08 14:32:11 2008 +0100
    17.3 @@ -132,7 +132,7 @@ 1:      mov     %eax,(%edi)
    17.4          mov     %eax,sym_phys(idle_pg_table) + (262*8) /* PML4[262]: 1:1 map */
    17.5          mov     $(sym_phys(l3_xenmap)+7),%eax
    17.6          mov     %eax,sym_phys(idle_pg_table) + (261*8) /* PML4[261]: xen map */
    17.7 -#elif defined(CONFIG_X86_PAE)
    17.8 +#else
    17.9          /* Initialize low and high mappings of memory with 2MB pages */
   17.10          mov     $sym_phys(idle_pg_table_l2),%edi
   17.11          mov     $0xe3,%eax                   /* PRESENT+RW+A+D+2MB */
   17.12 @@ -147,19 +147,6 @@ 1:      stosl   /* low mappings cover up
   17.13          add     $(1<<L2_PAGETABLE_SHIFT),%eax
   17.14          cmp     $(16<<20)+0xe3,%eax
   17.15          jne     1b
   17.16 -#else
   17.17 -        /* Initialize low and high mappings of memory with 4MB pages */
   17.18 -        mov     $sym_phys(idle_pg_table),%edi
   17.19 -        mov     $0xe3,%eax                   /* PRESENT+RW+A+D+4MB */
   17.20 -1:      mov     %eax,__PAGE_OFFSET>>20(%edi) /* high mapping */
   17.21 -        stosl                                /* low mapping */
   17.22 -        add     $(1<<L2_PAGETABLE_SHIFT),%eax
   17.23 -        cmp     $DIRECTMAP_PHYS_END+0xe3,%eax
   17.24 -        jne     1b
   17.25 -1:      stosl   /* low mappings cover up to 16MB */
   17.26 -        add     $(1<<L2_PAGETABLE_SHIFT),%eax
   17.27 -        cmp     $(16<<20)+0xe3,%eax
   17.28 -        jne     1b
   17.29  #endif
   17.30  
   17.31          /* Initialize 4kB mappings of first 2MB or 4MB of memory. */
   17.32 @@ -170,9 +157,7 @@ 1:      stosl   /* low mappings cover up
   17.33  #endif
   17.34          xor     %ecx,%ecx
   17.35  1:      stosl
   17.36 -#if CONFIG_PAGING_LEVELS >= 3
   17.37          add     $4,%edi
   17.38 -#endif
   17.39          add     $PAGE_SIZE,%eax
   17.40          inc     %ecx
   17.41          /* VGA hole (0xa0000-0xc0000) should be mapped UC. */
   17.42 @@ -188,12 +173,9 @@ 2:      cmp     $L1_PAGETABLE_ENTRIES,%e
   17.43  #if defined(__x86_64__)
   17.44          mov     %edi,sym_phys(l2_identmap)
   17.45          mov     %edi,sym_phys(l2_xenmap)
   17.46 -#elif defined(CONFIG_X86_PAE)
   17.47 +#else
   17.48          mov     %edi,sym_phys(idle_pg_table_l2)
   17.49          mov     %edi,sym_phys(idle_pg_table_l2) + (__PAGE_OFFSET>>18)
   17.50 -#else
   17.51 -        mov     %edi,sym_phys(idle_pg_table)
   17.52 -        mov     %edi,sym_phys(idle_pg_table) + (__PAGE_OFFSET>>20)
   17.53  #endif
   17.54  
   17.55          /* Copy bootstrap trampoline to low memory, below 1MB. */
    18.1 --- a/xen/arch/x86/boot/trampoline.S	Thu May 08 13:40:40 2008 +0100
    18.2 +++ b/xen/arch/x86/boot/trampoline.S	Thu May 08 14:32:11 2008 +0100
    18.3 @@ -60,11 +60,7 @@ trampoline_protmode_entry:
    18.4          fninit
    18.5  
    18.6          /* Initialise CR4. */
    18.7 -#if CONFIG_PAGING_LEVELS == 2
    18.8 -        mov     $X86_CR4_PSE,%ecx
    18.9 -#else
   18.10          mov     $X86_CR4_PAE,%ecx
   18.11 -#endif
   18.12          mov     %ecx,%cr4
   18.13  
   18.14          /* Load pagetable base register. */
   18.15 @@ -72,7 +68,6 @@ trampoline_protmode_entry:
   18.16          add     bootsym_phys(trampoline_xen_phys_start),%eax
   18.17          mov     %eax,%cr3
   18.18  
   18.19 -#if CONFIG_PAGING_LEVELS != 2
   18.20          /* Set up EFER (Extended Feature Enable Register). */
   18.21          mov     bootsym_phys(cpuid_ext_features),%edi
   18.22          test    $0x20100800,%edi /* SYSCALL/SYSRET, No Execute, Long Mode? */
   18.23 @@ -88,7 +83,6 @@ trampoline_protmode_entry:
   18.24          btsl    $_EFER_NX,%eax  /* No Execute     */
   18.25  1:      wrmsr
   18.26  .Lskip_efer:
   18.27 -#endif
   18.28  
   18.29          mov     $0x80050033,%eax /* hi-to-lo: PG,AM,WP,NE,ET,MP,PE */
   18.30          mov     %eax,%cr0
    19.1 --- a/xen/arch/x86/boot/wakeup.S	Thu May 08 13:40:40 2008 +0100
    19.2 +++ b/xen/arch/x86/boot/wakeup.S	Thu May 08 14:32:11 2008 +0100
    19.3 @@ -126,11 +126,7 @@ wakeup_32:
    19.4          /* fpu init? */
    19.5  
    19.6          /* Initialise CR4. */
    19.7 -#if CONFIG_PAGING_LEVELS == 2
    19.8 -        mov     $X86_CR4_PSE, %ecx
    19.9 -#else
   19.10          mov     $X86_CR4_PAE, %ecx
   19.11 -#endif
   19.12          mov     %ecx, %cr4
   19.13  
   19.14          /* Load pagetable base register */
   19.15 @@ -139,7 +135,6 @@ wakeup_32:
   19.16          mov     %eax,%cr3
   19.17  
   19.18          /* Will cpuid feature change after resume? */
   19.19 -#if CONFIG_PAGING_LEVELS != 2
   19.20          /* Set up EFER (Extended Feature Enable Register). */
   19.21          mov     bootsym_phys(cpuid_ext_features),%edi
   19.22          test    $0x20100800,%edi /* SYSCALL/SYSRET, No Execute, Long Mode? */
   19.23 @@ -155,7 +150,6 @@ wakeup_32:
   19.24          btsl    $_EFER_NX,%eax  /* No Execute     */
   19.25  1:      wrmsr
   19.26  .Lskip_eferw:
   19.27 -#endif
   19.28  
   19.29          wbinvd
   19.30  
    20.1 --- a/xen/arch/x86/boot/x86_32.S	Thu May 08 13:40:40 2008 +0100
    20.2 +++ b/xen/arch/x86/boot/x86_32.S	Thu May 08 14:32:11 2008 +0100
    20.3 @@ -81,14 +81,12 @@ gdt_descr:
    20.4          .long   gdt_table - FIRST_RESERVED_GDT_BYTE
    20.5  
    20.6  
    20.7 -#ifdef CONFIG_X86_PAE
    20.8          .align 32
    20.9  ENTRY(idle_pg_table)
   20.10          .long sym_phys(idle_pg_table_l2) + 0*PAGE_SIZE + 0x01, 0
   20.11          .long sym_phys(idle_pg_table_l2) + 1*PAGE_SIZE + 0x01, 0
   20.12          .long sym_phys(idle_pg_table_l2) + 2*PAGE_SIZE + 0x01, 0
   20.13          .long sym_phys(idle_pg_table_l2) + 3*PAGE_SIZE + 0x01, 0
   20.14 -#endif
   20.15  
   20.16          .align PAGE_SIZE, 0
   20.17  /* NB. Rings != 0 get access up to MACH2PHYS_VIRT_END. This allows access to */
    21.1 --- a/xen/arch/x86/domain_build.c	Thu May 08 13:40:40 2008 +0100
    21.2 +++ b/xen/arch/x86/domain_build.c	Thu May 08 14:32:11 2008 +0100
    21.3 @@ -398,11 +398,7 @@ int __init construct_dom0(
    21.4          v_end            = (vstack_end + (1UL<<22)-1) & ~((1UL<<22)-1);
    21.5          if ( (v_end - vstack_end) < (512UL << 10) )
    21.6              v_end += 1UL << 22; /* Add extra 4MB to get >= 512kB padding. */
    21.7 -#if defined(__i386__) && !defined(CONFIG_X86_PAE)
    21.8 -        if ( (((v_end - v_start + ((1UL<<L2_PAGETABLE_SHIFT)-1)) >>
    21.9 -               L2_PAGETABLE_SHIFT) + 1) <= nr_pt_pages )
   21.10 -            break;
   21.11 -#elif defined(__i386__) && defined(CONFIG_X86_PAE)
   21.12 +#if defined(__i386__)
   21.13          /* 5 pages: 1x 3rd + 4x 2nd level */
   21.14          if ( (((v_end - v_start + ((1UL<<L2_PAGETABLE_SHIFT)-1)) >>
   21.15                 L2_PAGETABLE_SHIFT) + 5) <= nr_pt_pages )
    22.1 --- a/xen/arch/x86/hvm/vmx/vmcs.c	Thu May 08 13:40:40 2008 +0100
    22.2 +++ b/xen/arch/x86/hvm/vmx/vmcs.c	Thu May 08 14:32:11 2008 +0100
    22.3 @@ -630,7 +630,7 @@ static int construct_vmcs(struct vcpu *v
    22.4      if ( paging_mode_hap(d) )
    22.5      {
    22.6          __vmwrite(EPT_POINTER, d->arch.hvm_domain.vmx.ept_control.eptp);
    22.7 -#ifdef CONFIG_X86_PAE
    22.8 +#ifdef __i386__
    22.9          __vmwrite(EPT_POINTER_HIGH,
   22.10                    d->arch.hvm_domain.vmx.ept_control.eptp >> 32);
   22.11  #endif
    23.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Thu May 08 13:40:40 2008 +0100
    23.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Thu May 08 14:32:11 2008 +0100
    23.3 @@ -934,7 +934,7 @@ static void vmx_load_pdptrs(struct vcpu 
    23.4      __vmwrite(GUEST_PDPTR1, guest_pdptrs[1]);
    23.5      __vmwrite(GUEST_PDPTR2, guest_pdptrs[2]);
    23.6      __vmwrite(GUEST_PDPTR3, guest_pdptrs[3]);
    23.7 -#ifdef CONFIG_X86_PAE
    23.8 +#ifdef __i386__
    23.9      __vmwrite(GUEST_PDPTR0_HIGH, guest_pdptrs[0] >> 32);
   23.10      __vmwrite(GUEST_PDPTR1_HIGH, guest_pdptrs[1] >> 32);
   23.11      __vmwrite(GUEST_PDPTR2_HIGH, guest_pdptrs[2] >> 32);
   23.12 @@ -2253,7 +2253,7 @@ asmlinkage void vmx_vmexit_handler(struc
   23.13      case EXIT_REASON_EPT_VIOLATION:
   23.14      {
   23.15          paddr_t gpa = __vmread(GUEST_PHYSICAL_ADDRESS);
   23.16 -#ifdef CONFIG_X86_PAE
   23.17 +#ifdef __i386__
   23.18          gpa |= (paddr_t)__vmread(GUEST_PHYSICAL_ADDRESS_HIGH) << 32;
   23.19  #endif
   23.20          exit_qualification = __vmread(EXIT_QUALIFICATION);
    24.1 --- a/xen/arch/x86/mm.c	Thu May 08 13:40:40 2008 +0100
    24.2 +++ b/xen/arch/x86/mm.c	Thu May 08 14:32:11 2008 +0100
    24.3 @@ -129,7 +129,7 @@ l1_pgentry_t __attribute__ ((__section__
    24.4   *  1. Debug builds get extra checking by using CMPXCHG[8B].
    24.5   *  2. PAE builds perform an atomic 8-byte store with CMPXCHG8B.
    24.6   */
    24.7 -#if !defined(NDEBUG) || defined(CONFIG_X86_PAE)
    24.8 +#if !defined(NDEBUG) || defined(__i386__)
    24.9  #define PTE_UPDATE_WITH_CMPXCHG
   24.10  #endif
   24.11  
   24.12 @@ -340,7 +340,7 @@ void share_xen_page_with_privileged_gues
   24.13      share_xen_page_with_guest(page, dom_xen, readonly);
   24.14  }
   24.15  
   24.16 -#if defined(CONFIG_X86_PAE)
   24.17 +#if defined(__i386__)
   24.18  
   24.19  #ifdef NDEBUG
   24.20  /* Only PDPTs above 4GB boundary need to be shadowed in low memory. */
   24.21 @@ -416,14 +416,14 @@ void make_cr3(struct vcpu *v, unsigned l
   24.22      spin_unlock(&cache->lock);
   24.23  }
   24.24  
   24.25 -#else /* !CONFIG_X86_PAE */
   24.26 +#else /* !defined(__i386__) */
   24.27  
   24.28  void make_cr3(struct vcpu *v, unsigned long mfn)
   24.29  {
   24.30      v->arch.cr3 = mfn << PAGE_SHIFT;
   24.31  }
   24.32  
   24.33 -#endif /* !CONFIG_X86_PAE */
   24.34 +#endif /* !defined(__i386__) */
   24.35  
   24.36  void write_ptbase(struct vcpu *v)
   24.37  {
   24.38 @@ -997,7 +997,6 @@ static int alloc_l1_table(struct page_in
   24.39      return 0;
   24.40  }
   24.41  
   24.42 -#if defined(CONFIG_X86_PAE) || defined(CONFIG_COMPAT)
   24.43  static int create_pae_xen_mappings(struct domain *d, l3_pgentry_t *pl3e)
   24.44  {
   24.45      struct page_info *page;
   24.46 @@ -1070,11 +1069,8 @@ static int create_pae_xen_mappings(struc
   24.47  
   24.48      return 1;
   24.49  }
   24.50 -#else
   24.51 -# define create_pae_xen_mappings(d, pl3e) (1)
   24.52 -#endif
   24.53 -
   24.54 -#ifdef CONFIG_X86_PAE
   24.55 +
   24.56 +#ifdef __i386__
   24.57  /* Flush a pgdir update into low-memory caches. */
   24.58  static void pae_flush_pgd(
   24.59      unsigned long mfn, unsigned int idx, l3_pgentry_t nl3e)
   24.60 @@ -1144,20 +1140,6 @@ static int alloc_l2_table(struct page_in
   24.61          adjust_guest_l2e(pl2e[i], d);
   24.62      }
   24.63  
   24.64 -#if CONFIG_PAGING_LEVELS == 2
   24.65 -    /* Xen private mappings. */
   24.66 -    memcpy(&pl2e[L2_PAGETABLE_FIRST_XEN_SLOT],
   24.67 -           &idle_pg_table[L2_PAGETABLE_FIRST_XEN_SLOT],
   24.68 -           L2_PAGETABLE_XEN_SLOTS * sizeof(l2_pgentry_t));
   24.69 -    pl2e[l2_table_offset(LINEAR_PT_VIRT_START)] =
   24.70 -        l2e_from_pfn(pfn, __PAGE_HYPERVISOR);
   24.71 -    for ( i = 0; i < PDPT_L2_ENTRIES; i++ )
   24.72 -        pl2e[l2_table_offset(PERDOMAIN_VIRT_START) + i] =
   24.73 -            l2e_from_page(
   24.74 -                virt_to_page(page_get_owner(page)->arch.mm_perdomain_pt) + i,
   24.75 -                __PAGE_HYPERVISOR);
   24.76 -#endif
   24.77 -
   24.78      unmap_domain_page(pl2e);
   24.79      return 1;
   24.80  
   24.81 @@ -1180,7 +1162,7 @@ static int alloc_l3_table(struct page_in
   24.82      l3_pgentry_t  *pl3e;
   24.83      int            i;
   24.84  
   24.85 -#ifdef CONFIG_X86_PAE
   24.86 +#if CONFIG_PAGING_LEVELS == 3
   24.87      /*
   24.88       * PAE pgdirs above 4GB are unacceptable if the guest does not understand
   24.89       * the weird 'extended cr3' format for dealing with high-order address
   24.90 @@ -1209,7 +1191,6 @@ static int alloc_l3_table(struct page_in
   24.91  
   24.92      for ( i = 0; i < L3_PAGETABLE_ENTRIES; i++ )
   24.93      {
   24.94 -#if defined(CONFIG_X86_PAE) || defined(CONFIG_COMPAT)
   24.95          if ( is_pv_32bit_domain(d) && (i == 3) )
   24.96          {
   24.97              if ( !(l3e_get_flags(pl3e[i]) & _PAGE_PRESENT) ||
   24.98 @@ -1220,12 +1201,10 @@ static int alloc_l3_table(struct page_in
   24.99                                                  d) )
  24.100                  goto fail;
  24.101          }
  24.102 -        else
  24.103 -#endif
  24.104 -        if ( is_guest_l3_slot(i) &&
  24.105 -             unlikely(!get_page_from_l3e(pl3e[i], pfn, d)) )
  24.106 +        else if ( is_guest_l3_slot(i) &&
  24.107 +                  unlikely(!get_page_from_l3e(pl3e[i], pfn, d)) )
  24.108              goto fail;
  24.109 -        
  24.110 +
  24.111          adjust_guest_l3e(pl3e[i], d);
  24.112      }
  24.113  
  24.114 @@ -1562,14 +1541,12 @@ static int mod_l3_entry(l3_pgentry_t *pl
  24.115          return 0;
  24.116      }
  24.117  
  24.118 -#if defined(CONFIG_X86_PAE) || defined(CONFIG_COMPAT)
  24.119      /*
  24.120       * Disallow updates to final L3 slot. It contains Xen mappings, and it
  24.121       * would be a pain to ensure they remain continuously valid throughout.
  24.122       */
  24.123      if ( is_pv_32bit_domain(d) && (pgentry_ptr_to_slot(pl3e) >= 3) )
  24.124          return 0;
  24.125 -#endif 
  24.126  
  24.127      if ( unlikely(__copy_from_user(&ol3e, pl3e, sizeof(ol3e)) != 0) )
  24.128          return 0;
    25.1 --- a/xen/arch/x86/mm/hap/hap.c	Thu May 08 13:40:40 2008 +0100
    25.2 +++ b/xen/arch/x86/mm/hap/hap.c	Thu May 08 14:32:11 2008 +0100
    25.3 @@ -311,41 +311,6 @@ static void hap_install_xen_entries_in_l
    25.4  }
    25.5  #endif
    25.6  
    25.7 -#if CONFIG_PAGING_LEVELS == 2
    25.8 -static void hap_install_xen_entries_in_l2(struct vcpu *v, mfn_t l2mfn)
    25.9 -{
   25.10 -    struct domain *d = v->domain;
   25.11 -    l2_pgentry_t *l2e;
   25.12 -    int i;
   25.13 -
   25.14 -    l2e = hap_map_domain_page(l2mfn);
   25.15 -    ASSERT(l2e != NULL);
   25.16 -
   25.17 -    /* Copy the common Xen mappings from the idle domain */
   25.18 -    memcpy(&l2e[L2_PAGETABLE_FIRST_XEN_SLOT],
   25.19 -           &idle_pg_table[L2_PAGETABLE_FIRST_XEN_SLOT],
   25.20 -           L2_PAGETABLE_XEN_SLOTS * sizeof(l2_pgentry_t));
   25.21 -
   25.22 -    /* Install the per-domain mappings for this domain */
   25.23 -    for ( i = 0; i < PDPT_L2_ENTRIES; i++ )
   25.24 -        l2e[l2_table_offset(PERDOMAIN_VIRT_START) + i] =
   25.25 -            l2e_from_pfn(
   25.26 -                mfn_x(page_to_mfn(virt_to_page(d->arch.mm_perdomain_pt) + i)),
   25.27 -                __PAGE_HYPERVISOR);
   25.28 -
   25.29 -    /* Install the linear mapping */
   25.30 -    l2e[l2_table_offset(LINEAR_PT_VIRT_START)] =
   25.31 -        l2e_from_pfn(mfn_x(l2mfn), __PAGE_HYPERVISOR);
   25.32 -
   25.33 -    /* Install the domain-specific P2M table */
   25.34 -    l2e[l2_table_offset(RO_MPT_VIRT_START)] =
   25.35 -        l2e_from_pfn(mfn_x(pagetable_get_mfn(d->arch.phys_table)),
   25.36 -                            __PAGE_HYPERVISOR);
   25.37 -
   25.38 -    hap_unmap_domain_page(l2e);
   25.39 -}
   25.40 -#endif
   25.41 -
   25.42  static mfn_t hap_make_monitor_table(struct vcpu *v)
   25.43  {
   25.44      struct domain *d = v->domain;
   25.45 @@ -395,15 +360,6 @@ static mfn_t hap_make_monitor_table(stru
   25.46          HAP_PRINTK("new monitor table: %#lx\n", mfn_x(m3mfn));
   25.47          return m3mfn;
   25.48      }
   25.49 -#else
   25.50 -    {
   25.51 -        mfn_t m2mfn;
   25.52 -        if ( (pg = hap_alloc(d)) == NULL )
   25.53 -            goto oom;
   25.54 -        m2mfn = page_to_mfn(pg);;
   25.55 -        hap_install_xen_entries_in_l2(v, m2mfn);
   25.56 -        return m2mfn;
   25.57 -    }
   25.58  #endif
   25.59  
   25.60   oom:
    26.1 --- a/xen/arch/x86/mm/p2m.c	Thu May 08 13:40:40 2008 +0100
    26.2 +++ b/xen/arch/x86/mm/p2m.c	Thu May 08 14:32:11 2008 +0100
    26.3 @@ -488,8 +488,6 @@ int p2m_alloc_table(struct domain *d,
    26.4          PGT_l4_page_table
    26.5  #elif CONFIG_PAGING_LEVELS == 3
    26.6          PGT_l3_page_table
    26.7 -#elif CONFIG_PAGING_LEVELS == 2
    26.8 -        PGT_l2_page_table
    26.9  #endif
   26.10          | 1 | PGT_validated;
   26.11  
    27.1 --- a/xen/arch/x86/mm/shadow/Makefile	Thu May 08 13:40:40 2008 +0100
    27.2 +++ b/xen/arch/x86/mm/shadow/Makefile	Thu May 08 14:32:11 2008 +0100
    27.3 @@ -1,9 +1,4 @@
    27.4 -ifneq ($(pae),n)
    27.5  obj-$(x86_32) += common.o g2_on_s3.o g3_on_s3.o
    27.6 -else
    27.7 -obj-$(x86_32) += common.o g2_on_s2.o
    27.8 -endif
    27.9 -
   27.10  obj-$(x86_64) += common.o g4_on_s4.o g3_on_s3.o g2_on_s3.o
   27.11  
   27.12  guest_levels  = $(subst g,,$(filter g%,$(subst ., ,$(subst _, ,$(1)))))
    28.1 --- a/xen/arch/x86/mm/shadow/common.c	Thu May 08 13:40:40 2008 +0100
    28.2 +++ b/xen/arch/x86/mm/shadow/common.c	Thu May 08 14:32:11 2008 +0100
    28.3 @@ -68,8 +68,6 @@ void shadow_vcpu_init(struct vcpu *v)
    28.4      v->arch.paging.mode = &SHADOW_INTERNAL_NAME(sh_paging_mode,3,3);
    28.5  #elif CONFIG_PAGING_LEVELS == 3
    28.6      v->arch.paging.mode = &SHADOW_INTERNAL_NAME(sh_paging_mode,3,3);
    28.7 -#elif CONFIG_PAGING_LEVELS == 2
    28.8 -    v->arch.paging.mode = &SHADOW_INTERNAL_NAME(sh_paging_mode,2,2);
    28.9  #endif
   28.10  }
   28.11  
   28.12 @@ -504,27 +502,14 @@ sh_validate_guest_entry(struct vcpu *v, 
   28.13      if ( !(page->count_info & PGC_page_table) )
   28.14          return 0;  /* Not shadowed at all */
   28.15  
   28.16 -#if CONFIG_PAGING_LEVELS == 2
   28.17 -    if ( page->shadow_flags & SHF_L1_32 ) 
   28.18 -        result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl1e, 2, 2)
   28.19 -            (v, gmfn, entry, size);
   28.20 -#else 
   28.21      if ( page->shadow_flags & SHF_L1_32 ) 
   28.22          result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl1e, 3, 2)
   28.23              (v, gmfn, entry, size);
   28.24 -#endif
   28.25 -
   28.26 -#if CONFIG_PAGING_LEVELS == 2
   28.27 -    if ( page->shadow_flags & SHF_L2_32 ) 
   28.28 -        result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl2e, 2, 2)
   28.29 -            (v, gmfn, entry, size);
   28.30 -#else 
   28.31 +
   28.32      if ( page->shadow_flags & SHF_L2_32 ) 
   28.33          result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl2e, 3, 2)
   28.34              (v, gmfn, entry, size);
   28.35 -#endif
   28.36 -
   28.37 -#if CONFIG_PAGING_LEVELS >= 3 
   28.38 +
   28.39      if ( page->shadow_flags & SHF_L1_PAE ) 
   28.40          result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl1e, 3, 3)
   28.41              (v, gmfn, entry, size);
   28.42 @@ -534,9 +519,6 @@ sh_validate_guest_entry(struct vcpu *v, 
   28.43      if ( page->shadow_flags & SHF_L2H_PAE ) 
   28.44          result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl2he, 3, 3)
   28.45              (v, gmfn, entry, size);
   28.46 -#else /* 32-bit non-PAE hypervisor does not support PAE guests */
   28.47 -    ASSERT((page->shadow_flags & (SHF_L2H_PAE|SHF_L2_PAE|SHF_L1_PAE)) == 0);
   28.48 -#endif
   28.49  
   28.50  #if CONFIG_PAGING_LEVELS >= 4 
   28.51      if ( page->shadow_flags & SHF_L1_64 ) 
   28.52 @@ -554,7 +536,7 @@ sh_validate_guest_entry(struct vcpu *v, 
   28.53      if ( page->shadow_flags & SHF_L4_64 ) 
   28.54          result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl4e, 4, 4)
   28.55              (v, gmfn, entry, size);
   28.56 -#else /* 32-bit/PAE hypervisor does not support 64-bit guests */
   28.57 +#else /* 32-bit hypervisor does not support 64-bit guests */
   28.58      ASSERT((page->shadow_flags 
   28.59              & (SHF_L4_64|SHF_L3_64|SHF_L2H_64|SHF_L2_64|SHF_L1_64)) == 0);
   28.60  #endif
   28.61 @@ -685,7 +667,6 @@ static unsigned int shadow_min_acceptabl
   28.62  static inline u32
   28.63  shadow_order(unsigned int shadow_type) 
   28.64  {
   28.65 -#if CONFIG_PAGING_LEVELS > 2
   28.66      static const u32 type_to_order[SH_type_unused] = {
   28.67          0, /* SH_type_none           */
   28.68          1, /* SH_type_l1_32_shadow   */
   28.69 @@ -706,9 +687,6 @@ shadow_order(unsigned int shadow_type)
   28.70          };
   28.71      ASSERT(shadow_type < SH_type_unused);
   28.72      return type_to_order[shadow_type];
   28.73 -#else  /* 32-bit Xen only ever shadows 32-bit guests on 32-bit shadows. */
   28.74 -    return 0;
   28.75 -#endif
   28.76  }
   28.77  
   28.78  static inline unsigned int
   28.79 @@ -745,18 +723,12 @@ static void shadow_unhook_mappings(struc
   28.80      switch ( sp->type )
   28.81      {
   28.82      case SH_type_l2_32_shadow:
   28.83 -#if CONFIG_PAGING_LEVELS == 2
   28.84 -        SHADOW_INTERNAL_NAME(sh_unhook_32b_mappings,2,2)(v,smfn);
   28.85 -#else
   28.86          SHADOW_INTERNAL_NAME(sh_unhook_32b_mappings,3,2)(v,smfn);
   28.87 -#endif
   28.88          break;
   28.89 -#if CONFIG_PAGING_LEVELS >= 3
   28.90      case SH_type_l2_pae_shadow:
   28.91      case SH_type_l2h_pae_shadow:
   28.92          SHADOW_INTERNAL_NAME(sh_unhook_pae_mappings,3,3)(v,smfn);
   28.93          break;
   28.94 -#endif
   28.95  #if CONFIG_PAGING_LEVELS >= 4
   28.96      case SH_type_l4_64_shadow:
   28.97          SHADOW_INTERNAL_NAME(sh_unhook_64b_mappings,4,4)(v,smfn);
   28.98 @@ -1599,15 +1571,6 @@ void sh_destroy_shadow(struct vcpu *v, m
   28.99       * small numbers that the compiler will enjoy */
  28.100      switch ( t )
  28.101      {
  28.102 -#if CONFIG_PAGING_LEVELS == 2
  28.103 -    case SH_type_l1_32_shadow:
  28.104 -    case SH_type_fl1_32_shadow:
  28.105 -        SHADOW_INTERNAL_NAME(sh_destroy_l1_shadow, 2, 2)(v, smfn); 
  28.106 -        break;
  28.107 -    case SH_type_l2_32_shadow:
  28.108 -        SHADOW_INTERNAL_NAME(sh_destroy_l2_shadow, 2, 2)(v, smfn);
  28.109 -        break;
  28.110 -#else /* PAE or 64bit */
  28.111      case SH_type_l1_32_shadow:
  28.112      case SH_type_fl1_32_shadow:
  28.113          SHADOW_INTERNAL_NAME(sh_destroy_l1_shadow, 3, 2)(v, smfn);
  28.114 @@ -1615,9 +1578,7 @@ void sh_destroy_shadow(struct vcpu *v, m
  28.115      case SH_type_l2_32_shadow:
  28.116          SHADOW_INTERNAL_NAME(sh_destroy_l2_shadow, 3, 2)(v, smfn);
  28.117          break;
  28.118 -#endif
  28.119 -
  28.120 -#if CONFIG_PAGING_LEVELS >= 3
  28.121 +
  28.122      case SH_type_l1_pae_shadow:
  28.123      case SH_type_fl1_pae_shadow:
  28.124          SHADOW_INTERNAL_NAME(sh_destroy_l1_shadow, 3, 3)(v, smfn);
  28.125 @@ -1626,7 +1587,6 @@ void sh_destroy_shadow(struct vcpu *v, m
  28.126      case SH_type_l2h_pae_shadow:
  28.127          SHADOW_INTERNAL_NAME(sh_destroy_l2_shadow, 3, 3)(v, smfn);
  28.128          break;
  28.129 -#endif
  28.130  
  28.131  #if CONFIG_PAGING_LEVELS >= 4
  28.132      case SH_type_l1_64_shadow:
  28.133 @@ -1666,21 +1626,11 @@ int sh_remove_write_access(struct vcpu *
  28.134      /* Dispatch table for getting per-type functions */
  28.135      static hash_callback_t callbacks[SH_type_unused] = {
  28.136          NULL, /* none    */
  28.137 -#if CONFIG_PAGING_LEVELS == 2
  28.138 -        SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1,2,2), /* l1_32   */
  28.139 -        SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1,2,2), /* fl1_32  */
  28.140 -#else 
  28.141          SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1,3,2), /* l1_32   */
  28.142          SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1,3,2), /* fl1_32  */
  28.143 -#endif
  28.144          NULL, /* l2_32   */
  28.145 -#if CONFIG_PAGING_LEVELS >= 3
  28.146          SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1,3,3), /* l1_pae  */
  28.147          SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1,3,3), /* fl1_pae */
  28.148 -#else 
  28.149 -        NULL, /* l1_pae  */
  28.150 -        NULL, /* fl1_pae */
  28.151 -#endif
  28.152          NULL, /* l2_pae  */
  28.153          NULL, /* l2h_pae */
  28.154  #if CONFIG_PAGING_LEVELS >= 4
  28.155 @@ -1860,21 +1810,11 @@ int sh_remove_all_mappings(struct vcpu *
  28.156      /* Dispatch table for getting per-type functions */
  28.157      static hash_callback_t callbacks[SH_type_unused] = {
  28.158          NULL, /* none    */
  28.159 -#if CONFIG_PAGING_LEVELS == 2
  28.160 -        SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1,2,2), /* l1_32   */
  28.161 -        SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1,2,2), /* fl1_32  */
  28.162 -#else 
  28.163          SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1,3,2), /* l1_32   */
  28.164          SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1,3,2), /* fl1_32  */
  28.165 -#endif
  28.166          NULL, /* l2_32   */
  28.167 -#if CONFIG_PAGING_LEVELS >= 3
  28.168          SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1,3,3), /* l1_pae  */
  28.169          SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1,3,3), /* fl1_pae */
  28.170 -#else 
  28.171 -        NULL, /* l1_pae  */
  28.172 -        NULL, /* fl1_pae */
  28.173 -#endif
  28.174          NULL, /* l2_pae  */
  28.175          NULL, /* l2h_pae */
  28.176  #if CONFIG_PAGING_LEVELS >= 4
  28.177 @@ -1978,13 +1918,8 @@ static int sh_remove_shadow_via_pointer(
  28.178      {
  28.179      case SH_type_l1_32_shadow:
  28.180      case SH_type_l2_32_shadow:
  28.181 -#if CONFIG_PAGING_LEVELS == 2
  28.182 -        SHADOW_INTERNAL_NAME(sh_clear_shadow_entry,2,2)(v, vaddr, pmfn);
  28.183 -#else
  28.184          SHADOW_INTERNAL_NAME(sh_clear_shadow_entry,3,2)(v, vaddr, pmfn);
  28.185 -#endif
  28.186          break;
  28.187 -#if CONFIG_PAGING_LEVELS >=3
  28.188      case SH_type_l1_pae_shadow:
  28.189      case SH_type_l2_pae_shadow:
  28.190      case SH_type_l2h_pae_shadow:
  28.191 @@ -1999,7 +1934,6 @@ static int sh_remove_shadow_via_pointer(
  28.192          SHADOW_INTERNAL_NAME(sh_clear_shadow_entry,4,4)(v, vaddr, pmfn);
  28.193          break;
  28.194  #endif
  28.195 -#endif
  28.196      default: BUG(); /* Some wierd unknown shadow type */
  28.197      }
  28.198      
  28.199 @@ -2032,20 +1966,11 @@ void sh_remove_shadows(struct vcpu *v, m
  28.200          NULL, /* none    */
  28.201          NULL, /* l1_32   */
  28.202          NULL, /* fl1_32  */
  28.203 -#if CONFIG_PAGING_LEVELS == 2
  28.204 -        SHADOW_INTERNAL_NAME(sh_remove_l1_shadow,2,2), /* l2_32   */
  28.205 -#else 
  28.206          SHADOW_INTERNAL_NAME(sh_remove_l1_shadow,3,2), /* l2_32   */
  28.207 -#endif
  28.208          NULL, /* l1_pae  */
  28.209          NULL, /* fl1_pae */
  28.210 -#if CONFIG_PAGING_LEVELS >= 3
  28.211          SHADOW_INTERNAL_NAME(sh_remove_l1_shadow,3,3), /* l2_pae  */
  28.212          SHADOW_INTERNAL_NAME(sh_remove_l1_shadow,3,3), /* l2h_pae */
  28.213 -#else 
  28.214 -        NULL, /* l2_pae  */
  28.215 -        NULL, /* l2h_pae */
  28.216 -#endif
  28.217          NULL, /* l1_64   */
  28.218          NULL, /* fl1_64  */
  28.219  #if CONFIG_PAGING_LEVELS >= 4
  28.220 @@ -2232,8 +2157,6 @@ static void sh_update_paging_modes(struc
  28.221          v->arch.paging.mode = &SHADOW_INTERNAL_NAME(sh_paging_mode,4,4);
  28.222  #elif CONFIG_PAGING_LEVELS == 3
  28.223          v->arch.paging.mode = &SHADOW_INTERNAL_NAME(sh_paging_mode,3,3);
  28.224 -#elif CONFIG_PAGING_LEVELS == 2
  28.225 -        v->arch.paging.mode = &SHADOW_INTERNAL_NAME(sh_paging_mode,2,2);
  28.226  #else
  28.227  #error unexpected paging mode
  28.228  #endif
  28.229 @@ -3110,11 +3033,6 @@ void shadow_audit_tables(struct vcpu *v)
  28.230      /* Dispatch table for getting per-type functions */
  28.231      static hash_callback_t callbacks[SH_type_unused] = {
  28.232          NULL, /* none    */
  28.233 -#if CONFIG_PAGING_LEVELS == 2
  28.234 -        SHADOW_INTERNAL_NAME(sh_audit_l1_table,2,2),  /* l1_32   */
  28.235 -        SHADOW_INTERNAL_NAME(sh_audit_fl1_table,2,2), /* fl1_32  */
  28.236 -        SHADOW_INTERNAL_NAME(sh_audit_l2_table,2,2),  /* l2_32   */
  28.237 -#else 
  28.238          SHADOW_INTERNAL_NAME(sh_audit_l1_table,3,2),  /* l1_32   */
  28.239          SHADOW_INTERNAL_NAME(sh_audit_fl1_table,3,2), /* fl1_32  */
  28.240          SHADOW_INTERNAL_NAME(sh_audit_l2_table,3,2),  /* l2_32   */
  28.241 @@ -3130,7 +3048,6 @@ void shadow_audit_tables(struct vcpu *v)
  28.242          SHADOW_INTERNAL_NAME(sh_audit_l3_table,4,4),  /* l3_64   */
  28.243          SHADOW_INTERNAL_NAME(sh_audit_l4_table,4,4),  /* l4_64   */
  28.244  #endif /* CONFIG_PAGING_LEVELS >= 4 */
  28.245 -#endif /* CONFIG_PAGING_LEVELS > 2 */
  28.246          NULL  /* All the rest */
  28.247      };
  28.248      unsigned int mask; 
    29.1 --- a/xen/arch/x86/mm/shadow/multi.c	Thu May 08 13:40:40 2008 +0100
    29.2 +++ b/xen/arch/x86/mm/shadow/multi.c	Thu May 08 14:32:11 2008 +0100
    29.3 @@ -1745,56 +1745,6 @@ static void sh_install_xen_entries_in_l2
    29.4  #endif
    29.5  
    29.6  
    29.7 -#if CONFIG_PAGING_LEVELS == 2 && GUEST_PAGING_LEVELS == 2
    29.8 -void sh_install_xen_entries_in_l2(struct vcpu *v, mfn_t gl2mfn, mfn_t sl2mfn)
    29.9 -{
   29.10 -    struct domain *d = v->domain;
   29.11 -    shadow_l2e_t *sl2e;
   29.12 -    int i;
   29.13 -
   29.14 -    sl2e = sh_map_domain_page(sl2mfn);
   29.15 -    ASSERT(sl2e != NULL);
   29.16 -    ASSERT(sizeof (l2_pgentry_t) == sizeof (shadow_l2e_t));
   29.17 -    
   29.18 -    /* Copy the common Xen mappings from the idle domain */
   29.19 -    memcpy(&sl2e[L2_PAGETABLE_FIRST_XEN_SLOT],
   29.20 -           &idle_pg_table[L2_PAGETABLE_FIRST_XEN_SLOT],
   29.21 -           L2_PAGETABLE_XEN_SLOTS * sizeof(l2_pgentry_t));
   29.22 -
   29.23 -    /* Install the per-domain mappings for this domain */
   29.24 -    for ( i = 0; i < PDPT_L2_ENTRIES; i++ )
   29.25 -        sl2e[shadow_l2_table_offset(PERDOMAIN_VIRT_START) + i] =
   29.26 -            shadow_l2e_from_mfn(
   29.27 -                page_to_mfn(virt_to_page(d->arch.mm_perdomain_pt) + i),
   29.28 -                __PAGE_HYPERVISOR);
   29.29 -
   29.30 -    /* Linear mapping */
   29.31 -    sl2e[shadow_l2_table_offset(SH_LINEAR_PT_VIRT_START)] =
   29.32 -        shadow_l2e_from_mfn(sl2mfn, __PAGE_HYPERVISOR);
   29.33 -
   29.34 -    if ( shadow_mode_translate(v->domain) && !shadow_mode_external(v->domain) )
   29.35 -    {
   29.36 -        // linear tables may not be used with translated PV guests
   29.37 -        sl2e[shadow_l2_table_offset(LINEAR_PT_VIRT_START)] =
   29.38 -            shadow_l2e_empty();
   29.39 -    }
   29.40 -    else
   29.41 -    {
   29.42 -        sl2e[shadow_l2_table_offset(LINEAR_PT_VIRT_START)] =
   29.43 -            shadow_l2e_from_mfn(gl2mfn, __PAGE_HYPERVISOR);
   29.44 -    }
   29.45 -
   29.46 -    if ( shadow_mode_translate(d) )
   29.47 -    {
   29.48 -        /* install domain-specific P2M table */
   29.49 -        sl2e[shadow_l2_table_offset(RO_MPT_VIRT_START)] =
   29.50 -            shadow_l2e_from_mfn(pagetable_get_mfn(d->arch.phys_table),
   29.51 -                                __PAGE_HYPERVISOR);
   29.52 -    }
   29.53 -
   29.54 -    sh_unmap_domain_page(sl2e);
   29.55 -}
   29.56 -#endif
   29.57  
   29.58  
   29.59  
   29.60 @@ -1866,10 +1816,6 @@ sh_make_shadow(struct vcpu *v, mfn_t gmf
   29.61          case SH_type_l2h_shadow:
   29.62              sh_install_xen_entries_in_l2h(v, smfn); break;
   29.63  #endif
   29.64 -#if CONFIG_PAGING_LEVELS == 2 && GUEST_PAGING_LEVELS == 2
   29.65 -        case SH_type_l2_shadow:
   29.66 -            sh_install_xen_entries_in_l2(v, gmfn, smfn); break;
   29.67 -#endif
   29.68          default: /* Do nothing */ break;
   29.69          }
   29.70      }
   29.71 @@ -1989,17 +1935,6 @@ sh_make_monitor_table(struct vcpu *v)
   29.72          return m3mfn;
   29.73      }
   29.74  
   29.75 -#elif CONFIG_PAGING_LEVELS == 2
   29.76 -
   29.77 -    {
   29.78 -        mfn_t m2mfn;
   29.79 -        m2mfn = shadow_alloc(d, SH_type_monitor_table, 0);
   29.80 -        sh_install_xen_entries_in_l2(v, m2mfn, m2mfn);
   29.81 -        /* Remember the level of this table */
   29.82 -        mfn_to_page(m2mfn)->shadow_flags = 2;
   29.83 -        return m2mfn;
   29.84 -    }
   29.85 -
   29.86  #else
   29.87  #error this should not happen
   29.88  #endif /* CONFIG_PAGING_LEVELS */
   29.89 @@ -3641,32 +3576,6 @@ sh_update_linear_entries(struct vcpu *v)
   29.90              sh_unmap_domain_page(l2e);
   29.91      }
   29.92  
   29.93 -#elif CONFIG_PAGING_LEVELS == 2
   29.94 -
   29.95 -    /* For PV, one l2e points at the guest l2, one points at the shadow
   29.96 -     * l2. No maintenance required. 
   29.97 -     * For HVM, just need to update the l2e that points to the shadow l2. */
   29.98 -
   29.99 -    if ( shadow_mode_external(d) )
  29.100 -    {
  29.101 -        /* Use the linear map if we can; otherwise make a new mapping */
  29.102 -        if ( v == current ) 
  29.103 -        {
  29.104 -            __linear_l2_table[l2_linear_offset(SH_LINEAR_PT_VIRT_START)] = 
  29.105 -                l2e_from_pfn(pagetable_get_pfn(v->arch.shadow_table[0]),
  29.106 -                             __PAGE_HYPERVISOR);
  29.107 -        } 
  29.108 -        else
  29.109 -        { 
  29.110 -            l2_pgentry_t *ml2e;
  29.111 -            ml2e = sh_map_domain_page(pagetable_get_mfn(v->arch.monitor_table));
  29.112 -            ml2e[l2_table_offset(SH_LINEAR_PT_VIRT_START)] = 
  29.113 -                l2e_from_pfn(pagetable_get_pfn(v->arch.shadow_table[0]),
  29.114 -                             __PAGE_HYPERVISOR);
  29.115 -            sh_unmap_domain_page(ml2e);
  29.116 -        }
  29.117 -    }
  29.118 -
  29.119  #else
  29.120  #error this should not happen
  29.121  #endif
    30.1 --- a/xen/arch/x86/mm/shadow/private.h	Thu May 08 13:40:40 2008 +0100
    30.2 +++ b/xen/arch/x86/mm/shadow/private.h	Thu May 08 14:32:11 2008 +0100
    30.3 @@ -162,14 +162,6 @@ extern void shadow_audit_tables(struct v
    30.4  #define SHADOW_INTERNAL_NAME(name, shadow_levels, guest_levels) \
    30.5      SHADOW_INTERNAL_NAME_HIDDEN(name, shadow_levels, guest_levels)
    30.6  
    30.7 -#if CONFIG_PAGING_LEVELS == 2
    30.8 -#define GUEST_LEVELS  2
    30.9 -#define SHADOW_LEVELS 2
   30.10 -#include "multi.h"
   30.11 -#undef GUEST_LEVELS
   30.12 -#undef SHADOW_LEVELS
   30.13 -#endif /* CONFIG_PAGING_LEVELS == 2 */
   30.14 -
   30.15  #if CONFIG_PAGING_LEVELS == 3
   30.16  #define GUEST_LEVELS  2
   30.17  #define SHADOW_LEVELS 3
   30.18 @@ -360,7 +352,6 @@ void  shadow_free(struct domain *d, mfn_
   30.19  
   30.20  /* Install the xen mappings in various flavours of shadow */
   30.21  void sh_install_xen_entries_in_l4(struct vcpu *v, mfn_t gl4mfn, mfn_t sl4mfn);
   30.22 -void sh_install_xen_entries_in_l2(struct vcpu *v, mfn_t gl2mfn, mfn_t sl2mfn);
   30.23  
   30.24  /* Update the shadows in response to a pagetable write from Xen */
   30.25  int sh_validate_guest_entry(struct vcpu *v, mfn_t gmfn, void *entry, u32 size);
    31.1 --- a/xen/arch/x86/setup.c	Thu May 08 13:40:40 2008 +0100
    31.2 +++ b/xen/arch/x86/setup.c	Thu May 08 14:32:11 2008 +0100
    31.3 @@ -121,11 +121,7 @@ char __attribute__ ((__section__(".bss.s
    31.4  
    31.5  struct cpuinfo_x86 boot_cpu_data = { 0, 0, 0, 0, -1 };
    31.6  
    31.7 -#if CONFIG_PAGING_LEVELS > 2
    31.8  unsigned long mmu_cr4_features = X86_CR4_PSE | X86_CR4_PGE | X86_CR4_PAE;
    31.9 -#else
   31.10 -unsigned long mmu_cr4_features = X86_CR4_PSE;
   31.11 -#endif
   31.12  EXPORT_SYMBOL(mmu_cr4_features);
   31.13  
   31.14  int acpi_disabled;
   31.15 @@ -1064,17 +1060,7 @@ void arch_get_xen_caps(xen_capabilities_
   31.16  
   31.17      (*info)[0] = '\0';
   31.18  
   31.19 -#if defined(CONFIG_X86_32) && !defined(CONFIG_X86_PAE)
   31.20 -
   31.21 -    snprintf(s, sizeof(s), "xen-%d.%d-x86_32 ", major, minor);
   31.22 -    safe_strcat(*info, s);
   31.23 -    if ( hvm_enabled )
   31.24 -    {
   31.25 -        snprintf(s, sizeof(s), "hvm-%d.%d-x86_32 ", major, minor);
   31.26 -        safe_strcat(*info, s);
   31.27 -    }
   31.28 -
   31.29 -#elif defined(CONFIG_X86_32) && defined(CONFIG_X86_PAE)
   31.30 +#if defined(CONFIG_X86_32)
   31.31  
   31.32      snprintf(s, sizeof(s), "xen-%d.%d-x86_32p ", major, minor);
   31.33      safe_strcat(*info, s);
    32.1 --- a/xen/arch/x86/traps.c	Thu May 08 13:40:40 2008 +0100
    32.2 +++ b/xen/arch/x86/traps.c	Thu May 08 14:32:11 2008 +0100
    32.3 @@ -1021,13 +1021,13 @@ static int __spurious_page_fault(
    32.4  
    32.5  #if CONFIG_PAGING_LEVELS >= 3
    32.6      l3t  = map_domain_page(mfn);
    32.7 -#ifdef CONFIG_X86_PAE
    32.8 +#if CONFIG_PAGING_LEVELS == 3
    32.9      l3t += (cr3 & 0xFE0UL) >> 3;
   32.10  #endif
   32.11      l3e = l3e_read_atomic(&l3t[l3_table_offset(addr)]);
   32.12      mfn = l3e_get_pfn(l3e);
   32.13      unmap_domain_page(l3t);
   32.14 -#ifdef CONFIG_X86_PAE
   32.15 +#if CONFIG_PAGING_LEVELS == 3
   32.16      if ( !(l3e_get_flags(l3e) & _PAGE_PRESENT) )
   32.17          return 0;
   32.18  #else
    33.1 --- a/xen/arch/x86/x86_32/mm.c	Thu May 08 13:40:40 2008 +0100
    33.2 +++ b/xen/arch/x86/x86_32/mm.c	Thu May 08 14:32:11 2008 +0100
    33.3 @@ -30,13 +30,8 @@
    33.4  #include <asm/fixmap.h>
    33.5  #include <public/memory.h>
    33.6  
    33.7 -#ifdef CONFIG_X86_PAE
    33.8  l2_pgentry_t __attribute__ ((__section__ (".bss.page_aligned")))
    33.9      idle_pg_table_l2[4 * L2_PAGETABLE_ENTRIES];
   33.10 -#else
   33.11 -l2_pgentry_t __attribute__ ((__section__ (".bss.page_aligned")))
   33.12 -    idle_pg_table_l2[L2_PAGETABLE_ENTRIES];
   33.13 -#endif
   33.14  
   33.15  extern l1_pgentry_t l1_identmap[L1_PAGETABLE_ENTRIES];
   33.16  
   33.17 @@ -74,12 +69,6 @@ void __init paging_init(void)
   33.18      struct page_info *pg;
   33.19      int i;
   33.20  
   33.21 -#ifdef CONFIG_X86_PAE
   33.22 -    printk("PAE enabled, limit: %d GB\n", MACHPHYS_MBYTES);
   33.23 -#else
   33.24 -    printk("PAE disabled.\n");
   33.25 -#endif
   33.26 -
   33.27      if ( cpu_has_pge )
   33.28      {
   33.29          /* Suitable Xen mapping can be GLOBAL. */
    34.1 --- a/xen/arch/x86/x86_32/traps.c	Thu May 08 13:40:40 2008 +0100
    34.2 +++ b/xen/arch/x86/x86_32/traps.c	Thu May 08 14:32:11 2008 +0100
    34.3 @@ -21,16 +21,12 @@
    34.4  static void print_xen_info(void)
    34.5  {
    34.6      char taint_str[TAINT_STRING_MAX_LEN];
    34.7 -    char debug = 'n', *arch = "x86_32";
    34.8 +    char debug = 'n', *arch = "x86_32p";
    34.9  
   34.10  #ifndef NDEBUG
   34.11      debug = 'y';
   34.12  #endif
   34.13  
   34.14 -#ifdef CONFIG_X86_PAE
   34.15 -    arch = "x86_32p";
   34.16 -#endif
   34.17 -
   34.18      printk("----[ Xen-%d.%d%s  %s  debug=%c  %s ]----\n",
   34.19             xen_major_version(), xen_minor_version(), xen_extra_version(),
   34.20             arch, debug, print_tainted(taint_str));
   34.21 @@ -117,9 +113,7 @@ void show_registers(struct cpu_user_regs
   34.22  void show_page_walk(unsigned long addr)
   34.23  {
   34.24      unsigned long pfn, mfn, cr3 = read_cr3();
   34.25 -#ifdef CONFIG_X86_PAE
   34.26      l3_pgentry_t l3e, *l3t;
   34.27 -#endif
   34.28      l2_pgentry_t l2e, *l2t;
   34.29      l1_pgentry_t l1e, *l1t;
   34.30  
   34.31 @@ -127,7 +121,6 @@ void show_page_walk(unsigned long addr)
   34.32  
   34.33      mfn = cr3 >> PAGE_SHIFT;
   34.34  
   34.35 -#ifdef CONFIG_X86_PAE
   34.36      l3t  = map_domain_page(mfn);
   34.37      l3t += (cr3 & 0xFE0UL) >> 3;
   34.38      l3e = l3t[l3_table_offset(addr)];
   34.39 @@ -138,7 +131,6 @@ void show_page_walk(unsigned long addr)
   34.40      unmap_domain_page(l3t);
   34.41      if ( !(l3e_get_flags(l3e) & _PAGE_PRESENT) )
   34.42          return;
   34.43 -#endif
   34.44  
   34.45      l2t = map_domain_page(mfn);
   34.46      l2e = l2t[l2_table_offset(addr)];
    35.1 --- a/xen/include/asm-x86/config.h	Thu May 08 13:40:40 2008 +0100
    35.2 +++ b/xen/include/asm-x86/config.h	Thu May 08 14:32:11 2008 +0100
    35.3 @@ -9,10 +9,8 @@
    35.4  
    35.5  #if defined(__x86_64__)
    35.6  # define CONFIG_PAGING_LEVELS 4
    35.7 -#elif defined(CONFIG_X86_PAE)
    35.8 +#else
    35.9  # define CONFIG_PAGING_LEVELS 3
   35.10 -#else
   35.11 -# define CONFIG_PAGING_LEVELS 2
   35.12  #endif
   35.13  
   35.14  #define CONFIG_X86 1
   35.15 @@ -274,17 +272,17 @@ extern unsigned int video_mode, video_fl
   35.16  #define asmlinkage __attribute__((regparm(0)))
   35.17  
   35.18  /*
   35.19 - * Memory layout (high to low):                          SIZE   PAE-SIZE
   35.20 - *                                                       ------ ------
   35.21 + * Memory layout (high to low):                          PAE-SIZE
   35.22 + *                                                       ------
   35.23   *  I/O remapping area                                   ( 4MB)
   35.24   *  Direct-map (1:1) area [Xen code/data/heap]           (12MB)
   35.25   *  Per-domain mappings (inc. 4MB map_domain_page cache) ( 8MB)
   35.26 - *  Shadow linear pagetable                              ( 4MB) ( 8MB)
   35.27 - *  Guest linear pagetable                               ( 4MB) ( 8MB)
   35.28 - *  Machine-to-physical translation table [writable]     ( 4MB) (16MB)
   35.29 - *  Frame-info table                                     (24MB) (96MB)
   35.30 + *  Shadow linear pagetable                              ( 8MB)
   35.31 + *  Guest linear pagetable                               ( 8MB)
   35.32 + *  Machine-to-physical translation table [writable]     (16MB)
   35.33 + *  Frame-info table                                     (96MB)
   35.34   *   * Start of guest inaccessible area
   35.35 - *  Machine-to-physical translation table [read-only]    ( 4MB) (16MB)
   35.36 + *  Machine-to-physical translation table [read-only]    (16MB)
   35.37   *   * Start of guest unmodifiable area
   35.38   */
   35.39  
   35.40 @@ -293,15 +291,9 @@ extern unsigned int video_mode, video_fl
   35.41  #define MAPCACHE_MBYTES          4
   35.42  #define PERDOMAIN_MBYTES         8
   35.43  
   35.44 -#ifdef CONFIG_X86_PAE
   35.45 -# define LINEARPT_MBYTES         8
   35.46 -# define MACHPHYS_MBYTES        16 /* 1 MB needed per 1 GB memory */
   35.47 -# define FRAMETABLE_MBYTES (MACHPHYS_MBYTES * 6)
   35.48 -#else
   35.49 -# define LINEARPT_MBYTES         4
   35.50 -# define MACHPHYS_MBYTES         4
   35.51 -# define FRAMETABLE_MBYTES      24
   35.52 -#endif
   35.53 +#define LINEARPT_MBYTES          8
   35.54 +#define MACHPHYS_MBYTES         16 /* 1 MB needed per 1 GB memory */
   35.55 +#define FRAMETABLE_MBYTES       (MACHPHYS_MBYTES * 6)
   35.56  
   35.57  #define IOREMAP_VIRT_END	0UL
   35.58  #define IOREMAP_VIRT_START	(IOREMAP_VIRT_END - (IOREMAP_MBYTES<<20))
   35.59 @@ -328,13 +320,8 @@ extern unsigned int video_mode, video_fl
   35.60  /* Maximum linear address accessible via guest memory segments. */
   35.61  #define GUEST_SEGMENT_MAX_ADDR  RO_MPT_VIRT_END
   35.62  
   35.63 -#ifdef CONFIG_X86_PAE
   35.64  /* Hypervisor owns top 168MB of virtual address space. */
   35.65  #define HYPERVISOR_VIRT_START   mk_unsigned_long(0xF5800000)
   35.66 -#else
   35.67 -/* Hypervisor owns top 64MB of virtual address space. */
   35.68 -#define HYPERVISOR_VIRT_START   mk_unsigned_long(0xFC000000)
   35.69 -#endif
   35.70  
   35.71  #define L2_PAGETABLE_FIRST_XEN_SLOT \
   35.72      (HYPERVISOR_VIRT_START >> L2_PAGETABLE_SHIFT)
   35.73 @@ -343,11 +330,7 @@ extern unsigned int video_mode, video_fl
   35.74  #define L2_PAGETABLE_XEN_SLOTS \
   35.75      (L2_PAGETABLE_LAST_XEN_SLOT - L2_PAGETABLE_FIRST_XEN_SLOT + 1)
   35.76  
   35.77 -#ifdef CONFIG_X86_PAE
   35.78 -# define PGT_base_page_table     PGT_l3_page_table
   35.79 -#else
   35.80 -# define PGT_base_page_table     PGT_l2_page_table
   35.81 -#endif
   35.82 +#define PGT_base_page_table     PGT_l3_page_table
   35.83  
   35.84  #define __HYPERVISOR_CS 0xe008
   35.85  #define __HYPERVISOR_DS 0xe010
    36.1 --- a/xen/include/asm-x86/domain.h	Thu May 08 13:40:40 2008 +0100
    36.2 +++ b/xen/include/asm-x86/domain.h	Thu May 08 14:32:11 2008 +0100
    36.3 @@ -255,7 +255,7 @@ struct arch_domain
    36.4      cpuid_input_t cpuids[MAX_CPUID_INPUT];
    36.5  } __cacheline_aligned;
    36.6  
    36.7 -#ifdef CONFIG_X86_PAE
    36.8 +#ifdef __i386__
    36.9  struct pae_l3_cache {
   36.10      /*
   36.11       * Two low-memory (<4GB) PAE L3 tables, used as fallback when the guest
   36.12 @@ -269,7 +269,7 @@ struct pae_l3_cache {
   36.13      spinlock_t    lock;
   36.14  };
   36.15  #define pae_l3_cache_init(c) spin_lock_init(&(c)->lock)
   36.16 -#else /* !CONFIG_X86_PAE */
   36.17 +#else /* !defined(__i386__) */
   36.18  struct pae_l3_cache { };
   36.19  #define pae_l3_cache_init(c) ((void)0)
   36.20  #endif
    37.1 --- a/xen/include/asm-x86/fixmap.h	Thu May 08 13:40:40 2008 +0100
    37.2 +++ b/xen/include/asm-x86/fixmap.h	Thu May 08 14:32:11 2008 +0100
    37.3 @@ -29,7 +29,7 @@
    37.4   * from the end of virtual memory backwards.
    37.5   */
    37.6  enum fixed_addresses {
    37.7 -#ifdef CONFIG_X86_PAE
    37.8 +#ifdef __i386__
    37.9      FIX_PAE_HIGHMEM_0,
   37.10      FIX_PAE_HIGHMEM_END = FIX_PAE_HIGHMEM_0 + NR_CPUS-1,
   37.11  #endif
    38.1 --- a/xen/include/asm-x86/mm.h	Thu May 08 13:40:40 2008 +0100
    38.2 +++ b/xen/include/asm-x86/mm.h	Thu May 08 14:32:11 2008 +0100
    38.3 @@ -122,11 +122,7 @@ static inline u32 pickle_domptr(struct d
    38.4  #endif
    38.5  
    38.6  /* The order of the largest allocation unit we use for shadow pages */
    38.7 -#if CONFIG_PAGING_LEVELS == 2
    38.8 -#define SHADOW_MAX_ORDER 0 /* Only ever need 4k allocations */
    38.9 -#else  
   38.10  #define SHADOW_MAX_ORDER 2 /* Need up to 16k allocs for 32-bit on PAE/64 */
   38.11 -#endif
   38.12  
   38.13  #define page_get_owner(_p)    (unpickle_domptr((_p)->u.inuse._domain))
   38.14  #define page_set_owner(_p,_d) ((_p)->u.inuse._domain = pickle_domptr(_d))
    39.1 --- a/xen/include/asm-x86/page.h	Thu May 08 13:40:40 2008 +0100
    39.2 +++ b/xen/include/asm-x86/page.h	Thu May 08 14:32:11 2008 +0100
    39.3 @@ -123,13 +123,11 @@ static inline l2_pgentry_t l2e_from_padd
    39.4      ASSERT((pa & ~(PADDR_MASK & PAGE_MASK)) == 0);
    39.5      return (l2_pgentry_t) { pa | put_pte_flags(flags) };
    39.6  }
    39.7 -#if CONFIG_PAGING_LEVELS >= 3
    39.8  static inline l3_pgentry_t l3e_from_paddr(paddr_t pa, unsigned int flags)
    39.9  {
   39.10      ASSERT((pa & ~(PADDR_MASK & PAGE_MASK)) == 0);
   39.11      return (l3_pgentry_t) { pa | put_pte_flags(flags) };
   39.12  }
   39.13 -#endif
   39.14  #if CONFIG_PAGING_LEVELS >= 4
   39.15  static inline l4_pgentry_t l4e_from_paddr(paddr_t pa, unsigned int flags)
   39.16  {
   39.17 @@ -195,10 +193,7 @@ static inline l4_pgentry_t l4e_from_padd
   39.18  #ifndef __ASSEMBLY__
   39.19  
   39.20  /* Page-table type. */
   39.21 -#if CONFIG_PAGING_LEVELS == 2
   39.22 -/* x86_32 default */
   39.23 -typedef struct { u32 pfn; } pagetable_t;
   39.24 -#elif CONFIG_PAGING_LEVELS == 3
   39.25 +#if CONFIG_PAGING_LEVELS == 3
   39.26  /* x86_32 PAE */
   39.27  typedef struct { u32 pfn; } pagetable_t;
   39.28  #elif CONFIG_PAGING_LEVELS == 4
   39.29 @@ -251,12 +246,6 @@ void clear_page_sse2(void *);
   39.30  #endif /* !defined(__ASSEMBLY__) */
   39.31  
   39.32  /* High table entries are reserved by the hypervisor. */
   39.33 -#if defined(CONFIG_X86_32) && !defined(CONFIG_X86_PAE)
   39.34 -#define DOMAIN_ENTRIES_PER_L2_PAGETABLE     \
   39.35 -  (HYPERVISOR_VIRT_START >> L2_PAGETABLE_SHIFT)
   39.36 -#define HYPERVISOR_ENTRIES_PER_L2_PAGETABLE \
   39.37 -  (L2_PAGETABLE_ENTRIES - DOMAIN_ENTRIES_PER_L2_PAGETABLE)
   39.38 -#else
   39.39  #define DOMAIN_ENTRIES_PER_L2_PAGETABLE     0
   39.40  #define HYPERVISOR_ENTRIES_PER_L2_PAGETABLE 0
   39.41  
   39.42 @@ -267,7 +256,6 @@ void clear_page_sse2(void *);
   39.43  #define HYPERVISOR_ENTRIES_PER_L4_PAGETABLE \
   39.44      (L4_PAGETABLE_ENTRIES - GUEST_ENTRIES_PER_L4_PAGETABLE  \
   39.45       + DOMAIN_ENTRIES_PER_L4_PAGETABLE)
   39.46 -#endif
   39.47  
   39.48  /* Where to find each level of the linear mapping */
   39.49  #define __linear_l1_table ((l1_pgentry_t *)(LINEAR_PT_VIRT_START))
   39.50 @@ -284,8 +272,6 @@ extern root_pgentry_t idle_pg_table[ROOT
   39.51  #if CONFIG_PAGING_LEVELS == 3
   39.52  extern l2_pgentry_t   idle_pg_table_l2[
   39.53      ROOT_PAGETABLE_ENTRIES * L2_PAGETABLE_ENTRIES];
   39.54 -#elif CONFIG_PAGING_LEVELS == 2
   39.55 -#define idle_pg_table_l2 idle_pg_table
   39.56  #elif CONFIG_PAGING_LEVELS == 4
   39.57  extern l2_pgentry_t  *compat_idle_pg_table_l2;
   39.58  extern unsigned int   m2p_compat_vstart;
    40.1 --- a/xen/include/asm-x86/types.h	Thu May 08 13:40:40 2008 +0100
    40.2 +++ b/xen/include/asm-x86/types.h	Thu May 08 14:32:11 2008 +0100
    40.3 @@ -36,15 +36,9 @@ typedef unsigned int u32;
    40.4  #if defined(__i386__)
    40.5  typedef signed long long s64;
    40.6  typedef unsigned long long u64;
    40.7 -#if defined(CONFIG_X86_PAE)
    40.8  typedef u64 paddr_t;
    40.9  #define INVALID_PADDR (~0ULL)
   40.10  #define PRIpaddr "016llx"
   40.11 -#else
   40.12 -typedef unsigned long paddr_t;
   40.13 -#define INVALID_PADDR (~0UL)
   40.14 -#define PRIpaddr "08lx"
   40.15 -#endif
   40.16  #elif defined(__x86_64__)
   40.17  typedef signed long s64;
   40.18  typedef unsigned long u64;
    41.1 --- a/xen/include/asm-x86/x86_32/page-2level.h	Thu May 08 13:40:40 2008 +0100
    41.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.3 @@ -1,60 +0,0 @@
    41.4 -#ifndef __X86_32_PAGE_2LEVEL_H__
    41.5 -#define __X86_32_PAGE_2LEVEL_H__
    41.6 -
    41.7 -#define L1_PAGETABLE_SHIFT      12
    41.8 -#define L2_PAGETABLE_SHIFT      22
    41.9 -#define PAGE_SHIFT              L1_PAGETABLE_SHIFT
   41.10 -#define ROOT_PAGETABLE_SHIFT    L2_PAGETABLE_SHIFT
   41.11 -
   41.12 -#define PAGETABLE_ORDER         10
   41.13 -#define L1_PAGETABLE_ENTRIES    (1<<PAGETABLE_ORDER)
   41.14 -#define L2_PAGETABLE_ENTRIES    (1<<PAGETABLE_ORDER)
   41.15 -#define ROOT_PAGETABLE_ENTRIES  L2_PAGETABLE_ENTRIES
   41.16 -
   41.17 -#define PADDR_BITS              32
   41.18 -#define PADDR_MASK              (~0UL)
   41.19 -
   41.20 -#ifndef __ASSEMBLY__
   41.21 -
   41.22 -#include <asm/types.h>
   41.23 -
   41.24 -/* read access (should only be used for debug printk's) */
   41.25 -typedef u32 intpte_t;
   41.26 -#define PRIpte "08x"
   41.27 -
   41.28 -typedef struct { intpte_t l1; } l1_pgentry_t;
   41.29 -typedef struct { intpte_t l2; } l2_pgentry_t;
   41.30 -typedef l2_pgentry_t root_pgentry_t;
   41.31 -
   41.32 -#endif /* !__ASSEMBLY__ */
   41.33 -
   41.34 -#define pte_read_atomic(ptep)       (*(ptep))
   41.35 -#define pte_write_atomic(ptep, pte) (*(ptep) = (pte))
   41.36 -#define pte_write(ptep, pte)        (*(ptep) = (pte))
   41.37 -
   41.38 -/* root table */
   41.39 -#define root_get_pfn              l2e_get_pfn
   41.40 -#define root_get_flags            l2e_get_flags
   41.41 -#define root_get_intpte           l2e_get_intpte
   41.42 -#define root_empty                l2e_empty
   41.43 -#define root_from_paddr           l2e_from_paddr
   41.44 -#define PGT_root_page_table       PGT_l2_page_table
   41.45 -
   41.46 -/* misc */
   41.47 -#define is_guest_l1_slot(_s)    (1)
   41.48 -#define is_guest_l2_slot(_d, _t,_s) ((_s) < L2_PAGETABLE_FIRST_XEN_SLOT)
   41.49 -
   41.50 -/*
   41.51 - * PTE pfn and flags:
   41.52 - *  20-bit pfn   = (pte[31:12])
   41.53 - *  12-bit flags = (pte[11:0])
   41.54 - */
   41.55 -
   41.56 -#define _PAGE_NX_BIT            0U
   41.57 -#define _PAGE_NX                0U
   41.58 -
   41.59 -/* Extract flags into 12-bit integer, or turn 12-bit flags into a pte mask. */
   41.60 -#define get_pte_flags(x) ((int)(x) & 0xFFF)
   41.61 -#define put_pte_flags(x) ((intpte_t)((x) & 0xFFF))
   41.62 -
   41.63 -#endif /* __X86_32_PAGE_2LEVEL_H__ */
    42.1 --- a/xen/include/asm-x86/x86_32/page-3level.h	Thu May 08 13:40:40 2008 +0100
    42.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.3 @@ -1,90 +0,0 @@
    42.4 -#ifndef __X86_32_PAGE_3LEVEL_H__
    42.5 -#define __X86_32_PAGE_3LEVEL_H__
    42.6 -
    42.7 -#define L1_PAGETABLE_SHIFT      12
    42.8 -#define L2_PAGETABLE_SHIFT      21
    42.9 -#define L3_PAGETABLE_SHIFT      30
   42.10 -#define PAGE_SHIFT              L1_PAGETABLE_SHIFT
   42.11 -#define ROOT_PAGETABLE_SHIFT    L3_PAGETABLE_SHIFT
   42.12 -
   42.13 -#define PAGETABLE_ORDER         9
   42.14 -#define L1_PAGETABLE_ENTRIES    (1<<PAGETABLE_ORDER)
   42.15 -#define L2_PAGETABLE_ENTRIES    (1<<PAGETABLE_ORDER)
   42.16 -#define L3_PAGETABLE_ENTRIES    4
   42.17 -#define ROOT_PAGETABLE_ENTRIES  L3_PAGETABLE_ENTRIES
   42.18 -
   42.19 -/*
   42.20 - * Architecturally, physical addresses may be up to 52 bits. However, the
   42.21 - * page-frame number (pfn) of a 52-bit address will not fit into a 32-bit
   42.22 - * word. Instead we treat bits 44-51 of a pte as flag bits which are never
   42.23 - * allowed to be set by a guest kernel. This 'limits' us to addressing 16TB
   42.24 - * of physical memory on a 32-bit PAE system.
   42.25 - */
   42.26 -#define PADDR_BITS              44
   42.27 -#define PADDR_MASK              ((1ULL << PADDR_BITS)-1)
   42.28 -
   42.29 -#ifndef __ASSEMBLY__
   42.30 -
   42.31 -#include <asm/types.h>
   42.32 -
   42.33 -/* read access (should only be used for debug printk's) */
   42.34 -typedef u64 intpte_t;
   42.35 -#define PRIpte "016llx"
   42.36 -
   42.37 -typedef struct { intpte_t l1; } l1_pgentry_t;
   42.38 -typedef struct { intpte_t l2; } l2_pgentry_t;
   42.39 -typedef struct { intpte_t l3; } l3_pgentry_t;
   42.40 -typedef l3_pgentry_t root_pgentry_t;
   42.41 -
   42.42 -#endif /* !__ASSEMBLY__ */
   42.43 -
   42.44 -#define pte_read_atomic(ptep) ({                              \
   42.45 -    intpte_t __pte = *(ptep), __npte;                         \
   42.46 -    while ( (__npte = cmpxchg(ptep, __pte, __pte)) != __pte ) \
   42.47 -        __pte = __npte;                                       \
   42.48 -    __pte; })
   42.49 -#define pte_write_atomic(ptep, pte) do {                      \
   42.50 -    intpte_t __pte = *(ptep), __npte;                         \
   42.51 -    while ( (__npte = cmpxchg(ptep, __pte, (pte))) != __pte ) \
   42.52 -        __pte = __npte;                                       \
   42.53 -} while ( 0 )
   42.54 -#define pte_write(ptep, pte) do {                             \
   42.55 -    u32 *__ptep_words = (u32 *)(ptep);                        \
   42.56 -    __ptep_words[0] = 0;                                      \
   42.57 -    wmb();                                                    \
   42.58 -    __ptep_words[1] = (pte) >> 32;                            \
   42.59 -    wmb();                                                    \
   42.60 -    __ptep_words[0] = (pte) >>  0;                            \
   42.61 -} while ( 0 )
   42.62 -
   42.63 -/* root table */
   42.64 -#define root_get_pfn              l3e_get_pfn
   42.65 -#define root_get_flags            l3e_get_flags
   42.66 -#define root_get_intpte           l3e_get_intpte
   42.67 -#define root_empty                l3e_empty
   42.68 -#define root_from_paddr           l3e_from_paddr
   42.69 -#define PGT_root_page_table       PGT_l3_page_table
   42.70 -
   42.71 -/* misc */
   42.72 -#define is_guest_l1_slot(s)    (1)
   42.73 -#define is_guest_l2_slot(d,t,s)                                            \
   42.74 -    ( !((t) & PGT_pae_xen_l2) ||                                           \
   42.75 -      ((s) < (L2_PAGETABLE_FIRST_XEN_SLOT & (L2_PAGETABLE_ENTRIES - 1))) )
   42.76 -#define is_guest_l3_slot(s)    (1)
   42.77 -
   42.78 -/*
   42.79 - * PTE pfn and flags:
   42.80 - *  32-bit pfn   = (pte[43:12])
   42.81 - *  32-bit flags = (pte[63:44],pte[11:0])
   42.82 - */
   42.83 -
   42.84 -#define _PAGE_NX_BIT (1U<<31)
   42.85 -#define _PAGE_NX     (cpu_has_nx ? _PAGE_NX_BIT : 0)
   42.86 -
   42.87 -/* Extract flags into 32-bit integer, or turn 32-bit flags into a pte mask. */
   42.88 -#define get_pte_flags(x) (((int)((x) >> 32) & ~0xFFF) | ((int)(x) & 0xFFF))
   42.89 -#define put_pte_flags(x) (((intpte_t)((x) & ~0xFFF) << 32) | ((x) & 0xFFF))
   42.90 -
   42.91 -#define L3_DISALLOW_MASK 0xFFFFF1FEU /* must-be-zero */
   42.92 -
   42.93 -#endif /* __X86_32_PAGE_3LEVEL_H__ */
    43.1 --- a/xen/include/asm-x86/x86_32/page.h	Thu May 08 13:40:40 2008 +0100
    43.2 +++ b/xen/include/asm-x86/x86_32/page.h	Thu May 08 14:32:11 2008 +0100
    43.3 @@ -2,6 +2,28 @@
    43.4  #ifndef __X86_32_PAGE_H__
    43.5  #define __X86_32_PAGE_H__
    43.6  
    43.7 +#define L1_PAGETABLE_SHIFT      12
    43.8 +#define L2_PAGETABLE_SHIFT      21
    43.9 +#define L3_PAGETABLE_SHIFT      30
   43.10 +#define PAGE_SHIFT              L1_PAGETABLE_SHIFT
   43.11 +#define ROOT_PAGETABLE_SHIFT    L3_PAGETABLE_SHIFT
   43.12 +
   43.13 +#define PAGETABLE_ORDER         9
   43.14 +#define L1_PAGETABLE_ENTRIES    (1<<PAGETABLE_ORDER)
   43.15 +#define L2_PAGETABLE_ENTRIES    (1<<PAGETABLE_ORDER)
   43.16 +#define L3_PAGETABLE_ENTRIES    4
   43.17 +#define ROOT_PAGETABLE_ENTRIES  L3_PAGETABLE_ENTRIES
   43.18 +
   43.19 +/*
   43.20 + * Architecturally, physical addresses may be up to 52 bits. However, the
   43.21 + * page-frame number (pfn) of a 52-bit address will not fit into a 32-bit
   43.22 + * word. Instead we treat bits 44-51 of a pte as flag bits which are never
   43.23 + * allowed to be set by a guest kernel. This 'limits' us to addressing 16TB
   43.24 + * of physical memory on a 32-bit PAE system.
   43.25 + */
   43.26 +#define PADDR_BITS              44
   43.27 +#define PADDR_MASK              ((1ULL << PADDR_BITS)-1)
   43.28 +
   43.29  #define __PAGE_OFFSET           (0xFF000000)
   43.30  #define __XEN_VIRT_START        __PAGE_OFFSET
   43.31  
   43.32 @@ -13,22 +35,76 @@
   43.33  
   43.34  #define is_canonical_address(x) 1
   43.35  
   43.36 -#include <xen/config.h>
   43.37 -#ifdef CONFIG_X86_PAE
   43.38 -# include <asm/x86_32/page-3level.h>
   43.39 -#else
   43.40 -# include <asm/x86_32/page-2level.h>
   43.41 -#endif
   43.42 -
   43.43  /* Given a virtual address, get an entry offset into a linear page table. */
   43.44  #define l1_linear_offset(_a) ((_a) >> L1_PAGETABLE_SHIFT)
   43.45  #define l2_linear_offset(_a) ((_a) >> L2_PAGETABLE_SHIFT)
   43.46  
   43.47  #ifndef __ASSEMBLY__
   43.48 +
   43.49 +#include <xen/config.h>
   43.50 +#include <asm/types.h>
   43.51 +
   43.52 +/* read access (should only be used for debug printk's) */
   43.53 +typedef u64 intpte_t;
   43.54 +#define PRIpte "016llx"
   43.55 +
   43.56 +typedef struct { intpte_t l1; } l1_pgentry_t;
   43.57 +typedef struct { intpte_t l2; } l2_pgentry_t;
   43.58 +typedef struct { intpte_t l3; } l3_pgentry_t;
   43.59 +typedef l3_pgentry_t root_pgentry_t;
   43.60 +
   43.61  extern unsigned int PAGE_HYPERVISOR;
   43.62  extern unsigned int PAGE_HYPERVISOR_NOCACHE;
   43.63 +
   43.64  #endif
   43.65  
   43.66 +#define pte_read_atomic(ptep) ({                              \
   43.67 +    intpte_t __pte = *(ptep), __npte;                         \
   43.68 +    while ( (__npte = cmpxchg(ptep, __pte, __pte)) != __pte ) \
   43.69 +        __pte = __npte;                                       \
   43.70 +    __pte; })
   43.71 +#define pte_write_atomic(ptep, pte) do {                      \
   43.72 +    intpte_t __pte = *(ptep), __npte;                         \
   43.73 +    while ( (__npte = cmpxchg(ptep, __pte, (pte))) != __pte ) \
   43.74 +        __pte = __npte;                                       \
   43.75 +} while ( 0 )
   43.76 +#define pte_write(ptep, pte) do {                             \
   43.77 +    u32 *__ptep_words = (u32 *)(ptep);                        \
   43.78 +    __ptep_words[0] = 0;                                      \
   43.79 +    wmb();                                                    \
   43.80 +    __ptep_words[1] = (pte) >> 32;                            \
   43.81 +    wmb();                                                    \
   43.82 +    __ptep_words[0] = (pte) >>  0;                            \
   43.83 +} while ( 0 )
   43.84 +
   43.85 +/* root table */
   43.86 +#define root_get_pfn              l3e_get_pfn
   43.87 +#define root_get_flags            l3e_get_flags
   43.88 +#define root_get_intpte           l3e_get_intpte
   43.89 +#define root_empty                l3e_empty
   43.90 +#define root_from_paddr           l3e_from_paddr
   43.91 +#define PGT_root_page_table       PGT_l3_page_table
   43.92 +
   43.93 +/* misc */
   43.94 +#define is_guest_l1_slot(s)    (1)
   43.95 +#define is_guest_l2_slot(d,t,s)                                            \
   43.96 +    ( !((t) & PGT_pae_xen_l2) ||                                           \
   43.97 +      ((s) < (L2_PAGETABLE_FIRST_XEN_SLOT & (L2_PAGETABLE_ENTRIES - 1))) )
   43.98 +#define is_guest_l3_slot(s)    (1)
   43.99 +
  43.100 +/*
  43.101 + * PTE pfn and flags:
  43.102 + *  32-bit pfn   = (pte[43:12])
  43.103 + *  32-bit flags = (pte[63:44],pte[11:0])
  43.104 + */
  43.105 +
  43.106 +#define _PAGE_NX_BIT (1U<<31)
  43.107 +#define _PAGE_NX     (cpu_has_nx ? _PAGE_NX_BIT : 0)
  43.108 +
  43.109 +/* Extract flags into 32-bit integer, or turn 32-bit flags into a pte mask. */
  43.110 +#define get_pte_flags(x) (((int)((x) >> 32) & ~0xFFF) | ((int)(x) & 0xFFF))
  43.111 +#define put_pte_flags(x) (((intpte_t)((x) & ~0xFFF) << 32) | ((x) & 0xFFF))
  43.112 +
  43.113  #define GRANT_PTE_FLAGS \
  43.114      (_PAGE_PRESENT|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_GNTTAB)
  43.115  
  43.116 @@ -40,6 +116,7 @@ extern unsigned int PAGE_HYPERVISOR_NOCA
  43.117  
  43.118  #define L1_DISALLOW_MASK (BASE_DISALLOW_MASK | _PAGE_GNTTAB)
  43.119  #define L2_DISALLOW_MASK (BASE_DISALLOW_MASK)
  43.120 +#define L3_DISALLOW_MASK 0xFFFFF1FEU /* must-be-zero */
  43.121  
  43.122  #endif /* __X86_32_PAGE_H__ */
  43.123  
    44.1 --- a/xen/include/public/arch-x86/xen-x86_32.h	Thu May 08 13:40:40 2008 +0100
    44.2 +++ b/xen/include/public/arch-x86/xen-x86_32.h	Thu May 08 14:32:11 2008 +0100
    44.3 @@ -74,6 +74,7 @@
    44.4  #define MACH2PHYS_VIRT_END_PAE         \
    44.5      mk_unsigned_long(__MACH2PHYS_VIRT_END_PAE)
    44.6  
    44.7 +/* Non-PAE bounds are obsolete. */
    44.8  #define __HYPERVISOR_VIRT_START_NONPAE 0xFC000000
    44.9  #define __MACH2PHYS_VIRT_START_NONPAE  0xFC000000
   44.10  #define __MACH2PHYS_VIRT_END_NONPAE    0xFC400000
   44.11 @@ -84,15 +85,9 @@
   44.12  #define MACH2PHYS_VIRT_END_NONPAE      \
   44.13      mk_unsigned_long(__MACH2PHYS_VIRT_END_NONPAE)
   44.14  
   44.15 -#ifdef CONFIG_X86_PAE
   44.16  #define __HYPERVISOR_VIRT_START __HYPERVISOR_VIRT_START_PAE
   44.17  #define __MACH2PHYS_VIRT_START  __MACH2PHYS_VIRT_START_PAE
   44.18  #define __MACH2PHYS_VIRT_END    __MACH2PHYS_VIRT_END_PAE
   44.19 -#else
   44.20 -#define __HYPERVISOR_VIRT_START __HYPERVISOR_VIRT_START_NONPAE
   44.21 -#define __MACH2PHYS_VIRT_START  __MACH2PHYS_VIRT_START_NONPAE
   44.22 -#define __MACH2PHYS_VIRT_END    __MACH2PHYS_VIRT_END_NONPAE
   44.23 -#endif
   44.24  
   44.25  #ifndef HYPERVISOR_VIRT_START
   44.26  #define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START)