4 #include <linux/config.h>
6 /* PAGE_SHIFT determines the page size */
8 #define PAGE_SHIFT (12)
10 #define PAGE_SHIFT (13)
13 #define PAGE_SIZE (1 << PAGE_SHIFT)
15 #define PAGE_SIZE (1UL << PAGE_SHIFT)
17 #define PAGE_MASK (~(PAGE_SIZE-1))
21 #include <asm/setup.h>
24 #define THREAD_SIZE (8192)
26 #define THREAD_SIZE PAGE_SIZE
31 #define get_user_page(vaddr) __get_free_page(GFP_KERNEL)
32 #define free_user_page(page, addr) free_page(addr)
35 * We don't need to check for alignment etc.
37 #ifdef CPU_M68040_OR_M68060_ONLY
38 static inline void copy_page(void *to
, void *from
)
42 __asm__
__volatile__("1:\t"
44 "move16 %1@+,%0@+\n\t"
45 "move16 %1@+,%0@+\n\t"
48 : "=a" (to
), "=a" (from
), "=d" (tmp
)
49 : "0" (to
), "1" (from
) , "2" (PAGE_SIZE
/ 32 - 1)
53 static inline void clear_page(void *page
)
56 unsigned long *sp
= page
;
63 __asm__
__volatile__("1:\t"
65 "move16 %2@+,%0@+\n\t"
70 : "=a" (sp
), "=d" (tmp
)
71 : "a" (page
), "0" (sp
),
72 "1" ((PAGE_SIZE
- 16) / 16 - 1));
76 #define clear_page(page) memset((page), 0, PAGE_SIZE)
77 #define copy_page(to,from) memcpy((to), (from), PAGE_SIZE)
80 #define clear_user_page(addr, vaddr, page) \
81 do { clear_page(addr); \
82 flush_dcache_page(page); \
84 #define copy_user_page(to, from, vaddr, page) \
85 do { copy_page(to, from); \
86 flush_dcache_page(page); \
90 * These are used to make use of C type-checking..
92 typedef struct { unsigned long pte
; } pte_t
;
93 typedef struct { unsigned long pmd
[16]; } pmd_t
;
94 typedef struct { unsigned long pgd
; } pgd_t
;
95 typedef struct { unsigned long pgprot
; } pgprot_t
;
97 #define pte_val(x) ((x).pte)
98 #define pmd_val(x) ((&x)->pmd[0])
99 #define pgd_val(x) ((x).pgd)
100 #define pgprot_val(x) ((x).pgprot)
102 #define __pte(x) ((pte_t) { (x) } )
103 #define __pmd(x) ((pmd_t) { (x) } )
104 #define __pgd(x) ((pgd_t) { (x) } )
105 #define __pgprot(x) ((pgprot_t) { (x) } )
107 /* to align the pointer to the (next) page boundary */
108 #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
110 #endif /* !__ASSEMBLY__ */
112 #include <asm/page_offset.h>
114 #define PAGE_OFFSET (PAGE_OFFSET_RAW)
120 #define WANT_PAGE_VIRTUAL
121 #ifdef CONFIG_SINGLE_MEMORY_CHUNK
122 extern unsigned long m68k_memoffset
;
124 #define __pa(vaddr) ((unsigned long)(vaddr)+m68k_memoffset)
125 #define __va(paddr) ((void *)((unsigned long)(paddr)-m68k_memoffset))
127 #define __pa(vaddr) virt_to_phys((void *)(vaddr))
128 #define __va(paddr) phys_to_virt((unsigned long)(paddr))
131 #else /* !CONFIG_SUN3 */
132 /* This #define is a horrible hack to suppress lots of warnings. --m */
133 #define __pa(x) ___pa((unsigned long)(x))
134 static inline unsigned long ___pa(unsigned long x
)
139 return (x
-PAGE_OFFSET
);
141 return (x
+0x2000000);
144 static inline void *__va(unsigned long x
)
150 return (void *)(x
+PAGE_OFFSET
);
152 return (void *)(x
-0x2000000);
154 #endif /* CONFIG_SUN3 */
157 * NOTE: virtual isn't really correct, actually it should be the offset into the
158 * memory node, but we have no highmem, so that works for now.
159 * TODO: implement (fast) pfn<->pgdat_idx conversion functions, this makes lots
160 * of the shifts unnecessary.
162 #define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
163 #define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT)
165 #define virt_to_page(kaddr) (mem_map + (((unsigned long)(kaddr)-PAGE_OFFSET) >> PAGE_SHIFT))
166 #define page_to_virt(page) ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
168 #define pfn_to_page(pfn) virt_to_page(pfn_to_virt(pfn))
169 #define page_to_pfn(page) virt_to_pfn(page_to_virt(page))
171 #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory)
172 #define pfn_valid(pfn) virt_addr_valid(pfn_to_virt(pfn))
174 #endif /* __ASSEMBLY__ */
176 #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
177 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
179 #endif /* __KERNEL__ */
181 #include <asm-generic/page.h>
183 #endif /* _M68K_PAGE_H */