Home | History | Annotate | Download | only in asm
      1 /****************************************************************************
      2  ****************************************************************************
      3  ***
      4  ***   This header was automatically generated from a Linux kernel header
      5  ***   of the same name, to make information necessary for userspace to
      6  ***   call into the kernel available to libc.  It contains only constants,
      7  ***   structures, and macros generated from the original header, and thus,
      8  ***   contains no copyrightable information.
      9  ***
     10  ****************************************************************************
     11  ****************************************************************************/
     12 #ifndef __ASM_SH_PGTABLE_64_H
     13 #define __ASM_SH_PGTABLE_64_H
     14 
     15 #include <linux/threads.h>
     16 #include <asm/processor.h>
     17 #include <asm/page.h>
     18 
     19 #define pte_ERROR(e)   printk("%s:%d: bad pte %016Lx.\n", __FILE__, __LINE__, pte_val(e))
     20 #define pgd_ERROR(e)   printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
     21 
     22 #define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval)
     23 
     24 #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
     25 #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
     26 #define __pgd_offset(address) pgd_index(address)
     27 #define pgd_offset(mm, address) ((mm)->pgd+pgd_index(address))
     28 #define pgd_offset_k(address) pgd_offset(&init_mm, address)
     29 #define _PMD_EMPTY 0x0
     30 #define pmd_present(pmd_entry) (pmd_val(pmd_entry) & _PAGE_PRESENT)
     31 #define pmd_clear(pmd_entry_p) (set_pmd((pmd_entry_p), __pmd(_PMD_EMPTY)))
     32 #define pmd_none(pmd_entry) (pmd_val((pmd_entry)) == _PMD_EMPTY)
     33 #define pmd_bad(pmd_entry) ((pmd_val(pmd_entry) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE)
     34 #define pmd_page_vaddr(pmd_entry)   ((unsigned long) __va(pmd_val(pmd_entry) & PAGE_MASK))
     35 #define pmd_page(pmd)   (virt_to_page(pmd_val(pmd)))
     36 #define pte_index(address)   ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
     37 #define pte_offset_kernel(dir, addr)   ((pte_t *) ((pmd_val(*(dir))) & PAGE_MASK) + pte_index((addr)))
     38 #define pte_offset_map(dir,addr) pte_offset_kernel(dir, addr)
     39 #define pte_offset_map_nested(dir,addr) pte_offset_kernel(dir, addr)
     40 #define pte_unmap(pte) do { } while (0)
     41 #define pte_unmap_nested(pte) do { } while (0)
     42 #ifndef __ASSEMBLY__
     43 #define IOBASE_VADDR 0xff000000
     44 #define IOBASE_END 0xffffffff
     45 #define _PAGE_WT 0x001
     46 #define _PAGE_DEVICE 0x001
     47 #define _PAGE_CACHABLE 0x002
     48 #define _PAGE_PRESENT 0x004
     49 #define _PAGE_FILE 0x004
     50 #define _PAGE_SIZE0 0x008
     51 #define _PAGE_SIZE1 0x010
     52 #define _PAGE_SHARED 0x020
     53 #define _PAGE_READ 0x040
     54 #define _PAGE_EXECUTE 0x080
     55 #define _PAGE_WRITE 0x100
     56 #define _PAGE_USER 0x200
     57 #define _PAGE_DIRTY 0x400
     58 #define _PAGE_ACCESSED 0x800
     59 #define _PAGE_FLAGS_HARDWARE_MASK 0xfffffffffffff3dbLL
     60 #ifndef _PAGE_SZHUGE
     61 #define _PAGE_SZHUGE (0)
     62 #endif
     63 #define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE |   _PAGE_EXECUTE |   _PAGE_CACHABLE | _PAGE_ACCESSED | _PAGE_DIRTY |   _PAGE_SHARED)
     64 #define _PAGE_TABLE (_KERNPG_TABLE | _PAGE_USER)
     65 #define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
     66 #define _PAGE_COMMON (_PAGE_PRESENT | _PAGE_USER |   _PAGE_CACHABLE | _PAGE_ACCESSED)
     67 #define PAGE_NONE __pgprot(_PAGE_CACHABLE | _PAGE_ACCESSED)
     68 #define PAGE_SHARED __pgprot(_PAGE_COMMON | _PAGE_READ | _PAGE_WRITE |   _PAGE_SHARED)
     69 #define PAGE_EXECREAD __pgprot(_PAGE_COMMON | _PAGE_READ | _PAGE_EXECUTE)
     70 #define PAGE_COPY PAGE_EXECREAD
     71 #define PAGE_READONLY __pgprot(_PAGE_COMMON | _PAGE_READ)
     72 #define PAGE_WRITEONLY __pgprot(_PAGE_COMMON | _PAGE_WRITE)
     73 #define PAGE_RWX __pgprot(_PAGE_COMMON | _PAGE_READ |   _PAGE_WRITE | _PAGE_EXECUTE)
     74 #define PAGE_KERNEL __pgprot(_KERNPG_TABLE)
     75 #define PAGE_KERNEL_NOCACHE   __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE |   _PAGE_EXECUTE | _PAGE_ACCESSED |   _PAGE_DIRTY | _PAGE_SHARED)
     76 #define pgprot_noncached(x) __pgprot(((x).pgprot & ~(_PAGE_CACHABLE)) | _PAGE_DEVICE)
     77 #define pgprot_writecombine(prot) __pgprot(pgprot_val(prot) & ~_PAGE_CACHABLE)
     78 
     79 #define __handle_bad_pmd(x) __handle_bad_pmd_kernel(x)
     80 
     81 #define _PTE_EMPTY 0x0
     82 #define pte_present(x) (pte_val(x) & _PAGE_PRESENT)
     83 #define pte_clear(mm,addr,xp) (set_pte_at(mm, addr, xp, __pte(_PTE_EMPTY)))
     84 #define pte_none(x) (pte_val(x) == _PTE_EMPTY)
     85 
     86 #define pte_pagenr(x) (((unsigned long) (pte_val(x)) -   __MEMORY_START) >> PAGE_SHIFT)
     87 
     88 #define pte_page(x) (mem_map + pte_pagenr(x))
     89 
     90 #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
     91 
     92 #define mk_pte(page,pgprot)  ({   pte_t __pte;     set_pte(&__pte, __pte((((page)-mem_map) << PAGE_SHIFT) |   __MEMORY_START | pgprot_val((pgprot))));   __pte;  })
     93 #define mk_pte_phys(physpage, pgprot)  ({ pte_t __pte; set_pte(&__pte, __pte(physpage | pgprot_val(pgprot))); __pte; })
     94 #define __swp_type(x) (((x).val & 3) + (((x).val >> 1) & 0x3c))
     95 #define __swp_offset(x) ((x).val >> 8)
     96 #define __swp_entry(type, offset) ((swp_entry_t) { ((offset << 8) + ((type & 0x3c) << 1) + (type & 3)) })
     97 #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
     98 #define __swp_entry_to_pte(x) ((pte_t) { (x).val })
     99 #define PTE_FILE_MAX_BITS 29
    100 #define pte_to_pgoff(pte) (pte_val(pte))
    101 #define pgoff_to_pte(off) ((pte_t) { (off) | _PAGE_FILE })
    102 #endif
    103 #define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
    104 #define pfn_pmd(pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
    105 #endif
    106