Index: linux-2.6.11/include/asm-xen/hypervisor.h =================================================================== --- linux-2.6.11.orig/include/asm-xen/hypervisor.h 2005-07-06 17:38:03.000000000 +0200 +++ linux-2.6.11/include/asm-xen/hypervisor.h 2005-07-06 17:41:02.000000000 +0200 @@ -40,9 +40,13 @@ #include #include #if defined(__i386__) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -#include -#endif +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) +# ifdef CONFIG_X86_PAE +# include +# else +# include +# endif +# endif #endif /* arch/xen/i386/kernel/setup.c */ @@ -80,11 +84,9 @@ void xen_tlb_flush(void); void xen_invlpg(unsigned long ptr); #ifndef CONFIG_XEN_SHADOW_MODE -void xen_l1_entry_update(pte_t *ptr, unsigned long val); +void xen_l1_entry_update(pte_t *ptr, pte_t val); void xen_l2_entry_update(pmd_t *ptr, pmd_t val); -#ifdef __x86_64__ -void xen_l3_entry_update(pud_t *ptr, pud_t val); /* x86_64 only */ -#endif +void xen_l3_entry_update(pud_t *ptr, pud_t val); /* x86_64/PAE */ void xen_l4_entry_update(pgd_t *ptr, pgd_t val); /* x86_64 only */ void xen_pgd_pin(unsigned long ptr); void xen_pgd_unpin(unsigned long ptr); Index: linux-2.6.11/arch/xen/i386/mm/hypervisor.c =================================================================== --- linux-2.6.11.orig/arch/xen/i386/mm/hypervisor.c 2005-07-06 17:38:03.000000000 +0200 +++ linux-2.6.11/arch/xen/i386/mm/hypervisor.c 2005-07-06 17:41:02.000000000 +0200 @@ -47,15 +47,20 @@ #elif defined(CONFIG_X86_64) #define pmd_val_ma(v) (v).pmd #else -#define pmd_val_ma(v) (v).pud.pgd.pgd +#ifdef CONFIG_X86_PAE +# define pmd_val_ma(v) ((v).pmd) +# define pud_val_ma(v) ((v).pgd.pgd) +#else +# define pmd_val_ma(v) ((v).pud.pgd.pgd) +#endif #endif #ifndef CONFIG_XEN_SHADOW_MODE -void xen_l1_entry_update(pte_t *ptr, unsigned long val) +void xen_l1_entry_update(pte_t *ptr, pte_t val) { mmu_update_t u; u.ptr = virt_to_machine(ptr); - u.val = val; + u.val = pte_val_ma(val); BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF) < 0); } @@ -64,9 +69,21 @@ void xen_l2_entry_update(pmd_t *ptr, pmd mmu_update_t u; u.ptr = virt_to_machine(ptr); u.val = pmd_val_ma(val); +// printk("%s: pmd %p (%lx) val %llx\n",__FUNCTION__,ptr,u.ptr,(u64)pmd_val_ma(val)); BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF) < 0); } +#ifdef CONFIG_X86_PAE +void xen_l3_entry_update(pud_t *ptr, pud_t val) +{ + mmu_update_t u; + u.ptr = virt_to_machine(ptr); + u.val = pud_val_ma(val); +// printk("%s: pud %p (%lx) val %llx\n",__FUNCTION__,ptr,u.ptr,(u64)pud_val_ma(val)); + BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF) < 0); +} +#endif + #ifdef CONFIG_X86_64 void xen_l3_entry_update(pud_t *ptr, pud_t val) { @@ -171,11 +188,17 @@ void xen_pgd_pin(unsigned long ptr) struct mmuext_op op; #ifdef CONFIG_X86_64 op.cmd = MMUEXT_PIN_L4_TABLE; +#elif defined(CONFIG_X86_PAE) + op.cmd = MMUEXT_PIN_L3_TABLE; #else op.cmd = MMUEXT_PIN_L2_TABLE; #endif op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT); - BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); +// BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); + if (0 == HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF)) + return; + printk("%s: %s (%d)\n", __FUNCTION__, current->comm, current->pid); + BUG(); } void xen_pgd_unpin(unsigned long ptr) Index: linux-2.6.11/include/asm-xen/asm-i386/pgtable.h =================================================================== --- linux-2.6.11.orig/include/asm-xen/asm-i386/pgtable.h 2005-07-06 17:38:03.000000000 +0200 +++ linux-2.6.11/include/asm-xen/asm-i386/pgtable.h 2005-07-06 17:41:02.000000000 +0200 @@ -406,7 +406,7 @@ extern void noexec_setup(const char *str if ( likely((__vma)->vm_mm == current->mm) ) { \ HYPERVISOR_update_va_mapping((__address), (__entry), UVMF_INVLPG|UVMF_MULTI|(unsigned long)((__vma)->vm_mm->cpu_vm_mask.bits)); \ } else { \ - xen_l1_entry_update((__ptep), (__entry).pte_low); \ + xen_l1_entry_update((__ptep), (__entry)); \ flush_tlb_page((__vma), (__address)); \ } \ } \ @@ -425,7 +425,7 @@ do { \ HYPERVISOR_update_va_mapping((__address), \ __entry, 0); \ } else { \ - xen_l1_entry_update((__ptep), (__entry).pte_low); \ + xen_l1_entry_update((__ptep), (__entry)); \ } \ } while (0)