* [PATCH 2.6.10-rc3-mm1] m32r: PAGE_NONE support (0/3)
@ 2004-12-17 4:05 Hirokazu Takata
2004-12-17 4:06 ` [PATCH 2.6.10-rc3-mm1] m32r: Support PAGE_NONE (1/3) Hirokazu Takata
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Hirokazu Takata @ 2004-12-17 4:05 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, takata
Hello,
This patchset updates page flags for m32r.
* Support PAGE_NONE
- Support PAGE_NONE attribute for memory protection.
- Add _PAGE_PROTNONE bit to pte.
On the m32r, the _PAGE_PROTNONE bit is a software bit.
* Remove PAGE_USER
- Remove _PAGE_USER bit from pte, because the m32r doesn't support it
by hardware. (cf. mips)
In my understanding, the _PAGE_PRONONE bit is used to show explicitly that
no physical memory is mapped and the mapped page is not accessible, right?
If a page marked with PAGE_NONE is accessed, an access error should
be happened.
Tested on M3T-M32700UT and M3A-ZA36 eva boards, and it looks working.
Please apply.
Thank you.
Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
---
[PATCH 2.6.10-rc3-mm1] m32r: Support PAGE_NONE (1/3)
- Support PAGE_NONE attribute for memory protection.
- Add _PAGE_PROTNONE bit to pte (software bit).
[PATCH 2.6.10-rc3-mm1] m32r: Remove PAGE_USER (2/3)
- Remove _PAGE_USER bit from pte.
- The m32r doesn't support _PAGE_USER bit by hardware.
[PATCH 2.6.10-rc3-mm1] m32r: Clean up include/asm-m32r/pgtable-2level.h (3/3)
- Add #ifdef __KERNEL__
- Change __inline__ to inline for __KERNEL__ portion.
- Remove RCS ID string.
--
Hirokazu Takata <takata@linux-m32r.org>
Linux/M32R Project: http://www.linux-m32r.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2.6.10-rc3-mm1] m32r: Support PAGE_NONE (1/3)
2004-12-17 4:05 [PATCH 2.6.10-rc3-mm1] m32r: PAGE_NONE support (0/3) Hirokazu Takata
@ 2004-12-17 4:06 ` Hirokazu Takata
2004-12-17 4:06 ` [PATCH 2.6.10-rc3-mm1] m32r: Remove PAGE_USER (2/3) Hirokazu Takata
2004-12-17 4:06 ` [PATCH 2.6.10-rc3-mm1] m32r: Clean up include/asm-m32r/pgtable-2level.h (3/3) Hirokazu Takata
2 siblings, 0 replies; 4+ messages in thread
From: Hirokazu Takata @ 2004-12-17 4:06 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, gniibe, takata
[PATCH 2.6.10-rc3-mm1] m32r: Support PAGE_NONE (1/3)
- Support PAGE_NONE attribute for memory protection.
- Add _PAGE_PROTNONE bit to pte (software bit).
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
---
include/asm-m32r/pgtable-2level.h | 7 +++----
include/asm-m32r/pgtable.h | 12 +++++++-----
2 files changed, 10 insertions(+), 9 deletions(-)
diff -ruNp a/include/asm-m32r/pgtable-2level.h b/include/asm-m32r/pgtable-2level.h
--- a/include/asm-m32r/pgtable-2level.h 2004-12-16 15:10:31.000000000 +0900
+++ b/include/asm-m32r/pgtable-2level.h 2004-12-16 15:18:46.000000000 +0900
@@ -68,10 +68,9 @@ static __inline__ pmd_t *pmd_offset(pgd_
#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
#define pfn_pmd(pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
-/* M32R_FIXME : PTE_FILE_MAX_BITS, pte_to_pgoff, pgoff_to_pte */
-#define PTE_FILE_MAX_BITS 31
-#define pte_to_pgoff(pte) (pte_val(pte) >> 1)
-#define pgoff_to_pte(off) ((pte_t) { ((off) << 1) | _PAGE_FILE })
+#define PTE_FILE_MAX_BITS 29
+#define pte_to_pgoff(pte) (((pte_val(pte) >> 2) & 0xff) | (((pte_val(pte) >> 11)) << 8))
+#define pgoff_to_pte(off) ((pte_t) { (((off) & 0xff) << 2) | (((off) >> 8) << 11) | _PAGE_FILE })
#endif /* _ASM_M32R_PGTABLE_2LEVEL_H */
diff -ruNp a/include/asm-m32r/pgtable.h b/include/asm-m32r/pgtable.h
--- a/include/asm-m32r/pgtable.h 2004-12-16 15:13:39.000000000 +0900
+++ b/include/asm-m32r/pgtable.h 2004-12-16 15:19:12.000000000 +0900
@@ -88,6 +88,7 @@ extern unsigned long empty_zero_page[102
#define _PAGE_BIT_USER 8 /* software: user space access
allowed */
#define _PAGE_BIT_ACCESSED 9 /* software: page referenced */
+#define _PAGE_BIT_PROTNONE 10 /* software: if not present */
#define _PAGE_DIRTY (1UL << _PAGE_BIT_DIRTY)
#define _PAGE_FILE (1UL << _PAGE_BIT_FILE)
@@ -100,6 +101,7 @@ extern unsigned long empty_zero_page[102
#define _PAGE_NONCACHABLE (1UL << _PAGE_BIT_NONCACHABLE)
#define _PAGE_USER (1UL << _PAGE_BIT_USER)
#define _PAGE_ACCESSED (1UL << _PAGE_BIT_ACCESSED)
+#define _PAGE_PROTNONE (1UL << _PAGE_BIT_PROTNONE)
#define _PAGE_TABLE \
( _PAGE_PRESENT | _PAGE_WRITE | _PAGE_READ | _PAGE_USER \
@@ -112,7 +114,7 @@ extern unsigned long empty_zero_page[102
#ifdef CONFIG_MMU
#define PAGE_NONE \
- __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED)
+ __pgprot(_PAGE_PROTNONE | _PAGE_ACCESSED)
#define PAGE_SHARED \
__pgprot(_PAGE_PRESENT | _PAGE_WRITE | _PAGE_READ | _PAGE_USER \
| _PAGE_ACCESSED)
@@ -177,7 +179,7 @@ extern unsigned long empty_zero_page[102
/* page table for 0-4MB for everybody */
-#define pte_present(x) (pte_val(x) & _PAGE_PRESENT)
+#define pte_present(x) (pte_val(x) & (_PAGE_PRESENT | _PAGE_PROTNONE))
#define pte_clear(xp) do { set_pte(xp, __pte(0)); } while (0)
#define pmd_none(x) (!pmd_val(x))
@@ -376,10 +378,10 @@ static inline void pmd_set(pmd_t * pmdp,
#define pte_unmap_nested(pte) do { } while (0)
/* Encode and de-code a swap entry */
-#define __swp_type(x) (((x).val >> 1) & 0x3f)
-#define __swp_offset(x) ((x).val >> 8)
+#define __swp_type(x) (((x).val >> 2) & 0x3f)
+#define __swp_offset(x) ((x).val >> 11)
#define __swp_entry(type, offset) \
- ((swp_entry_t) { ((type) << 1) | ((offset) << 8) })
+ ((swp_entry_t) { ((type) << 2) | ((offset) << 11) })
#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
--
Hirokazu Takata <takata@linux-m32r.org>
Linux/M32R Project: http://www.linux-m32r.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2.6.10-rc3-mm1] m32r: Remove PAGE_USER (2/3)
2004-12-17 4:05 [PATCH 2.6.10-rc3-mm1] m32r: PAGE_NONE support (0/3) Hirokazu Takata
2004-12-17 4:06 ` [PATCH 2.6.10-rc3-mm1] m32r: Support PAGE_NONE (1/3) Hirokazu Takata
@ 2004-12-17 4:06 ` Hirokazu Takata
2004-12-17 4:06 ` [PATCH 2.6.10-rc3-mm1] m32r: Clean up include/asm-m32r/pgtable-2level.h (3/3) Hirokazu Takata
2 siblings, 0 replies; 4+ messages in thread
From: Hirokazu Takata @ 2004-12-17 4:06 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, takata
[PATCH 2.6.10-rc3-mm1] m32r: Remove PAGE_USER (2/3)
- Remove _PAGE_USER bit from pte.
- The m32r doesn't support _PAGE_USER bit by hardware.
Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
---
include/asm-m32r/pgtable-2level.h | 5 ++---
include/asm-m32r/pgtable.h | 38 +++++++++++++-------------------------
2 files changed, 15 insertions(+), 28 deletions(-)
diff -ruNp a/include/asm-m32r/pgtable-2level.h b/include/asm-m32r/pgtable-2level.h
--- a/include/asm-m32r/pgtable-2level.h 2004-12-16 15:24:14.000000000 +0900
+++ b/include/asm-m32r/pgtable-2level.h 2004-12-16 16:08:35.000000000 +0900
@@ -69,8 +69,7 @@ static __inline__ pmd_t *pmd_offset(pgd_
#define pfn_pmd(pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
#define PTE_FILE_MAX_BITS 29
-#define pte_to_pgoff(pte) (((pte_val(pte) >> 2) & 0xff) | (((pte_val(pte) >> 11)) << 8))
-#define pgoff_to_pte(off) ((pte_t) { (((off) & 0xff) << 2) | (((off) >> 8) << 11) | _PAGE_FILE })
+#define pte_to_pgoff(pte) (((pte_val(pte) >> 2) & 0xef) | (((pte_val(pte) >> 10)) << 7))
+#define pgoff_to_pte(off) ((pte_t) { (((off) & 0xef) << 2) | (((off) >> 7) << 10) | _PAGE_FILE })
#endif /* _ASM_M32R_PGTABLE_2LEVEL_H */
-
diff -ruNp a/include/asm-m32r/pgtable.h b/include/asm-m32r/pgtable.h
--- a/include/asm-m32r/pgtable.h 2004-12-16 15:24:14.000000000 +0900
+++ b/include/asm-m32r/pgtable.h 2004-12-16 16:08:21.000000000 +0900
@@ -85,10 +85,8 @@ extern unsigned long empty_zero_page[102
#define _PAGE_BIT_WRITE 5 /* Write */
#define _PAGE_BIT_READ 6 /* Read */
#define _PAGE_BIT_NONCACHABLE 7 /* Non cachable */
-#define _PAGE_BIT_USER 8 /* software: user space access
- allowed */
-#define _PAGE_BIT_ACCESSED 9 /* software: page referenced */
-#define _PAGE_BIT_PROTNONE 10 /* software: if not present */
+#define _PAGE_BIT_ACCESSED 8 /* software: page referenced */
+#define _PAGE_BIT_PROTNONE 9 /* software: if not present */
#define _PAGE_DIRTY (1UL << _PAGE_BIT_DIRTY)
#define _PAGE_FILE (1UL << _PAGE_BIT_FILE)
@@ -99,13 +97,12 @@ extern unsigned long empty_zero_page[102
#define _PAGE_WRITE (1UL << _PAGE_BIT_WRITE)
#define _PAGE_READ (1UL << _PAGE_BIT_READ)
#define _PAGE_NONCACHABLE (1UL << _PAGE_BIT_NONCACHABLE)
-#define _PAGE_USER (1UL << _PAGE_BIT_USER)
#define _PAGE_ACCESSED (1UL << _PAGE_BIT_ACCESSED)
#define _PAGE_PROTNONE (1UL << _PAGE_BIT_PROTNONE)
#define _PAGE_TABLE \
- ( _PAGE_PRESENT | _PAGE_WRITE | _PAGE_READ | _PAGE_USER \
- | _PAGE_ACCESSED | _PAGE_DIRTY )
+ ( _PAGE_PRESENT | _PAGE_WRITE | _PAGE_READ | _PAGE_ACCESSED \
+ | _PAGE_DIRTY )
#define _KERNPG_TABLE \
( _PAGE_PRESENT | _PAGE_WRITE | _PAGE_READ | _PAGE_ACCESSED \
| _PAGE_DIRTY )
@@ -116,21 +113,18 @@ extern unsigned long empty_zero_page[102
#define PAGE_NONE \
__pgprot(_PAGE_PROTNONE | _PAGE_ACCESSED)
#define PAGE_SHARED \
- __pgprot(_PAGE_PRESENT | _PAGE_WRITE | _PAGE_READ | _PAGE_USER \
- | _PAGE_ACCESSED)
+ __pgprot(_PAGE_PRESENT | _PAGE_WRITE | _PAGE_READ | _PAGE_ACCESSED)
#define PAGE_SHARED_EXEC \
__pgprot(_PAGE_PRESENT | _PAGE_EXEC | _PAGE_WRITE | _PAGE_READ \
- | _PAGE_USER | _PAGE_ACCESSED)
+ | _PAGE_ACCESSED)
#define PAGE_COPY \
- __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_USER | _PAGE_ACCESSED)
+ __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_ACCESSED)
#define PAGE_COPY_EXEC \
- __pgprot(_PAGE_PRESENT | _PAGE_EXEC | _PAGE_READ | _PAGE_USER \
- | _PAGE_ACCESSED)
+ __pgprot(_PAGE_PRESENT | _PAGE_EXEC | _PAGE_READ | _PAGE_ACCESSED)
#define PAGE_READONLY \
- __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_USER | _PAGE_ACCESSED)
+ __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_ACCESSED)
#define PAGE_READONLY_EXEC \
- __pgprot(_PAGE_PRESENT | _PAGE_EXEC | _PAGE_READ | _PAGE_USER \
- | _PAGE_ACCESSED)
+ __pgprot(_PAGE_PRESENT | _PAGE_EXEC | _PAGE_READ | _PAGE_ACCESSED)
#define __PAGE_KERNEL \
( _PAGE_PRESENT | _PAGE_EXEC | _PAGE_WRITE | _PAGE_READ | _PAGE_DIRTY \
@@ -185,8 +179,7 @@ extern unsigned long empty_zero_page[102
#define pmd_none(x) (!pmd_val(x))
#define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT)
#define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0)
-#define pmd_bad(x) ((pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER)) \
- != _KERNPG_TABLE)
+#define pmd_bad(x) ((pmd_val(x) & ~PAGE_MASK) != _KERNPG_TABLE)
#define pages_to_mb(x) ((x) >> (20 - PAGE_SHIFT))
@@ -194,11 +187,6 @@ extern unsigned long empty_zero_page[102
* The following only work if pte_present() is true.
* Undefined behaviour if not..
*/
-static inline int pte_user(pte_t pte)
-{
- return pte_val(pte) & _PAGE_USER;
-}
-
static inline int pte_read(pte_t pte)
{
return pte_val(pte) & _PAGE_READ;
@@ -379,9 +367,9 @@ static inline void pmd_set(pmd_t * pmdp,
/* Encode and de-code a swap entry */
#define __swp_type(x) (((x).val >> 2) & 0x3f)
-#define __swp_offset(x) ((x).val >> 11)
+#define __swp_offset(x) ((x).val >> 10)
#define __swp_entry(type, offset) \
- ((swp_entry_t) { ((type) << 2) | ((offset) << 11) })
+ ((swp_entry_t) { ((type) << 2) | ((offset) << 10) })
#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
--
Hirokazu Takata <takata@linux-m32r.org>
Linux/M32R Project: http://www.linux-m32r.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2.6.10-rc3-mm1] m32r: Clean up include/asm-m32r/pgtable-2level.h (3/3)
2004-12-17 4:05 [PATCH 2.6.10-rc3-mm1] m32r: PAGE_NONE support (0/3) Hirokazu Takata
2004-12-17 4:06 ` [PATCH 2.6.10-rc3-mm1] m32r: Support PAGE_NONE (1/3) Hirokazu Takata
2004-12-17 4:06 ` [PATCH 2.6.10-rc3-mm1] m32r: Remove PAGE_USER (2/3) Hirokazu Takata
@ 2004-12-17 4:06 ` Hirokazu Takata
2 siblings, 0 replies; 4+ messages in thread
From: Hirokazu Takata @ 2004-12-17 4:06 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, takata
[PATCH 2.6.10-rc3-mm1] m32r: Clean up include/asm-m32r/pgtable-2level.h (3/3)
- Add #ifdef __KERNEL__
- Change __inline__ to inline for __KERNEL__ portion.
- Remove RCS ID string.
Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
---
include/asm-m32r/pgtable-2level.h | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff -ruNp a/include/asm-m32r/pgtable-2level.h b/include/asm-m32r/pgtable-2level.h
--- a/include/asm-m32r/pgtable-2level.h 2004-12-16 16:13:05.000000000 +0900
+++ b/include/asm-m32r/pgtable-2level.h 2004-12-16 16:13:28.000000000 +0900
@@ -1,7 +1,7 @@
#ifndef _ASM_M32R_PGTABLE_2LEVEL_H
#define _ASM_M32R_PGTABLE_2LEVEL_H
-/* $Id$ */
+#ifdef __KERNEL__
#include <linux/config.h>
@@ -33,9 +33,9 @@
* setup: the pgd is never bad, and a pmd always exists (as it's folded
* into the pgd entry)
*/
-static __inline__ int pgd_none(pgd_t pgd) { return 0; }
-static __inline__ int pgd_bad(pgd_t pgd) { return 0; }
-static __inline__ int pgd_present(pgd_t pgd) { return 1; }
+static inline int pgd_none(pgd_t pgd) { return 0; }
+static inline int pgd_bad(pgd_t pgd) { return 0; }
+static inline int pgd_present(pgd_t pgd) { return 1; }
#define pgd_clear(xp) do { } while (0)
/*
@@ -55,7 +55,7 @@ static __inline__ int pgd_present(pgd_t
#define pgd_page(pgd) \
((unsigned long) __va(pgd_val(pgd) & PAGE_MASK))
-static __inline__ pmd_t *pmd_offset(pgd_t * dir, unsigned long address)
+static inline pmd_t *pmd_offset(pgd_t * dir, unsigned long address)
{
return (pmd_t *) dir;
}
@@ -72,4 +72,6 @@ static __inline__ pmd_t *pmd_offset(pgd_
#define pte_to_pgoff(pte) (((pte_val(pte) >> 2) & 0xef) | (((pte_val(pte) >> 10)) << 7))
#define pgoff_to_pte(off) ((pte_t) { (((off) & 0xef) << 2) | (((off) >> 7) << 10) | _PAGE_FILE })
+#endif /* __KERNEL__ */
+
#endif /* _ASM_M32R_PGTABLE_2LEVEL_H */
--
Hirokazu Takata <takata@linux-m32r.org>
Linux/M32R Project: http://www.linux-m32r.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-12-17 4:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-17 4:05 [PATCH 2.6.10-rc3-mm1] m32r: PAGE_NONE support (0/3) Hirokazu Takata
2004-12-17 4:06 ` [PATCH 2.6.10-rc3-mm1] m32r: Support PAGE_NONE (1/3) Hirokazu Takata
2004-12-17 4:06 ` [PATCH 2.6.10-rc3-mm1] m32r: Remove PAGE_USER (2/3) Hirokazu Takata
2004-12-17 4:06 ` [PATCH 2.6.10-rc3-mm1] m32r: Clean up include/asm-m32r/pgtable-2level.h (3/3) Hirokazu Takata
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).