aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoriap10@freefall.cl.cam.ac.uk <iap10@freefall.cl.cam.ac.uk>2005-08-13 21:26:49 +0000
committeriap10@freefall.cl.cam.ac.uk <iap10@freefall.cl.cam.ac.uk>2005-08-13 21:26:49 +0000
commit8bbdb3ceb664b4eab621159fa4b4c3ddaa7188d2 (patch)
treea1a11358f431c4e070d9023306cf3147c75f9100
parent4595c9c24e3417eeca7641f25be73c91ff3dcd31 (diff)
downloadxen-8bbdb3ceb664b4eab621159fa4b4c3ddaa7188d2.tar.gz
xen-8bbdb3ceb664b4eab621159fa4b4c3ddaa7188d2.tar.bz2
xen-8bbdb3ceb664b4eab621159fa4b4c3ddaa7188d2.zip
Optimize the Linux arch xen implementation of "set_pte_at".
Signed-off-by: ian@xensource.com
-rw-r--r--linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h12
-rw-r--r--linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable-3level.h11
-rw-r--r--linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h11
3 files changed, 31 insertions, 3 deletions
diff --git a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h
index 91f1354048..1ed6625fff 100644
--- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h
+++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h
@@ -14,7 +14,17 @@
* hook is made available.
*/
#define set_pte(pteptr, pteval) (*(pteptr) = pteval)
-#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
+
+inline static void set_pte_at(struct mm_struct *mm, unsigned long addr,
+ pte_t *ptep, pte_t val )
+{
+ if ( ((mm != current->mm) && (mm != &init_mm)) ||
+ HYPERVISOR_update_va_mapping( (addr), (val), 0 ) )
+ {
+ set_pte(ptep, val);
+ }
+}
+
#define set_pte_atomic(pteptr, pteval) set_pte(pteptr,pteval)
#ifndef CONFIG_XEN_SHADOW_MODE
diff --git a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable-3level.h b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable-3level.h
index 601a48e7f8..16079faf2a 100644
--- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable-3level.h
+++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable-3level.h
@@ -68,7 +68,16 @@ static inline void set_pte(pte_t *ptep, pte_t pte)
xen_l1_entry_update((pteptr), (pteval))
# define set_pte_atomic(pteptr,pteval) set_pte(pteptr,pteval)
#endif
-#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
+
+inline static void set_pte_at(struct mm_struct *mm, unsigned long addr,
+ pte_t *ptep, pte_t val )
+{
+ if ( ((mm != current->mm) && (mm != &init_mm)) ||
+ HYPERVISOR_update_va_mapping( (addr), (val), 0 ) )
+ {
+ set_pte(ptep, val);
+ }
+}
#ifdef CONFIG_XEN_SHADOW_MODE
# define set_pmd(pmdptr,pmdval) \
diff --git a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h
index 59cdcce1f2..89dc994bf5 100644
--- a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h
+++ b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h
@@ -265,7 +265,16 @@ static inline unsigned long pud_bad(pud_t pud)
val &= ~(_PAGE_USER | _PAGE_DIRTY);
return val & ~(_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED);
}
-#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
+
+inline static void set_pte_at(struct mm_struct *mm, unsigned long addr,
+ pte_t *ptep, pte_t val )
+{
+ if ( ((mm != current->mm) && (mm != &init_mm)) ||
+ HYPERVISOR_update_va_mapping( (addr), (val), 0 ) )
+ {
+ set_pte(ptep, val);
+ }
+}
#define pte_none(x) (!(x).pte)
#define pte_present(x) ((x).pte & (_PAGE_PRESENT | _PAGE_PROTNONE))