1 #ifndef _SPARC64_PAGE_H
2 #define _SPARC64_PAGE_H
4 #include <linux/const.h>
8 #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
9 #define PAGE_MASK (~(PAGE_SIZE-1))
11 /* Flushing for D-cache alias handling is only needed if
12 * the page size is smaller than 16K.
15 #define DCACHE_ALIASING_POSSIBLE
18 #define HPAGE_SHIFT 22
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
29 #if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
31 extern void hugetlb_setup(struct mm_struct
*mm
);
34 #define WANT_PAGE_VIRTUAL
36 extern void _clear_page(void *page
);
37 #define clear_page(X) _clear_page((void *)(X))
39 extern 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)
41 extern void copy_user_page(void *to
, void *from
, unsigned long vaddr
, struct page
*topage
);
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.
50 #define STRICT_MM_TYPECHECKS
52 #ifdef STRICT_MM_TYPECHECKS
53 /* These are used to make use of C type-checking.. */
54 typedef struct { unsigned long pte
; } pte_t
;
55 typedef struct { unsigned long iopte
; } iopte_t
;
56 typedef struct { unsigned int pmd
; } pmd_t
;
57 typedef struct { unsigned int pgd
; } pgd_t
;
58 typedef struct { unsigned long pgprot
; } pgprot_t
;
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)
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) } )
73 /* .. while these make it easier on the compiler */
74 typedef unsigned long pte_t
;
75 typedef unsigned long iopte_t
;
76 typedef unsigned int pmd_t
;
77 typedef unsigned int pgd_t
;
78 typedef unsigned long pgprot_t
;
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)
87 #define __iopte(x) (x)
90 #define __pgprot(x) (x)
92 #endif /* (STRICT_MM_TYPECHECKS) */
94 typedef pte_t
*pgtable_t
;
96 #define TASK_UNMAPPED_BASE (test_thread_flag(TIF_32BIT) ? \
97 (_AC(0x0000000070000000,UL)) : \
98 (_AC(0xfffff80000000000,UL) + (1UL << 32UL)))
100 #include <asm-generic/memory_model.h>
102 #endif /* !(__ASSEMBLY__) */
104 /* We used to stick this into a hard-coded global register (%g4)
105 * but that does not make sense anymore.
107 #define PAGE_OFFSET _AC(0xFFFFF80000000000,UL)
111 #define __pa(x) ((unsigned long)(x) - PAGE_OFFSET)
112 #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
114 #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
116 #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr)>>PAGE_SHIFT)
118 #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
120 #define virt_to_phys __pa
121 #define phys_to_virt __va
123 #endif /* !(__ASSEMBLY__) */
125 #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
126 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
128 #include <asm-generic/getorder.h>
130 #endif /* _SPARC64_PAGE_H */