WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] pgtable.c:

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] pgtable.c:
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Thu, 28 Apr 2005 15:23:35 +0000
Delivery-date: Thu, 28 Apr 2005 22:02:58 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
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

<Prev in Thread] Current Thread [Next in Thread>