4 /* PAGE_SHIFT determines the page size */
6 #define PAGE_SIZE (1UL << PAGE_SHIFT)
7 #define PAGE_MASK (~(PAGE_SIZE-1))
10 #include <linux/config.h>
13 #include <asm/cache.h>
15 #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
16 #define copy_page(to,from) copy_user_page_asm((void *)(to), (void *)(from))
20 extern void purge_kernel_dcache_page(unsigned long);
21 extern void copy_user_page_asm(void *to, void *from);
22 extern void clear_user_page_asm(void *page, unsigned long vaddr);
25 copy_user_page(void *vto, void *vfrom, unsigned long vaddr, struct page *pg)
27 copy_user_page_asm(vto, vfrom);
28 flush_kernel_dcache_page(vto);
29 /* XXX: ppc flushes icache too, should we? */
33 clear_user_page(void *page, unsigned long vaddr, struct page *pg)
35 purge_kernel_dcache_page((unsigned long)page);
36 clear_user_page_asm(page, vaddr);
40 * These are used to make use of C type-checking..
42 typedef struct { unsigned long pte; } pte_t;
43 typedef struct { unsigned long pmd; } pmd_t;
44 typedef struct { unsigned long pgd; } pgd_t;
45 typedef struct { unsigned long pgprot; } pgprot_t;
47 #define pte_val(x) ((x).pte)
48 #define pmd_val(x) ((x).pmd)
49 #define pgd_val(x) ((x).pgd)
50 #define pgprot_val(x) ((x).pgprot)
52 #define __pte(x) ((pte_t) { (x) } )
53 #define __pmd(x) ((pmd_t) { (x) } )
54 #define __pgd(x) ((pgd_t) { (x) } )
55 #define __pgprot(x) ((pgprot_t) { (x) } )
57 /* Pure 2^n version of get_order */
58 extern __inline__ int get_order(unsigned long size)
62 size = (size-1) >> (PAGE_SHIFT-1);
72 #define MAX_PHYSMEM_RANGES 8 /* Fix the size for now (current known max is 3) */
74 #define MAX_PHYSMEM_RANGES 1 /* First range is only range that fits in 32 bits */
77 typedef struct __physmem_range {
78 unsigned long start_pfn;
79 unsigned long pages; /* PAGE_SIZE pages */
82 extern physmem_range_t pmem_ranges[];
83 extern int npmem_ranges;
85 #endif /* !__ASSEMBLY__ */
87 /* to align the pointer to the (next) page boundary */
88 #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
91 #define LINUX_GATEWAY_SPACE 0
92 #define __PAGE_OFFSET (0x10000000)
94 #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
95 /* These macros don't work for 64-bit C code -- don't allow in C at all */
97 # define PA(x) ((x)-__PAGE_OFFSET)
98 # define VA(x) ((x)+__PAGE_OFFSET)
100 #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
101 #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
103 #define pfn_to_page(pfn) (mem_map + (pfn))
104 #define page_to_pfn(page) ((unsigned long)((page) - mem_map))
105 #define pfn_valid(pfn) ((pfn) < max_mapnr)
106 #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
108 #ifndef CONFIG_DISCONTIGMEM
109 #define virt_to_page(kaddr) (mem_map + (__pa(kaddr) >> PAGE_SHIFT))
110 #define VALID_PAGE(page) ((page - mem_map) < max_mapnr)
111 #endif /* !CONFIG_DISCONTIGMEM */
113 #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
114 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
116 #endif /* __KERNEL__ */
118 #endif /* _PARISC_PAGE_H */