linux-mips
[Top] [All Lists]

[PATCH] fix pfn_pte for 64BIT_PHYS_ADDR

To: linux-mips@linux-mips.org
Subject: [PATCH] fix pfn_pte for 64BIT_PHYS_ADDR
From: "Andrew Isaacson" <adi@broadcom.com>
Date: Tue, 16 Aug 2005 23:12:32 -0700
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.4.2.1i
On CONFIG_64BIT_PHYS_ADDR, pfn always fits in 'unsigned long', but
pfn<<PAGE_SHIFT sometimes extends beyond.  The pte is big enough to hold
'long long', but the shift in pfn_pte() needs to do its calculation with
enough bits to hold the result.

Signed-off-by: Andrew Isaacson <adi@broadcom.com>

Index: lmo-1480/include/asm-mips/pgtable-32.h
===================================================================
--- lmo-1480.orig/include/asm-mips/pgtable-32.h 2005-08-16 23:00:19.000000000 
-0700
+++ lmo-1480/include/asm-mips/pgtable-32.h      2005-08-16 23:01:39.000000000 
-0700
@@ -137,7 +137,7 @@
 #define pfn_pte(pfn, prot)     __pte(((pfn) << (PAGE_SHIFT + 2)) | 
pgprot_val(prot))
 #else
 #define pte_pfn(x)             ((unsigned long)((x).pte >> PAGE_SHIFT))
-#define pfn_pte(pfn, prot)     __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
+#define pfn_pte(pfn, prot)     __pte(((unsigned long long)(pfn) << PAGE_SHIFT) 
| pgprot_val(prot))
 #endif
 #endif /* defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) */
 


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