page.h 3.6 KB
Newer Older
L
Linus Torvalds 已提交
1
/*
2
 *  arch/arm/include/asm/page.h
L
Linus Torvalds 已提交
3 4 5 6 7 8 9 10 11 12 13 14
 *
 *  Copyright (C) 1995-2003 Russell King
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */
#ifndef _ASMARM_PAGE_H
#define _ASMARM_PAGE_H

/* PAGE_SHIFT determines the page size */
#define PAGE_SHIFT		12
15
#define PAGE_SIZE		(_AC(1,UL) << PAGE_SHIFT)
L
Linus Torvalds 已提交
16 17 18 19
#define PAGE_MASK		(~(PAGE_SIZE-1))

#ifndef __ASSEMBLY__

20 21 22 23 24 25
#ifndef CONFIG_MMU

#include "page-nommu.h"

#else

L
Linus Torvalds 已提交
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
#include <asm/glue.h>

/*
 *	User Space Model
 *	================
 *
 *	This section selects the correct set of functions for dealing with
 *	page-based copying and clearing for user space for the particular
 *	processor(s) we're building for.
 *
 *	We have the following to choose from:
 *	  v4wt		- ARMv4 with writethrough cache, without minicache
 *	  v4wb		- ARMv4 with writeback cache, without minicache
 *	  v4_mc		- ARMv4 with minicache
 *	  xscale	- Xscale
41
 *	  xsc3		- XScalev3
L
Linus Torvalds 已提交
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
 */
#undef _USER
#undef MULTI_USER

#ifdef CONFIG_CPU_COPY_V4WT
# ifdef _USER
#  define MULTI_USER 1
# else
#  define _USER v4wt
# endif
#endif

#ifdef CONFIG_CPU_COPY_V4WB
# ifdef _USER
#  define MULTI_USER 1
# else
#  define _USER v4wb
# endif
#endif

62 63 64 65 66 67 68 69
#ifdef CONFIG_CPU_COPY_FEROCEON
# ifdef _USER
#  define MULTI_USER 1
# else
#  define _USER feroceon
# endif
#endif

P
Paulius Zaleckas 已提交
70 71 72 73 74 75 76 77
#ifdef CONFIG_CPU_COPY_FA
# ifdef _USER
#  define MULTI_USER 1
# else
#  define _USER fa
# endif
#endif

L
Linus Torvalds 已提交
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
#ifdef CONFIG_CPU_SA1100
# ifdef _USER
#  define MULTI_USER 1
# else
#  define _USER v4_mc
# endif
#endif

#ifdef CONFIG_CPU_XSCALE
# ifdef _USER
#  define MULTI_USER 1
# else
#  define _USER xscale_mc
# endif
#endif

94 95 96 97 98 99 100 101
#ifdef CONFIG_CPU_XSC3
# ifdef _USER
#  define MULTI_USER 1
# else
#  define _USER xsc3_mc
# endif
#endif

L
Linus Torvalds 已提交
102 103 104 105 106 107 108 109
#ifdef CONFIG_CPU_COPY_V6
# define MULTI_USER 1
#endif

#if !defined(_USER) && !defined(MULTI_USER)
#error Unknown user operations model
#endif

110
struct page;
111
struct vm_area_struct;
112

L
Linus Torvalds 已提交
113
struct cpu_user_fns {
114
	void (*cpu_clear_user_highpage)(struct page *page, unsigned long vaddr);
115
	void (*cpu_copy_user_highpage)(struct page *to, struct page *from,
116
			unsigned long vaddr, struct vm_area_struct *vma);
L
Linus Torvalds 已提交
117 118 119 120 121
};

#ifdef MULTI_USER
extern struct cpu_user_fns cpu_user;

122
#define __cpu_clear_user_highpage	cpu_user.cpu_clear_user_highpage
123
#define __cpu_copy_user_highpage	cpu_user.cpu_copy_user_highpage
L
Linus Torvalds 已提交
124 125 126

#else

127
#define __cpu_clear_user_highpage	__glue(_USER,_clear_user_highpage)
128
#define __cpu_copy_user_highpage	__glue(_USER,_copy_user_highpage)
L
Linus Torvalds 已提交
129

130
extern void __cpu_clear_user_highpage(struct page *page, unsigned long vaddr);
131
extern void __cpu_copy_user_highpage(struct page *to, struct page *from,
132
			unsigned long vaddr, struct vm_area_struct *vma);
L
Linus Torvalds 已提交
133 134
#endif

135 136
#define clear_user_highpage(page,vaddr)		\
	 __cpu_clear_user_highpage(page, vaddr)
137 138 139

#define __HAVE_ARCH_COPY_USER_HIGHPAGE
#define copy_user_highpage(to,from,vaddr,vma)	\
140
	__cpu_copy_user_highpage(to, from, vaddr, vma)
L
Linus Torvalds 已提交
141

R
Russell King 已提交
142
#define clear_page(page)	memset((void *)(page), 0, PAGE_SIZE)
L
Linus Torvalds 已提交
143 144
extern void copy_page(void *to, const void *from);

145 146
#define __HAVE_ARCH_GATE_AREA 1

147 148 149
#ifdef CONFIG_ARM_LPAE
#include <asm/pgtable-3level-types.h>
#else
150
#include <asm/pgtable-2level-types.h>
151
#endif
L
Linus Torvalds 已提交
152

153 154
#endif /* CONFIG_MMU */

155 156
typedef struct page *pgtable_t;

157
#ifdef CONFIG_HAVE_ARCH_PFN_VALID
158 159 160
extern int pfn_valid(unsigned long);
#endif

L
Linus Torvalds 已提交
161 162 163 164
#include <asm/memory.h>

#endif /* !__ASSEMBLY__ */

165 166 167
#define VM_DATA_DEFAULT_FLAGS \
	(((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0) | \
	 VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
L
Linus Torvalds 已提交
168

169
#include <asm-generic/getorder.h>
170

L
Linus Torvalds 已提交
171
#endif