Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _M68KNOMMU_PAGE_H |
| 2 | #define _M68KNOMMU_PAGE_H |
| 3 | |
| 4 | #include <linux/config.h> |
| 5 | |
| 6 | /* PAGE_SHIFT determines the page size */ |
| 7 | |
| 8 | #define PAGE_SHIFT (12) |
| 9 | #define PAGE_SIZE (1UL << PAGE_SHIFT) |
| 10 | #define PAGE_MASK (~(PAGE_SIZE-1)) |
| 11 | |
| 12 | #ifdef __KERNEL__ |
| 13 | |
| 14 | #include <asm/setup.h> |
| 15 | |
| 16 | #ifndef __ASSEMBLY__ |
| 17 | |
| 18 | #define get_user_page(vaddr) __get_free_page(GFP_KERNEL) |
| 19 | #define free_user_page(page, addr) free_page(addr) |
| 20 | |
| 21 | #define clear_page(page) memset((page), 0, PAGE_SIZE) |
| 22 | #define copy_page(to,from) memcpy((to), (from), PAGE_SIZE) |
| 23 | |
| 24 | #define clear_user_page(page, vaddr, pg) clear_page(page) |
| 25 | #define copy_user_page(to, from, vaddr, pg) copy_page(to, from) |
| 26 | |
| 27 | #define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vaddr) |
| 28 | #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE |
| 29 | |
| 30 | /* |
| 31 | * These are used to make use of C type-checking.. |
| 32 | */ |
| 33 | typedef struct { unsigned long pte; } pte_t; |
| 34 | typedef struct { unsigned long pmd[16]; } pmd_t; |
| 35 | typedef struct { unsigned long pgd; } pgd_t; |
| 36 | typedef struct { unsigned long pgprot; } pgprot_t; |
| 37 | |
| 38 | #define pte_val(x) ((x).pte) |
| 39 | #define pmd_val(x) ((&x)->pmd[0]) |
| 40 | #define pgd_val(x) ((x).pgd) |
| 41 | #define pgprot_val(x) ((x).pgprot) |
| 42 | |
| 43 | #define __pte(x) ((pte_t) { (x) } ) |
| 44 | #define __pmd(x) ((pmd_t) { (x) } ) |
| 45 | #define __pgd(x) ((pgd_t) { (x) } ) |
| 46 | #define __pgprot(x) ((pgprot_t) { (x) } ) |
| 47 | |
| 48 | /* to align the pointer to the (next) page boundary */ |
| 49 | #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) |
| 50 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | extern unsigned long memory_start; |
| 52 | extern unsigned long memory_end; |
| 53 | |
| 54 | #endif /* !__ASSEMBLY__ */ |
| 55 | |
| 56 | #include <asm/page_offset.h> |
| 57 | |
| 58 | #define PAGE_OFFSET (PAGE_OFFSET_RAW) |
| 59 | |
| 60 | #ifndef __ASSEMBLY__ |
| 61 | |
Greg Ungerer | e70bd11 | 2005-09-02 10:42:52 +1000 | [diff] [blame] | 62 | #define __pa(vaddr) virt_to_phys((void *)(vaddr)) |
| 63 | #define __va(paddr) phys_to_virt((unsigned long)(paddr)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | |
| 65 | #define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) |
| 66 | #define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT) |
| 67 | |
| 68 | #define virt_to_page(addr) (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT)) |
| 69 | #define page_to_virt(page) ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET) |
| 70 | |
| 71 | #define pfn_to_page(pfn) virt_to_page(pfn_to_virt(pfn)) |
| 72 | #define page_to_pfn(page) virt_to_pfn(page_to_virt(page)) |
Greg Ungerer | e70bd11 | 2005-09-02 10:42:52 +1000 | [diff] [blame] | 73 | #define pfn_valid(pfn) ((pfn) < max_mapnr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | |
| 75 | #define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \ |
| 76 | ((void *)(kaddr) < (void *)memory_end)) |
| 77 | |
| 78 | #endif /* __ASSEMBLY__ */ |
| 79 | |
| 80 | #endif /* __KERNEL__ */ |
| 81 | |
Stephen Rothwell | fd4fd5a | 2005-09-03 15:54:30 -0700 | [diff] [blame] | 82 | #include <asm-generic/page.h> |
| 83 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | #endif /* _M68KNOMMU_PAGE_H */ |