linux/arch/sparc/include/asm/page_64.h
<<
>>
Prefs
   1#ifndef _SPARC64_PAGE_H
   2#define _SPARC64_PAGE_H
   3
   4#include <linux/const.h>
   5
   6#define PAGE_SHIFT   13
   7
   8#define PAGE_SIZE    (_AC(1,UL) << PAGE_SHIFT)
   9#define PAGE_MASK    (~(PAGE_SIZE-1))
  10
  11/* Flushing for D-cache alias handling is only needed if
  12 * the page size is smaller than 16K.
  13 */
  14#if PAGE_SHIFT < 14
  15#define DCACHE_ALIASING_POSSIBLE
  16#endif
  17
  18#define HPAGE_SHIFT             22
  19
  20#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
  21#define HPAGE_SIZE              (_AC(1,UL) << HPAGE_SHIFT)
  22#define HPAGE_MASK              (~(HPAGE_SIZE - 1UL))
  23#define HUGETLB_PAGE_ORDER      (HPAGE_SHIFT - PAGE_SHIFT)
  24#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
  25#endif
  26
  27#ifndef __ASSEMBLY__
  28
  29#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
  30struct pt_regs;
  31extern void hugetlb_setup(struct pt_regs *regs);
  32#endif
  33
  34#define WANT_PAGE_VIRTUAL
  35
  36extern void _clear_page(void *page);
  37#define clear_page(X)   _clear_page((void *)(X))
  38struct page;
  39extern void clear_user_page(void *addr, unsigned long vaddr, struct page *page);
  40#define copy_page(X,Y)  memcpy((void *)(X), (void *)(Y), PAGE_SIZE)
  41extern void copy_user_page(void *to, void *from, unsigned long vaddr, struct page *topage);
  42
  43/* Unlike sparc32, sparc64's parameter passing API is more
  44 * sane in that structures which as small enough are passed
  45 * in registers instead of on the stack.  Thus, setting
  46 * STRICT_MM_TYPECHECKS does not generate worse code so
  47 * let's enable it to get the type checking.
  48 */
  49
  50#define STRICT_MM_TYPECHECKS
  51
  52#ifdef STRICT_MM_TYPECHECKS
  53/* These are used to make use of C type-checking.. */
  54typedef struct { unsigned long pte; } pte_t;
  55typedef struct { unsigned long iopte; } iopte_t;
  56typedef struct { unsigned int pmd; } pmd_t;
  57typedef struct { unsigned int pgd; } pgd_t;
  58typedef struct { unsigned long pgprot; } pgprot_t;
  59
  60#define pte_val(x)      ((x).pte)
  61#define iopte_val(x)    ((x).iopte)
  62#define pmd_val(x)      ((x).pmd)
  63#define pgd_val(x)      ((x).pgd)
  64#define pgprot_val(x)   ((x).pgprot)
  65
  66#define __pte(x)        ((pte_t) { (x) } )
  67#define __iopte(x)      ((iopte_t) { (x) } )
  68#define __pmd(x)        ((pmd_t) { (x) } )
  69#define __pgd(x)        ((pgd_t) { (x) } )
  70#define __pgprot(x)     ((pgprot_t) { (x) } )
  71
  72#else
  73/* .. while these make it easier on the compiler */
  74typedef unsigned long pte_t;
  75typedef unsigned long iopte_t;
  76typedef unsigned int pmd_t;
  77typedef unsigned int pgd_t;
  78typedef unsigned long pgprot_t;
  79
  80#define pte_val(x)      (x)
  81#define iopte_val(x)    (x)
  82#define pmd_val(x)      (x)
  83#define pgd_val(x)      (x)
  84#define pgprot_val(x)   (x)
  85
  86#define __pte(x)        (x)
  87#define __iopte(x)      (x)
  88#define __pmd(x)        (x)
  89#define __pgd(x)        (x)
  90#define __pgprot(x)     (x)
  91
  92#endif /* (STRICT_MM_TYPECHECKS) */
  93
  94typedef pte_t *pgtable_t;
  95
  96#define TASK_UNMAPPED_BASE      (test_thread_flag(TIF_32BIT) ? \
  97                                 (_AC(0x0000000070000000,UL)) : \
  98                                 (_AC(0xfffff80000000000,UL) + (1UL << 32UL)))
  99
 100#include <asm-generic/memory_model.h>
 101
 102#endif /* !(__ASSEMBLY__) */
 103
 104/* We used to stick this into a hard-coded global register (%g4)
 105 * but that does not make sense anymore.
 106 */
 107#define PAGE_OFFSET             _AC(0xFFFFF80000000000,UL)
 108
 109#ifndef __ASSEMBLY__
 110
 111#define __pa(x)                 ((unsigned long)(x) - PAGE_OFFSET)
 112#define __va(x)                 ((void *)((unsigned long) (x) + PAGE_OFFSET))
 113
 114#define pfn_to_kaddr(pfn)       __va((pfn) << PAGE_SHIFT)
 115
 116#define virt_to_page(kaddr)     pfn_to_page(__pa(kaddr)>>PAGE_SHIFT)
 117
 118#define virt_addr_valid(kaddr)  pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
 119
 120#define virt_to_phys __pa
 121#define phys_to_virt __va
 122
 123#endif /* !(__ASSEMBLY__) */
 124
 125#define VM_DATA_DEFAULT_FLAGS   (VM_READ | VM_WRITE | VM_EXEC | \
 126                                 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 127
 128#include <asm-generic/getorder.h>
 129
 130#endif /* _SPARC64_PAGE_H */
 131