remap_file_pages protection support: i386 and x86-64 bits
PATCH 10/39 remap_file_pages protection support: i386 and x86-64 bits
Update pte encoding macros for i386 and x86-64.
Signed-off-by Paolo 'Blaisorblade' Giarrusso <[email protected]>
---
linux-2.6.git-paolo/include/asm-i386/pgtable-2level.h | 15 ++++++++++----- linux-2.6.git-paolo/include/asm-i386/pgtable-3level.h | 11 ++++++++++- linux-2.6.git-paolo/include/asm-x86_64/pgtable.h | 12 +++++++++++- 3 files changed, 31 insertions(+), 7 deletions(-)
include/asm-i386/pgtable-2level.h renamed from include/asm-i386/pgtable-2level.h~rfp-arch-i386-x86_64 +10 -5
@@ -48,16 +48,21 @@ static inline int pte_exec_kernel(pte_t }/* -* Bits 0, 6 and 7 are taken, split up the 29 bits of offset +* Bits 0, 1, 6 and 7 are taken, split up the 28 bits of offset * into this range: */ -#define PTE_FILE_MAX_BITS 29 +#define PTE_FILE_MAX_BITS 28#define pte_to_pgoff (pte) \ - ((((pte).pte_low >> 1) & 0x1f ) + (((pte).pte_low >> 8) << 5 )) + ((((pte).pte_low >> 2) & 0xf ) + (((pte).pte_low >> 8) << 4 )) +#define pte_to_pgprot (pte) \ + __pgprot(((pte).pte_low & (_PAGE_RW | _PAGE_PROTNONE)) \ + | (((pte).pte_low & _PAGE_PROTNONE) ? 0 : \ + (_PAGE_USER | _PAGE_PRESENT)) | _PAGE_ACCESSED) -#define pgoff_to_pte (off) \ - ((pte_t) { (((off) & 0x1f) << 1) + (((off) >> 5) << 8) + _PAGE_FILE }) +#define pgoff_prot_to_pte (off, prot) \ + ((pte_t) { (((off) & 0xf) << 2) + (((off) >> 4) << 8) + \ + (pgprot_val(prot) & (_PAGE_RW | _PAGE_PROTNONE)) + _PAGE_FILE })/* Encode and de-code a swap entry */ #define __swp_type (x) (((x).val >> 1) & 0x1f)
include/asm-i386/pgtable-3level.h renamed from include/asm-i386/pgtable-3level.h~rfp-arch-i386-x86_64 +10 -1
@@ -145,7 +145,16 @@ static inline pmd_t pfn_pmd(unsigned lon* put the 32 bits of offset into the high part. */ #define pte_to_pgoff (pte) ((pte).pte_high) -#define pgoff_to_pte (off) ((pte_t) { _PAGE_FILE, (off) }) + +#define pte_to_pgprot (pte) \ + __pgprot(((pte).pte_low & (_PAGE_RW | _PAGE_PROTNONE)) \ + | (((pte).pte_low & _PAGE_PROTNONE) ? 0 : \ + (_PAGE_USER | _PAGE_PRESENT)) | _PAGE_ACCESSED) + +#define pgoff_prot_to_pte (off, prot) \ + ((pte_t) { _PAGE_FILE + \ + (pgprot_val(prot) & (_PAGE_RW | _PAGE_PROTNONE)) , (off) }) +#define PTE_FILE_MAX_BITS 32/* Encode and de-code a swap entry */
include/asm-x86_64/pgtable.h renamed from include/asm-x86_64/pgtable.h~rfp-arch-i386-x86_64 +11 -1
@@ -343,9 +343,19 @@ static inline pud_t *__pud_offset_k(pud_#define pmd_pfn (x) ((pmd_val(x) >> PAGE_SHIFT) & __PHYSICAL_MASK)#define pte_to_pgoff (pte) ((pte_val(pte) & PHYSICAL_PAGE_MASK) >> PAGE_SHIFT) -#define pgoff_to_pte (off) ((pte_t) { ((off) << PAGE_SHIFT) | _PAGE_FILE })#define PTE_FILE_MAX_BITS __PHYSICAL_MASK_SHIFT +#define pte_to_pgprot (pte) \ + __pgprot((pte_val(pte) & (_PAGE_RW | _PAGE_PROTNONE)) \ + | ((pte_val(pte) & _PAGE_PROTNONE) ? 0 : \ + (_PAGE_USER | _PAGE_PRESENT)) | _PAGE_ACCESSED) + +#define pgoff_prot_to_pte (off, prot) \ + ((pte_t) { _PAGE_FILE + \ + (pgprot_val(prot) & (_PAGE_RW | _PAGE_PROTNONE)) + \ + ((off) << PAGE_SHIFT) }) + +/* PTE - Level 1 access. */ /* page, protection -> pte */
_
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel