1 #ifndef _ASM_PAGE_H 2 #define _ASM_PAGE_H 3 4 #include <asm/virtconvert.h> 5 #include <asm/mem-layout.h> 6 #include <asm/sections.h> 7 #include <asm/setup.h> 8 9 #ifndef __ASSEMBLY__ 10 11 #define clear_page(pgaddr) memset((pgaddr), 0, PAGE_SIZE) 12 #define copy_page(to,from) memcpy((to), (from), PAGE_SIZE) 13 14 #define clear_user_page(pgaddr, vaddr, page) memset((pgaddr), 0, PAGE_SIZE) 15 #define copy_user_page(vto, vfrom, vaddr, topg) memcpy((vto), (vfrom), PAGE_SIZE) 16 17 /* 18 * These are used to make use of C type-checking.. 19 */ 20 typedef struct { unsigned long pte; } pte_t; 21 typedef struct { unsigned long ste[64];} pmd_t; 22 typedef struct { pmd_t pue[1]; } pud_t; 23 typedef struct { pud_t pge[1]; } pgd_t; 24 typedef struct { unsigned long pgprot; } pgprot_t; 25 typedef struct page *pgtable_t; 26 27 #define pte_val(x) ((x).pte) 28 #define pmd_val(x) ((x).ste[0]) 29 #define pud_val(x) ((x).pue[0]) 30 #define pgd_val(x) ((x).pge[0]) 31 #define pgprot_val(x) ((x).pgprot) 32 33 #define __pte(x) ((pte_t) { (x) } ) 34 #define __pmd(x) ((pmd_t) { { (x) } } ) 35 #define __pud(x) ((pud_t) { (x) } ) 36 #define __pgd(x) ((pgd_t) { (x) } ) 37 #define __pgprot(x) ((pgprot_t) { (x) } ) 38 #define PTE_MASK PAGE_MASK 39 40 #define devmem_is_allowed(pfn) 1 41 42 #define __pa(vaddr) virt_to_phys((void *) (unsigned long) (vaddr)) 43 #define __va(paddr) phys_to_virt((unsigned long) (paddr)) 44 45 #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) 46 47 extern unsigned long max_low_pfn; 48 extern unsigned long min_low_pfn; 49 extern unsigned long max_pfn; 50 51 #ifdef CONFIG_MMU 52 #define pfn_valid(pfn) ((pfn) < max_mapnr) 53 #else 54 #define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT) 55 #define pfn_valid(pfn) ((pfn) >= min_low_pfn && (pfn) < max_low_pfn) 56 57 #endif 58 59 #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 60 #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 61 62 63 #define VM_DATA_DEFAULT_FLAGS \ 64 (VM_READ | VM_WRITE | \ 65 ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \ 66 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 67 68 #endif /* __ASSEMBLY__ */ 69 70 #include <asm-generic/memory_model.h> 71 #include <asm-generic/getorder.h> 72 73 #endif /* _ASM_PAGE_H */ 74