Go to the documentation of this file. 1 #ifndef _ASM_SCORE_PAGE_H
2 #define _ASM_SCORE_PAGE_H
5 #include <linux/const.h>
8 #define PAGE_SHIFT (12)
9 #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
10 #define PAGE_MASK (~(PAGE_SIZE-1))
16 #define PAGE_UP(addr) (((addr)+((PAGE_SIZE)-1))&(~((PAGE_SIZE)-1)))
17 #define PAGE_DOWN(addr) ((addr)&(~((PAGE_SIZE)-1)))
20 #define _ALIGN_UP(addr, size) (((addr)+((size)-1))&(~((size)-1)))
21 #define _ALIGN_DOWN(addr, size) ((addr)&(~((size)-1)))
24 #define _ALIGN(addr, size) _ALIGN_UP(addr, size)
31 #define PAGE_OFFSET (0xA0000000UL)
33 #define clear_page(pgaddr) memset((pgaddr), 0, PAGE_SIZE)
34 #define copy_page(to, from) memcpy((to), (from), PAGE_SIZE)
36 #define clear_user_page(pgaddr, vaddr, page) memset((pgaddr), 0, PAGE_SIZE)
37 #define copy_user_page(vto, vfrom, vaddr, topg) \
38 memcpy((vto), (vfrom), PAGE_SIZE)
44 typedef struct {
unsigned long pte; }
pte_t;
45 typedef struct {
unsigned long pgd; }
pgd_t;
49 #define pte_val(x) ((x).pte)
50 #define pgd_val(x) ((x).pgd)
51 #define pgprot_val(x) ((x).pgprot)
53 #define __pte(x) ((pte_t) { (x) })
54 #define __pgd(x) ((pgd_t) { (x) })
55 #define __pgprot(x) ((pgprot_t) { (x) })
61 #define __pa(x) ((unsigned long)(x) - PAGE_OFFSET)
62 #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
64 #define phys_to_pfn(phys) (PFN_DOWN(phys))
65 #define pfn_to_phys(pfn) (PFN_PHYS(pfn))
67 #define virt_to_pfn(vaddr) (phys_to_pfn((__pa(vaddr))))
68 #define pfn_to_virt(pfn) __va(pfn_to_phys((pfn)))
70 #define virt_to_page(vaddr) (pfn_to_page(virt_to_pfn(vaddr)))
71 #define page_to_virt(page) (pfn_to_virt(page_to_pfn(page)))
73 #define page_to_phys(page) (pfn_to_phys(page_to_pfn(page)))
74 #define page_to_bus(page) (page_to_phys(page))
75 #define phys_to_page(paddr) (pfn_to_page(phys_to_pfn(paddr)))
77 #define pfn_valid(pfn) (((pfn) >= min_low_pfn) && ((pfn) < max_low_pfn))
79 #define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT)
83 #define virt_addr_valid(vaddr) (pfn_valid(virt_to_pfn(vaddr)))
87 #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
88 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)