16 #ifndef _ASM_PGTABLE_H
17 #define _ASM_PGTABLE_H
19 #include <asm/mem-layout.h>
20 #include <asm/setup.h>
21 #include <asm/processor.h>
25 #include <linux/slab.h>
26 #include <linux/list.h>
28 #include <linux/sched.h>
33 #if defined(CONFIG_HIGHPTE)
46 #define pgd_present(pgd) (1)
47 #define pgd_none(pgd) (0)
48 #define pgd_bad(pgd) (0)
49 #define pgd_clear(pgdp)
50 #define kern_addr_valid(addr) (1)
51 #define pmd_offset(a, b) ((void *) 0)
53 #define PAGE_NONE __pgprot(0)
54 #define PAGE_SHARED __pgprot(0)
55 #define PAGE_COPY __pgprot(0)
56 #define PAGE_READONLY __pgprot(0)
57 #define PAGE_KERNEL __pgprot(0)
59 #define __swp_type(x) (0)
60 #define __swp_offset(x) (0)
61 #define __swp_entry(typ,off) ((swp_entry_t) { ((typ) | ((off) << 7)) })
62 #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
63 #define __swp_entry_to_pte(x) ((pte_t) { (x).val })
69 #define ZERO_PAGE(vaddr) ({ BUG(); NULL; })
71 #define swapper_pg_dir ((pgd_t *) NULL)
73 #define pgtable_cache_init() do {} while (0)
89 #define ZERO_PAGE(vaddr) virt_to_page(empty_zero_page)
125 #define PGDIR_SHIFT 26
126 #define PGDIR_SIZE (1UL << PGDIR_SHIFT)
127 #define PGDIR_MASK (~(PGDIR_SIZE - 1))
128 #define PTRS_PER_PGD 64
131 #define PTRS_PER_PUD 1
132 #define PUD_SIZE (1UL << PUD_SHIFT)
133 #define PUD_MASK (~(PUD_SIZE - 1))
137 #define PMD_SIZE (1UL << PMD_SHIFT)
138 #define PMD_MASK (~(PMD_SIZE - 1))
139 #define PTRS_PER_PMD 1
142 #define __frv_PT_SIZE 256
144 #define PTRS_PER_PTE 4096
146 #define USER_PGDS_IN_LAST_PML4 (TASK_SIZE / PGDIR_SIZE)
147 #define FIRST_USER_ADDRESS 0
149 #define USER_PGD_PTRS (PAGE_OFFSET >> PGDIR_SHIFT)
150 #define KERNEL_PGD_PTRS (PTRS_PER_PGD - USER_PGD_PTRS)
152 #define TWOLEVEL_PGDIR_SHIFT 26
153 #define BOOT_USER_PGD_PTRS (__PAGE_OFFSET >> TWOLEVEL_PGDIR_SHIFT)
154 #define BOOT_KERNEL_PGD_PTRS (PTRS_PER_PGD - BOOT_USER_PGD_PTRS)
160 #define pte_ERROR(e) \
161 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, (e).pte)
162 #define pmd_ERROR(e) \
163 printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e))
164 #define pud_ERROR(e) \
165 printk("%s:%d: bad pud %08lx.\n", __FILE__, __LINE__, pmd_val(pud_val(e)))
166 #define pgd_ERROR(e) \
167 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pmd_val(pud_val(pgd_val(e))))
174 #define set_pte(pteptr, pteval) \
176 *(pteptr) = (pteval); \
177 asm volatile("dcf %M0" :: "U"(*pteptr)); \
179 #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
185 #define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
191 #define pgd_offset_k(address) pgd_offset(&init_mm, address)
203 #define pgd_populate(mm, pgd, pud) do { } while (0)
208 #define set_pgd(pgdptr, pgdval) \
210 memcpy((pgdptr), &(pgdval), sizeof(pgd_t)); \
211 asm volatile("dcf %M0" :: "U"(*(pgdptr))); \
216 return (
pud_t *) pgd;
219 #define pgd_page(pgd) (pud_page((pud_t){ pgd }))
220 #define pgd_page_vaddr(pgd) (pud_page_vaddr((pud_t){ pgd }))
226 #define pud_alloc_one(mm, address) NULL
227 #define pud_free(mm, x) do { } while (0)
228 #define __pud_free_tlb(tlb, x, address) do { } while (0)
240 #define pud_populate(mm, pmd, pte) do { } while (0)
246 #define set_pud(pudptr, pudval) set_pmd((pmd_t *)(pudptr), (pmd_t) { pudval })
248 #define pud_page(pud) (pmd_page((pmd_t){ pud }))
249 #define pud_page_vaddr(pud) (pmd_page_vaddr((pmd_t){ pud }))
257 #define set_pmd(pmdptr, pmdval) \
259 __set_pmd((pmdptr), (pmdval).ste[0]); \
262 #define __pmd_index(address) 0
266 return (
pmd_t *) dir + __pmd_index(address);
269 #define pte_same(a, b) ((a).pte == (b).pte)
270 #define pte_page(x) (mem_map + ((unsigned long)(((x).pte >> PAGE_SHIFT))))
271 #define pte_none(x) (!(x).pte)
272 #define pte_pfn(x) ((unsigned long)(((x).pte >> PAGE_SHIFT)))
273 #define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
274 #define pfn_pmd(pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
276 #define VMALLOC_VMADDR(x) ((unsigned long) (x))
283 #define _PAGE_BIT_PRESENT xAMPRx_V_BIT
284 #define _PAGE_BIT_WP DAMPRx_WP_BIT
285 #define _PAGE_BIT_NOCACHE xAMPRx_C_BIT
286 #define _PAGE_BIT_SUPER xAMPRx_S_BIT
287 #define _PAGE_BIT_ACCESSED xAMPRx_RESERVED8_BIT
288 #define _PAGE_BIT_DIRTY xAMPRx_M_BIT
289 #define _PAGE_BIT_NOTGLOBAL xAMPRx_NG_BIT
291 #define _PAGE_PRESENT xAMPRx_V
292 #define _PAGE_WP DAMPRx_WP
293 #define _PAGE_NOCACHE xAMPRx_C
294 #define _PAGE_SUPER xAMPRx_S
295 #define _PAGE_ACCESSED xAMPRx_RESERVED8
296 #define _PAGE_DIRTY xAMPRx_M
297 #define _PAGE_NOTGLOBAL xAMPRx_NG
299 #define _PAGE_RESERVED_MASK (xAMPRx_RESERVED8 | xAMPRx_RESERVED13)
301 #define _PAGE_FILE 0x002
302 #define _PAGE_PROTNONE 0x000
304 #define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
306 #define __PGPROT_BASE \
307 (_PAGE_PRESENT | xAMPRx_SS_16Kb | xAMPRx_D | _PAGE_NOTGLOBAL | _PAGE_ACCESSED)
309 #define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_ACCESSED)
310 #define PAGE_SHARED __pgprot(__PGPROT_BASE)
311 #define PAGE_COPY __pgprot(__PGPROT_BASE | _PAGE_WP)
312 #define PAGE_READONLY __pgprot(__PGPROT_BASE | _PAGE_WP)
314 #define __PAGE_KERNEL (__PGPROT_BASE | _PAGE_SUPER | _PAGE_DIRTY)
315 #define __PAGE_KERNEL_NOCACHE (__PGPROT_BASE | _PAGE_SUPER | _PAGE_DIRTY | _PAGE_NOCACHE)
316 #define __PAGE_KERNEL_RO (__PGPROT_BASE | _PAGE_SUPER | _PAGE_DIRTY | _PAGE_WP)
318 #define MAKE_GLOBAL(x) __pgprot((x) & ~_PAGE_NOTGLOBAL)
320 #define PAGE_KERNEL MAKE_GLOBAL(__PAGE_KERNEL)
321 #define PAGE_KERNEL_RO MAKE_GLOBAL(__PAGE_KERNEL_RO)
322 #define PAGE_KERNEL_NOCACHE MAKE_GLOBAL(__PAGE_KERNEL_NOCACHE)
324 #define _PAGE_TABLE (_PAGE_PRESENT | xAMPRx_SS_16Kb)
333 #define __P000 PAGE_NONE
334 #define __P001 PAGE_READONLY
335 #define __P010 PAGE_COPY
336 #define __P011 PAGE_COPY
337 #define __P100 PAGE_READONLY
338 #define __P101 PAGE_READONLY
339 #define __P110 PAGE_COPY
340 #define __P111 PAGE_COPY
342 #define __S000 PAGE_NONE
343 #define __S001 PAGE_READONLY
344 #define __S010 PAGE_SHARED
345 #define __S011 PAGE_SHARED
346 #define __S100 PAGE_READONLY
347 #define __S101 PAGE_READONLY
348 #define __S110 PAGE_SHARED
349 #define __S111 PAGE_SHARED
355 #undef TEST_ACCESS_OK
357 #define pte_present(x) (pte_val(x) & _PAGE_PRESENT)
358 #define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0)
360 #define pmd_none(x) (!pmd_val(x))
361 #define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT)
362 #define pmd_bad(x) (pmd_val(x) & xAMPRx_SS)
363 #define pmd_clear(xp) do { __set_pmd(xp, 0); } while(0)
365 #define pmd_page_vaddr(pmd) \
366 ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
368 #ifndef CONFIG_DISCONTIGMEM
369 #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT))
372 #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
394 asm volatile(
"dcf %M0" ::
"U"(*ptep));
400 unsigned long x =
xchg(&ptep->
pte, 0);
401 asm volatile(
"dcf %M0" ::
"U"(*ptep));
408 asm volatile(
"dcf %M0" ::
"U"(*ptep));
414 #define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) | _PAGE_NOCACHE))
421 #define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
422 #define mk_pte_huge(entry) ((entry).pte_low |= _PAGE_PRESENT | _PAGE_PSE)
425 #define mk_pte_phys(physpage, pgprot) pfn_pte((physpage) >> PAGE_SHIFT, pgprot)
435 #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1))
436 #define pgd_index_k(addr) pgd_index(addr)
439 #define __pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
447 #define pte_index(address) \
448 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
449 #define pte_offset_kernel(dir, address) \
450 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))
452 #if defined(CONFIG_HIGHPTE)
453 #define pte_offset_map(dir, address) \
454 ((pte_t *)kmap_atomic(pmd_page(*(dir))) + pte_index(address))
455 #define pte_unmap(pte) kunmap_atomic(pte)
457 #define pte_offset_map(dir, address) \
458 ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address))
459 #define pte_unmap(pte) do { } while (0)
471 #define __swp_type(x) (((x).val >> 2) & 0x1f)
472 #define __swp_offset(x) ((x).val >> 8)
473 #define __swp_entry(type, offset) ((swp_entry_t) { ((type) << 2) | ((offset) << 8) })
474 #define __pte_to_swp_entry(_pte) ((swp_entry_t) { (_pte).pte })
475 #define __swp_entry_to_pte(x) ((pte_t) { (x).val })
482 #define PTE_FILE_MAX_BITS 29
484 #define pte_to_pgoff(PTE) ((PTE).pte >> 2)
485 #define pgoff_to_pte(off) __pte((off) << 2 | _PAGE_FILE)
488 #define PageSkip(page) (0)
489 #define kern_addr_valid(addr) (1)
491 #define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
492 remap_pfn_range(vma, vaddr, pfn, size, prot)
494 #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
495 #define __HAVE_ARCH_PTEP_GET_AND_CLEAR
496 #define __HAVE_ARCH_PTEP_SET_WRPROTECT
497 #define __HAVE_ARCH_PTE_SAME
514 ampr = pme->
ste[0] & 0xffffff00;
522 asm volatile(
"movgs %0,scr0\n"
531 #ifdef CONFIG_PROC_FS
532 extern char *proc_pid_status_frv_cxnr(
struct mm_struct *mm,
char *
buffer);