10 #include <linux/const.h>
11 #include <asm/types.h>
15 #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
16 #define PAGE_MASK (~(PAGE_SIZE-1))
17 #define PAGE_DEFAULT_ACC 0
18 #define PAGE_DEFAULT_KEY (PAGE_DEFAULT_ACC << 4)
20 #define HPAGE_SHIFT 20
21 #define HPAGE_SIZE (1UL << HPAGE_SHIFT)
22 #define HPAGE_MASK (~(HPAGE_SIZE - 1))
23 #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
25 #define ARCH_HAS_SETCLEAR_HUGE_PTE
26 #define ARCH_HAS_HUGE_PTE_TYPE
27 #define ARCH_HAS_PREPARE_HUGEPAGE
28 #define ARCH_HAS_HUGEPAGE_CLEAR_FLUSH
30 #include <asm/setup.h>
33 static unsigned long pfmf(
unsigned long function,
unsigned long address)
36 " .insn rre,0xb9af0000,%[function],%[address]"
38 : [
function]
"d" (
function)
46 pfmf(0x10000, (
unsigned long)page);
48 register unsigned long reg1 asm (
"1") = 0;
49 register void *
reg2 asm (
"2") = page;
50 register unsigned long reg3 asm (
"3") = 4096;
61 register unsigned long reg0 asm (
"0") = 0;
64 : :
"a" (to),
"a" (from),
"d" (
reg0)
68 " mvc 0(256,%0),0(%1)\n"
69 " mvc 256(256,%0),256(%1)\n"
70 " mvc 512(256,%0),512(%1)\n"
71 " mvc 768(256,%0),768(%1)\n"
72 " mvc 1024(256,%0),1024(%1)\n"
73 " mvc 1280(256,%0),1280(%1)\n"
74 " mvc 1536(256,%0),1536(%1)\n"
75 " mvc 1792(256,%0),1792(%1)\n"
76 " mvc 2048(256,%0),2048(%1)\n"
77 " mvc 2304(256,%0),2304(%1)\n"
78 " mvc 2560(256,%0),2560(%1)\n"
79 " mvc 2816(256,%0),2816(%1)\n"
80 " mvc 3072(256,%0),3072(%1)\n"
81 " mvc 3328(256,%0),3328(%1)\n"
82 " mvc 3584(256,%0),3584(%1)\n"
83 " mvc 3840(256,%0),3840(%1)\n"
84 : :
"a" (to),
"a" (from) :
"memory");
87 #define clear_user_page(page, vaddr, pg) clear_page(page)
88 #define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
90 #define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
91 alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
92 #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
100 typedef struct {
unsigned long pte; }
pte_t;
101 typedef struct {
unsigned long pmd; }
pmd_t;
103 typedef struct {
unsigned long pgd; }
pgd_t;
106 #define pgprot_val(x) ((x).pgprot)
107 #define pgste_val(x) ((x).pgste)
108 #define pte_val(x) ((x).pte)
109 #define pmd_val(x) ((x).pmd)
110 #define pud_val(x) ((x).pud)
111 #define pgd_val(x) ((x).pgd)
113 #define __pgste(x) ((pgste_t) { (x) } )
114 #define __pte(x) ((pte_t) { (x) } )
115 #define __pmd(x) ((pmd_t) { (x) } )
116 #define __pud(x) ((pud_t) { (x) } )
117 #define __pgd(x) ((pgd_t) { (x) } )
118 #define __pgprot(x) ((pgprot_t) { (x) } )
120 static inline void page_set_storage_key(
unsigned long addr,
121 unsigned char skey,
int mapped)
124 asm volatile(
".insn rrf,0xb22b0000,%0,%1,8,0"
125 : :
"d" (skey),
"a" (addr));
127 asm volatile(
"sske %0,%1" : :
"d" (skey),
"a" (addr));
130 static inline unsigned char page_get_storage_key(
unsigned long addr)
134 asm volatile(
"iske %0,%1" :
"=d" (skey) :
"a" (addr));
138 static inline int page_reset_referenced(
unsigned long addr)
145 :
"=d" (ipm) :
"a" (addr) :
"cc");
146 return !!(ipm & 0x20000000);
150 #define _PAGE_CHANGED 0x02
151 #define _PAGE_REFERENCED 0x04
152 #define _PAGE_FP_BIT 0x08
153 #define _PAGE_ACC_BITS 0xf0
162 #define __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY
163 static inline int page_test_and_clear_dirty(
unsigned long pfn,
int mapped)
167 skey = page_get_storage_key(pfn <<
PAGE_SHIFT);
170 page_set_storage_key(pfn <<
PAGE_SHIFT, skey & ~_PAGE_CHANGED, mapped);
177 #define __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG
178 static inline int page_test_and_clear_young(
unsigned long pfn)
180 return page_reset_referenced(pfn <<
PAGE_SHIFT);
193 #define HAVE_ARCH_FREE_PAGE
194 #define HAVE_ARCH_ALLOC_PAGE
198 #define __PAGE_OFFSET 0x0UL
199 #define PAGE_OFFSET 0x0UL
200 #define __pa(x) (unsigned long)(x)
201 #define __va(x) (void *)(unsigned long)(x)
202 #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
203 #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
204 #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
206 #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | \
207 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
212 #define __HAVE_ARCH_GATE_AREA 1