blob: 79e0f22c7b5bc962d969018e1a17f771603c53d9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef __ZERO_PAGE_H
#define __ZERO_PAGE_H
#include <common.h>
#if defined CONFIG_ARCH_HAS_ZERO_PAGE && defined CONFIG_MMU && !defined __PBL__
/*
* zero_page_faulting - fault when accessing the zero page
*/
void zero_page_faulting(void);
/*
* zero_page_access - allow accesses to the zero page
*
* Disable the null pointer trap on the zero page if access to the zero page
* is actually required. Disable the trap with care and re-enable it
* immediately after the access to properly trap null pointers.
*/
void zero_page_access(void);
void zero_page_access(void);
static inline bool zero_page_remappable(void)
{
return true;
}
#else
static inline void zero_page_faulting(void)
{
}
static inline void zero_page_access(void)
{
}
static inline bool zero_page_remappable(void)
{
return false;
}
#endif
static inline bool zero_page_contains(unsigned long addr)
{
return addr < PAGE_SIZE;
}
/*
* zero_page_memcpy - copy to or from an address located in the zero page
*/
static inline void *zero_page_memcpy(void *dest, const void *src, size_t count)
{
void *ret;
OPTIMIZER_HIDE_VAR(dest);
zero_page_access();
ret = memcpy(dest, src, count);
zero_page_faulting();
return ret;
}
#endif /* __ZERO_PAGE_H */
|