[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] pgtable.c:



ChangeSet 1.1159.256.108, 2005/04/28 16:23:35+01:00, cl349@xxxxxxxxxxxxxxxxxxxx

        pgtable.c:
          Use virt_to_ptep.
        pgtable.h:
          add virt_to_ptep.



 arch/xen/i386/mm/pgtable.c         |   20 ++++----------------
 include/asm-xen/asm-i386/pgtable.h |   10 ++++++++--
 2 files changed, 12 insertions(+), 18 deletions(-)


diff -Nru a/linux-2.6.11-xen-sparse/arch/xen/i386/mm/pgtable.c 
b/linux-2.6.11-xen-sparse/arch/xen/i386/mm/pgtable.c
--- a/linux-2.6.11-xen-sparse/arch/xen/i386/mm/pgtable.c        2005-04-28 
18:03:22 -04:00
+++ b/linux-2.6.11-xen-sparse/arch/xen/i386/mm/pgtable.c        2005-04-28 
18:03:22 -04:00
@@ -374,28 +374,19 @@
 
 void make_lowmem_page_readonly(void *va)
 {
-       pgd_t *pgd = pgd_offset_k((unsigned long)va);
-       pud_t *pud = pud_offset(pgd, (unsigned long)va);
-       pmd_t *pmd = pmd_offset(pud, (unsigned long)va);
-       pte_t *pte = pte_offset_kernel(pmd, (unsigned long)va);
+       pte_t *pte = virt_to_ptep(va);
        queue_l1_entry_update(pte, (*(unsigned long *)pte)&~_PAGE_RW);
 }
 
 void make_lowmem_page_writable(void *va)
 {
-       pgd_t *pgd = pgd_offset_k((unsigned long)va);
-       pud_t *pud = pud_offset(pgd, (unsigned long)va);
-       pmd_t *pmd = pmd_offset(pud, (unsigned long)va);
-       pte_t *pte = pte_offset_kernel(pmd, (unsigned long)va);
+       pte_t *pte = virt_to_ptep(va);
        queue_l1_entry_update(pte, (*(unsigned long *)pte)|_PAGE_RW);
 }
 
 void make_page_readonly(void *va)
 {
-       pgd_t *pgd = pgd_offset_k((unsigned long)va);
-       pud_t *pud = pud_offset(pgd, (unsigned long)va);
-       pmd_t *pmd = pmd_offset(pud, (unsigned long)va);
-       pte_t *pte = pte_offset_kernel(pmd, (unsigned long)va);
+       pte_t *pte = virt_to_ptep(va);
        queue_l1_entry_update(pte, (*(unsigned long *)pte)&~_PAGE_RW);
        if ( (unsigned long)va >= (unsigned long)high_memory )
        {
@@ -410,10 +401,7 @@
 
 void make_page_writable(void *va)
 {
-       pgd_t *pgd = pgd_offset_k((unsigned long)va);
-       pud_t *pud = pud_offset(pgd, (unsigned long)va);
-       pmd_t *pmd = pmd_offset(pud, (unsigned long)va);
-       pte_t *pte = pte_offset_kernel(pmd, (unsigned long)va);
+       pte_t *pte = virt_to_ptep(va);
        queue_l1_entry_update(pte, (*(unsigned long *)pte)|_PAGE_RW);
        if ( (unsigned long)va >= (unsigned long)high_memory )
        {
diff -Nru a/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/pgtable.h 
b/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/pgtable.h
--- a/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/pgtable.h        
2005-04-28 18:03:22 -04:00
+++ b/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/pgtable.h        
2005-04-28 18:03:22 -04:00
@@ -276,6 +276,7 @@
        if (pte_write(pte))
                set_pte(ptep, pte_wrprotect(pte));
 }
+
 static inline void ptep_mkdirty(pte_t *ptep)
 {
        pte_t pte = *ptep;
@@ -455,12 +456,17 @@
 void make_pages_readonly(void *va, unsigned int nr);
 void make_pages_writable(void *va, unsigned int nr);
 
-#define arbitrary_virt_to_machine(__va)                                        
\
+#define virt_to_ptep(__va)                                             \
 ({                                                                     \
        pgd_t *__pgd = pgd_offset_k((unsigned long)(__va));             \
        pud_t *__pud = pud_offset(__pgd, (unsigned long)(__va));        \
        pmd_t *__pmd = pmd_offset(__pud, (unsigned long)(__va));        \
-       pte_t *__pte = pte_offset_kernel(__pmd, (unsigned long)(__va)); \
+       pte_offset_kernel(__pmd, (unsigned long)(__va));                \
+})
+
+#define arbitrary_virt_to_machine(__va)                                        
\
+({                                                                     \
+       pte_t *__pte = virt_to_ptep(__va);                              \
        unsigned long __pa = (*(unsigned long *)__pte) & PAGE_MASK;     \
        __pa | ((unsigned long)(__va) & (PAGE_SIZE-1));                 \
 })

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.