diff options
Diffstat (limited to 'linux-2.6-xen-sparse/include')
-rw-r--r-- | linux-2.6-xen-sparse/include/asm-xen/asm-i386/page.h | 60 | ||||
-rw-r--r-- | linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h | 4 | ||||
-rw-r--r-- | linux-2.6-xen-sparse/include/asm-xen/hypervisor.h | 16 |
3 files changed, 57 insertions, 23 deletions
diff --git a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/page.h b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/page.h index af8ccd4652..f696989209 100644 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/page.h +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/page.h @@ -15,6 +15,8 @@ #include <linux/config.h> #include <linux/string.h> #include <linux/types.h> +#include <linux/kernel.h> +#include <asm/bug.h> #include <asm-xen/xen-public/xen.h> #include <asm-xen/foreign_page.h> @@ -84,9 +86,40 @@ typedef struct { unsigned long pte_low, pte_high; } pte_t; typedef struct { unsigned long long pmd; } pmd_t; typedef struct { unsigned long long pgd; } pgd_t; typedef struct { unsigned long long pgprot; } pgprot_t; -#define pmd_val(x) ((x).pmd) -#define pte_val(x) ((x).pte_low | ((unsigned long long)(x).pte_high << 32)) -#define __pmd(x) ((pmd_t) { (x) } ) +#define __pte(x) ({ unsigned long long _x = (x); \ + (((_x)&1) ? ((pte_t) {phys_to_machine(_x)}) : ((pte_t) {(_x)})); }) +#define __pgd(x) ({ unsigned long long _x = (x); \ + (((_x)&1) ? ((pgd_t) {phys_to_machine(_x)}) : ((pgd_t) {(_x)})); }) +#define __pmd(x) ({ unsigned long long _x = (x); \ + (((_x)&1) ? ((pmd_t) {phys_to_machine(_x)}) : ((pmd_t) {(_x)})); }) +static inline unsigned long long pte_val(pte_t x) +{ + unsigned long long ret; + + if (x.pte_low) { + ret = x.pte_low | (unsigned long long)x.pte_high << 32; + ret = machine_to_phys(ret) | 1; + } else { + ret = 0; + } + return ret; +} +static inline unsigned long long pmd_val(pmd_t x) +{ + unsigned long long ret = x.pmd; + if (ret) ret = machine_to_phys(ret) | 1; + return ret; +} +static inline unsigned long long pgd_val(pgd_t x) +{ + unsigned long long ret = x.pgd; + if (ret) ret = machine_to_phys(ret) | 1; + return ret; +} +static inline unsigned long long pte_val_ma(pte_t x) +{ + return (unsigned long long)x.pte_high << 32 | x.pte_low; +} #define HPAGE_SHIFT 21 #else typedef struct { unsigned long pte_low; } pte_t; @@ -96,6 +129,16 @@ typedef struct { unsigned long pgprot; } pgprot_t; #define pte_val(x) (((x).pte_low & 1) ? machine_to_phys((x).pte_low) : \ (x).pte_low) #define pte_val_ma(x) ((x).pte_low) +#define __pte(x) ({ unsigned long _x = (x); \ + (((_x)&1) ? ((pte_t) {phys_to_machine(_x)}) : ((pte_t) {(_x)})); }) +#define __pgd(x) ({ unsigned long _x = (x); \ + (((_x)&1) ? ((pgd_t) {phys_to_machine(_x)}) : ((pgd_t) {(_x)})); }) +static inline unsigned long pgd_val(pgd_t x) +{ + unsigned long ret = x.pgd; + if (ret) ret = machine_to_phys(ret) | 1; + return ret; +} #define HPAGE_SHIFT 22 #endif #define PTE_MASK PAGE_MASK @@ -107,20 +150,9 @@ typedef struct { unsigned long pgprot; } pgprot_t; #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA #endif - -static inline unsigned long pgd_val(pgd_t x) -{ - unsigned long ret = x.pgd; - if (ret) ret = machine_to_phys(ret); - return ret; -} #define pgprot_val(x) ((x).pgprot) -#define __pte(x) ({ unsigned long _x = (x); \ - (((_x)&1) ? ((pte_t) {phys_to_machine(_x)}) : ((pte_t) {(_x)})); }) #define __pte_ma(x) ((pte_t) { (x) } ) -#define __pgd(x) ({ unsigned long _x = (x); \ - (((_x)&1) ? ((pgd_t) {phys_to_machine(_x)}) : ((pgd_t) {(_x)})); }) #define __pgprot(x) ((pgprot_t) { (x) } ) #endif /* !__ASSEMBLY__ */ diff --git a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h index 4890d7a479..ef48c20ab1 100644 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h @@ -400,7 +400,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)); \ } \ } \ @@ -419,7 +419,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) diff --git a/linux-2.6-xen-sparse/include/asm-xen/hypervisor.h b/linux-2.6-xen-sparse/include/asm-xen/hypervisor.h index 0ee9e3d12e..1fd5aaf694 100644 --- a/linux-2.6-xen-sparse/include/asm-xen/hypervisor.h +++ b/linux-2.6-xen-sparse/include/asm-xen/hypervisor.h @@ -40,9 +40,13 @@ #include <asm/ptrace.h> #include <asm/page.h> #if defined(__i386__) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -#include <asm-generic/pgtable-nopmd.h> -#endif +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) +# ifdef CONFIG_X86_PAE +# include <asm-generic/pgtable-nopud.h> +# else +# include <asm-generic/pgtable-nopmd.h> +# 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); |