Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  *  arch/arm/include/asm/page.h
0004  *
0005  *  Copyright (C) 1995-2003 Russell King
0006  */
0007 #ifndef _ASMARM_PAGE_H
0008 #define _ASMARM_PAGE_H
0009 
0010 /* PAGE_SHIFT determines the page size */
0011 #define PAGE_SHIFT      12
0012 #define PAGE_SIZE       (_AC(1,UL) << PAGE_SHIFT)
0013 #define PAGE_MASK       (~((1 << PAGE_SHIFT) - 1))
0014 
0015 #ifndef __ASSEMBLY__
0016 
0017 #ifndef CONFIG_MMU
0018 
0019 #include <asm/page-nommu.h>
0020 
0021 #else
0022 
0023 #include <asm/glue.h>
0024 
0025 /*
0026  *  User Space Model
0027  *  ================
0028  *
0029  *  This section selects the correct set of functions for dealing with
0030  *  page-based copying and clearing for user space for the particular
0031  *  processor(s) we're building for.
0032  *
0033  *  We have the following to choose from:
0034  *    v4wt      - ARMv4 with writethrough cache, without minicache
0035  *    v4wb      - ARMv4 with writeback cache, without minicache
0036  *    v4_mc     - ARMv4 with minicache
0037  *    xscale    - Xscale
0038  *    xsc3      - XScalev3
0039  */
0040 #undef _USER
0041 #undef MULTI_USER
0042 
0043 #ifdef CONFIG_CPU_COPY_V4WT
0044 # ifdef _USER
0045 #  define MULTI_USER 1
0046 # else
0047 #  define _USER v4wt
0048 # endif
0049 #endif
0050 
0051 #ifdef CONFIG_CPU_COPY_V4WB
0052 # ifdef _USER
0053 #  define MULTI_USER 1
0054 # else
0055 #  define _USER v4wb
0056 # endif
0057 #endif
0058 
0059 #ifdef CONFIG_CPU_COPY_FEROCEON
0060 # ifdef _USER
0061 #  define MULTI_USER 1
0062 # else
0063 #  define _USER feroceon
0064 # endif
0065 #endif
0066 
0067 #ifdef CONFIG_CPU_COPY_FA
0068 # ifdef _USER
0069 #  define MULTI_USER 1
0070 # else
0071 #  define _USER fa
0072 # endif
0073 #endif
0074 
0075 #ifdef CONFIG_CPU_SA1100
0076 # ifdef _USER
0077 #  define MULTI_USER 1
0078 # else
0079 #  define _USER v4_mc
0080 # endif
0081 #endif
0082 
0083 #ifdef CONFIG_CPU_XSCALE
0084 # ifdef _USER
0085 #  define MULTI_USER 1
0086 # else
0087 #  define _USER xscale_mc
0088 # endif
0089 #endif
0090 
0091 #ifdef CONFIG_CPU_XSC3
0092 # ifdef _USER
0093 #  define MULTI_USER 1
0094 # else
0095 #  define _USER xsc3_mc
0096 # endif
0097 #endif
0098 
0099 #ifdef CONFIG_CPU_COPY_V6
0100 # define MULTI_USER 1
0101 #endif
0102 
0103 #if !defined(_USER) && !defined(MULTI_USER)
0104 #error Unknown user operations model
0105 #endif
0106 
0107 struct page;
0108 struct vm_area_struct;
0109 
0110 struct cpu_user_fns {
0111     void (*cpu_clear_user_highpage)(struct page *page, unsigned long vaddr);
0112     void (*cpu_copy_user_highpage)(struct page *to, struct page *from,
0113             unsigned long vaddr, struct vm_area_struct *vma);
0114 };
0115 
0116 #ifdef MULTI_USER
0117 extern struct cpu_user_fns cpu_user;
0118 
0119 #define __cpu_clear_user_highpage   cpu_user.cpu_clear_user_highpage
0120 #define __cpu_copy_user_highpage    cpu_user.cpu_copy_user_highpage
0121 
0122 #else
0123 
0124 #define __cpu_clear_user_highpage   __glue(_USER,_clear_user_highpage)
0125 #define __cpu_copy_user_highpage    __glue(_USER,_copy_user_highpage)
0126 
0127 extern void __cpu_clear_user_highpage(struct page *page, unsigned long vaddr);
0128 extern void __cpu_copy_user_highpage(struct page *to, struct page *from,
0129             unsigned long vaddr, struct vm_area_struct *vma);
0130 #endif
0131 
0132 #define clear_user_highpage(page,vaddr)     \
0133      __cpu_clear_user_highpage(page, vaddr)
0134 
0135 #define __HAVE_ARCH_COPY_USER_HIGHPAGE
0136 #define copy_user_highpage(to,from,vaddr,vma)   \
0137     __cpu_copy_user_highpage(to, from, vaddr, vma)
0138 
0139 #define clear_page(page)    memset((void *)(page), 0, PAGE_SIZE)
0140 extern void copy_page(void *to, const void *from);
0141 
0142 #ifdef CONFIG_KUSER_HELPERS
0143 #define __HAVE_ARCH_GATE_AREA 1
0144 #endif
0145 
0146 #ifdef CONFIG_ARM_LPAE
0147 #include <asm/pgtable-3level-types.h>
0148 #else
0149 #include <asm/pgtable-2level-types.h>
0150 #ifdef CONFIG_VMAP_STACK
0151 #define ARCH_PAGE_TABLE_SYNC_MASK   PGTBL_PMD_MODIFIED
0152 #endif
0153 #endif
0154 
0155 #endif /* CONFIG_MMU */
0156 
0157 typedef struct page *pgtable_t;
0158 
0159 #ifdef CONFIG_HAVE_ARCH_PFN_VALID
0160 extern int pfn_valid(unsigned long);
0161 #endif
0162 
0163 #include <asm/memory.h>
0164 
0165 #endif /* !__ASSEMBLY__ */
0166 
0167 #define VM_DATA_DEFAULT_FLAGS   VM_DATA_FLAGS_TSK_EXEC
0168 
0169 #include <asm-generic/getorder.h>
0170 
0171 #endif