/* SPDX-License-Identifier: GPL-2.0-only */
/*
* arch/arm/include/asm/page.h
*
* Copyright (C) 1995-2003 Russell King
*/
#ifndef _ASMARM_PAGE_H
#define _ASMARM_PAGE_H
/* PAGE_SHIFT determines the page size */
#define PAGE_SHIFT 12
#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1))
#ifndef __ASSEMBLY__
#ifndef [31mCONFIG_MMU[0m
#include <asm/page-nommu.h>
#else
#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
* xsc3 - XScalev3
*/
#undef _USER
#undef MULTI_USER
#ifdef [31mCONFIG_CPU_COPY_V4WT[0m
# ifdef _USER
# define MULTI_USER 1
# else
# define _USER v4wt
# endif
#endif
#ifdef [31mCONFIG_CPU_COPY_V4WB[0m
# ifdef _USER
# define MULTI_USER 1
# else
# define _USER v4wb
# endif
#endif
#ifdef [31mCONFIG_CPU_COPY_FEROCEON[0m
# ifdef _USER
# define MULTI_USER 1
# else
# define _USER feroceon
# endif
#endif
#ifdef [31mCONFIG_CPU_COPY_FA[0m
# ifdef _USER
# define MULTI_USER 1
# else
# define _USER fa
# endif
#endif
#ifdef [31mCONFIG_CPU_SA1100[0m
# ifdef _USER
# define MULTI_USER 1
# else
# define _USER v4_mc
# endif
#endif
#ifdef [31mCONFIG_CPU_XSCALE[0m
# ifdef _USER
# define MULTI_USER 1
# else
# define _USER xscale_mc
# endif
#endif
#ifdef [31mCONFIG_CPU_XSC3[0m
# ifdef _USER
# define MULTI_USER 1
# else
# define _USER xsc3_mc
# endif
#endif
#ifdef [31mCONFIG_CPU_COPY_V6[0m
# define MULTI_USER 1
#endif
#if !defined(_USER) && !defined(MULTI_USER)
#error Unknown user operations model
#endif
struct page;
struct vm_area_struct;
struct cpu_user_fns {
void (*cpu_clear_user_highpage)(struct page *page, unsigned long vaddr);
void (*cpu_copy_user_highpage)(struct page *to, struct page *from,
unsigned long vaddr, struct vm_area_struct *vma);
};
#ifdef MULTI_USER
extern struct cpu_user_fns cpu_user;
#define __cpu_clear_user_highpage cpu_user.cpu_clear_user_highpage
#define __cpu_copy_user_highpage cpu_user.cpu_copy_user_highpage
#else
#define __cpu_clear_user_highpage __glue(_USER,_clear_user_highpage)
#define __cpu_copy_user_highpage __glue(_USER,_copy_user_highpage)
extern void __cpu_clear_user_highpage(struct page *page, unsigned long vaddr);
extern void __cpu_copy_user_highpage(struct page *to, struct page *from,
unsigned long vaddr, struct vm_area_struct *vma);
#endif
#define clear_user_highpage(page,vaddr) \
__cpu_clear_user_highpage(page, vaddr)
#define __HAVE_ARCH_COPY_USER_HIGHPAGE
#define copy_user_highpage(to,from,vaddr,vma) \
__cpu_copy_user_highpage(to, from, vaddr, vma)
#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
extern void copy_page(void *to, const void *from);
#ifdef [31mCONFIG_KUSER_HELPERS[0m
#define __HAVE_ARCH_GATE_AREA 1
#endif
#ifdef [31mCONFIG_ARM_LPAE[0m
#include <asm/pgtable-3level-types.h>
#else
#include <asm/pgtable-2level-types.h>
#endif
#endif /* CONFIG_MMU */
typedef struct page *pgtable_t;
#ifdef [31mCONFIG_HAVE_ARCH_PFN_VALID[0m
extern int pfn_valid(unsigned long);
#endif
#include <asm/memory.h>
#endif /* !__ASSEMBLY__ */
#define VM_DATA_DEFAULT_FLAGS \
(((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0) | \
VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
#include <asm-generic/getorder.h>
#endif