Commit:     afca03574555c9af9a86d5a025f0187d0b77ac32
Parent:     ad07b1001ec5132c93a5a85679355255d1f9444d
Author:     Paul Mundt <[EMAIL PROTECTED]>
AuthorDate: Mon Oct 15 11:01:33 2007 +0900
Committer:  Paul Mundt <[EMAIL PROTECTED]>
CommitDate: Tue Oct 30 08:44:13 2007 +0900

    sh: Correct pte_page() breakage.
    As noted by David:
    pte_page() is a macro defined as follows;
        #define pte_page(x)    phys_to_page(pte_val(x)&PTE_PHYS_MASK)
        #define phys_to_page(phys)    (pfn_to_page(phys >> PAGE_SHIFT))
    So as you can see the phys_to_page() macro doesn't wrap the 'phys'
    parameter in parentheses so we end up with;
        pte_val(x)&PTE_PHYS_MASK >> PAGE_SHIFT
    Which is not what we wanted as '>>' has a higher precedence than bitwise
    AND. I dug into the git repository and I believe this bug was added with
    this commit (104b8deaa5c0144cccfc7d914413ff80c7176af1);
    2006-03-27 KAMEZAWA Hiroyuki [PATCH] unify pfn_to_page: sh pfn_to_page
    -#define phys_to_page(phys)     (mem_map + (((phys)-__MEMORY_START) >>
    -#define page_to_phys(page)     (((page - mem_map) << PAGE_SHIFT) +
    +#define phys_to_page(phys)     (pfn_to_page(phys >> PAGE_SHIFT))
    +#define page_to_phys(page)     (page_to_pfn(page) << PAGE_SHIFT)
    Reported-by: David ADDISON <[EMAIL PROTECTED]>
    Reported-by: KAMEZAWA Hiroyuki <[EMAIL PROTECTED]>
    Signed-off-by: Paul Mundt <[EMAIL PROTECTED]>
 include/asm-sh/page.h    |    1 -
 include/asm-sh/pgtable.h |    2 +-
 2 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h
index cb3d46c..3aa8b07 100644
--- a/include/asm-sh/page.h
+++ b/include/asm-sh/page.h
@@ -128,7 +128,6 @@ typedef struct { unsigned long pgd; } pgd_t;
 #define __va(x)                        ((void *)((unsigned 
 #define pfn_to_kaddr(pfn)      __va((pfn) << PAGE_SHIFT)
-#define phys_to_page(phys)     (pfn_to_page(phys >> PAGE_SHIFT))
 #define page_to_phys(page)     (page_to_pfn(page) << PAGE_SHIFT)
 /* PFN start number, because of __MEMORY_START */
diff --git a/include/asm-sh/pgtable.h b/include/asm-sh/pgtable.h
index cf0dd2b..0b1d7c6 100644
--- a/include/asm-sh/pgtable.h
+++ b/include/asm-sh/pgtable.h
@@ -399,7 +399,7 @@ static inline void set_pte(pte_t *ptep, pte_t pte)
 #define        pmd_bad(x)      (pmd_val(x) & ~PAGE_MASK)
 #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
-#define pte_page(x)    phys_to_page(pte_val(x)&PTE_PHYS_MASK)
+#define pte_page(x)    pfn_to_page(pte_pfn(x))
  * The following only work if pte_present() is true.
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

Reply via email to