1SUBPAGE_PROT(2)            Linux Programmer's Manual           SUBPAGE_PROT(2)
2
3
4

NAME

6       subpage_prot - define a subpage protection for an address range
7

SYNOPSIS

9       long subpage_prot(unsigned long addr, unsigned long len,
10                         uint32_t *map);
11
12       Note: There is no glibc wrapper for this system call; see NOTES.
13

DESCRIPTION

15       The  PowerPC-specific  subpage_prot() system call provides the facility
16       to control the access permissions on individual 4 kB subpages  on  sys‐
17       tems configured with a page size of 64 kB.
18
19       The  protection map is applied to the memory pages in the region start‐
20       ing at addr and continuing for len bytes.  Both of these arguments must
21       be aligned to a 64-kB boundary.
22
23       The  protection  map is specified in the buffer pointed to by map.  The
24       map has 2 bits per 4 kB subpage; thus each 32-bit  word  specifies  the
25       protections  of 16 4 kB subpages inside a 64 kB page (so, the number of
26       32-bit words pointed to by map should equate to  the  number  of  64-kB
27       pages  specified  by  len).   Each 2-bit field in the protection map is
28       either 0 to allow any access, 1 to prevent writes, or 2 or 3 to prevent
29       all accesses.
30

RETURN VALUE

32       On  success,  subpage_prot()  returns  0.   Otherwise, one of the error
33       codes specified below is returned.
34

ERRORS

36       EFAULT The buffer referred to by map is not accessible.
37
38       EINVAL The addr or len arguments are incorrect.  Both  of  these  argu‐
39              ments must be aligned to a multiple of the system page size, and
40              they must not refer to a region outside of the address space  of
41              the process or to a region that consists of huge pages.
42
43       ENOMEM Out of memory.
44

VERSIONS

46       This  system  call  is provided on the PowerPC architecture since Linux
47       2.6.25.  The system call is provided only if the kernel  is  configured
48       with CONFIG_PPC_64K_PAGES.  No library support is provided.
49

CONFORMING TO

51       This system call is Linux-specific.
52

NOTES

54       Glibc  does  not  provide a wrapper for this system call; call it using
55       syscall(2).
56
57       Normal page protections (at the 64-kB page level) also apply; the  sub‐
58       page  protection mechanism is an additional constraint, so putting 0 in
59       a 2-bit field won't allow writes to a page that is otherwise write-pro‐
60       tected.
61
62   Rationale
63       This  system  call is provided to assist writing emulators that operate
64       using 64-kB pages on PowerPC systems.  When emulating systems  such  as
65       x86, which uses a smaller page size, the emulator can no longer use the
66       memory-management unit (MMU) and normal system  calls  for  controlling
67       page  protections.  (The emulator could emulate the MMU by checking and
68       possibly remapping the address for each memory access in software,  but
69       that is slow.)  The idea is that the emulator supplies an array of pro‐
70       tection masks to apply to  a  specified  range  of  virtual  addresses.
71       These  masks are applied at the level where hardware page-table entries
72       (PTEs) are inserted into the hardware page table  based  on  the  Linux
73       PTEs, so the Linux PTEs are not affected.  Implicit in this is that the
74       regions of the address space that are protected  are  switched  to  use
75       4-kB  hardware pages rather than 64-kB hardware pages (on machines with
76       hardware 64-kB page support).
77

SEE ALSO

79       mprotect(2), syscall(2)
80
81       Documentation/vm/hugetlbpage.txt in the Linux kernel source tree
82

COLOPHON

84       This page is part of release 4.15 of the Linux  man-pages  project.   A
85       description  of  the project, information about reporting bugs, and the
86       latest    version    of    this    page,    can     be     found     at
87       https://www.kernel.org/doc/man-pages/.
88
89
90
91Linux                             2017-09-15                   SUBPAGE_PROT(2)
Impressum