Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ff31452b6ea5032f26f16140d45dc6596260cd9c
Commit:     ff31452b6ea5032f26f16140d45dc6596260cd9c
Parent:     72932c7ad2cc309b0ba6149aa31faa26aaee54d5
Author:     Thomas Gleixner <[EMAIL PROTECTED]>
AuthorDate: Wed Jan 30 13:34:08 2008 +0100
Committer:  Ingo Molnar <[EMAIL PROTECTED]>
CommitDate: Wed Jan 30 13:34:08 2008 +0100

    x86: cpa create set_and_clr function
    
    Create a set_and_clr function to avoid the duplicate loops. Allows
    also to do combined operations for optimization.
    
    Signed-off-by: Thomas Gleixner <[EMAIL PROTECTED]>
    Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
---
 arch/x86/mm/pageattr.c |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 55f5b5c..c54832b 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -282,6 +282,45 @@ static int change_page_attr_addr(unsigned long address, 
pgprot_t prot)
        return err;
 }
 
+static int __change_page_attr_set_clr(unsigned long addr, int numpages,
+                                     pgprot_t mask_set, pgprot_t mask_clr)
+{
+       pgprot_t new_prot;
+       int level;
+       pte_t *pte;
+       int i, ret;
+
+       for (i = 0; i < numpages ; i++) {
+
+               pte = lookup_address(addr, &level);
+               if (!pte)
+                       return -EINVAL;
+
+               new_prot = pte_pgprot(*pte);
+
+               pgprot_val(new_prot) &= ~pgprot_val(mask_clr);
+               pgprot_val(new_prot) |= pgprot_val(mask_set);
+
+               ret = change_page_attr_addr(addr, new_prot);
+               if (ret)
+                       return ret;
+               addr += PAGE_SIZE;
+       }
+
+       return 0;
+}
+
+static int change_page_attr_set_clr(unsigned long addr, int numpages,
+                                   pgprot_t mask_set, pgprot_t mask_clr)
+{
+       int ret = __change_page_attr_set_clr(addr, numpages, mask_set,
+                                            mask_clr);
+
+       global_flush_tlb();
+
+       return ret;
+}
+
 /**
  * change_page_attr_set - Change page table attributes in the linear mapping.
  * @addr: Virtual address in linear mapping.
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to