1 .\" Copyright (c) 2010 Michael Kerrisk <mtk.manpages@gmail.com>
2 .\" based on a proposal from Stephan Mueller <smueller@atsec.com>
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of
9 .\" this manual under the conditions for verbatim copying, provided that
10 .\" the entire resulting derived work is distributed under the terms of
11 .\" a permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume.
15 .\" no responsibility for errors or omissions, or for damages resulting.
16 .\" from the use of the information contained herein. The author(s) may.
17 .\" not have taken the same level of care in the production of this.
18 .\" manual, which is licensed free of charge, as they might when working.
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" Various pieces of text taken from the kernel source and the commentary
25 .\" in kernel commit fa28237cfcc5827553044cbd6ee52e33692b0faa
26 .\" both written by Paul Mackerras <paulus@samba.org>
28 .TH SUBPAGE_PROT 2 2012-07-13 "Linux" "Linux Programmer's Manual"
30 subpage_prot \- define a subpage protection for an address range
33 .BI "long subpage_prot(unsigned long " addr ", unsigned long " len ,
34 .BI " uint32_t *" map ");
38 There is no glibc wrapper for this system call; see NOTES.
42 system call provides the facility to control the access
43 permissions on individual 4kB subpages on systems configured with
46 The protection map is applied to the memory pages in the region starting at
51 Both of these arguments must be aligned to a 64-kB boundary.
53 The protection map is specified in the buffer pointed to by
55 The map has 2 bits per 4kB subpage;
56 thus each 32-bit word specifies the protections of 16 4kB subpages
58 (so, the number of 32-bit words pointed to by
60 should equate to the number of 64-kB pages specified by
62 Each 2-bit field in the protection map is either 0 to allow any access,
63 1 to prevent writes, or 2 or 3 to prevent all accesses.
68 Otherwise, one of the error codes specified below is returned.
72 The buffer referred to by
81 arguments are incorrect.
82 Both of these arguments must be aligned to a multiple of the system page size,
83 and they must not refer to a region outside of the
84 address space of the process or to a region that consists of huge pages.
89 This system call is provided on the PowerPC architecture
91 The system call is provided only if the kernel is configured with
92 .BR CONFIG_PPC_64K_PAGES .
93 No library support is provided.
95 This system call is Linux-specific.
97 Glibc does not provide a wrapper for this system call; call it using
100 Normal page protections (at the 64-kB page level) also apply;
101 the subpage protection mechanism is an additional constraint,
102 so putting 0 in a 2-bit field won't allow writes to a page that is otherwise
105 This system call is provided to assist writing emulators that
106 operate using 64-kB pages on PowerPC systems.
107 When emulating systems such as x86, which uses a smaller page size,
108 the emulator can no longer use the memory-management unit (MMU)
109 and normal system calls for controlling page protections.
110 (The emulator could emulate the MMU by checking and possibly remapping
111 the address for each memory access in software, but that is slow.)
112 The idea is that the emulator supplies an array of protection masks
113 to apply to a specified range of virtual addresses.
114 These masks are applied at the level where hardware page-table entries (PTEs)
115 are inserted into the hardware page table based on the Linux PTEs,
116 so the Linux PTEs are not affected.
117 Implicit in this is that the regions of the address space that are
118 protected are switched to use 4-kB hardware pages rather than 64-kB
119 hardware pages (on machines with hardware 64-kB page support).
120 .\" In the initial implementation, it was the case that:
121 .\" In fact the whole process is switched to use 4k hardware pages when the
122 .\" subpage_prot system call is used, but this could be improved in future
123 .\" to switch only the affected segments.
124 .\" But Paul Mackerass says (Oct 2010): I'm pretty sure we now only switch
125 .\" the affected segment, not the whole process.
130 the kernel source file
131 .IR Documentation/vm/hugetlbpage.txt .