1 .\"
2 .\" Mach Operating System
3 .\" Copyright (c) 1991,1990 Carnegie Mellon University
4 .\" All Rights Reserved.
5 .\"
6 .\" Permission to use, copy, modify and distribute this software and its
7 .\" documentation is hereby granted, provided that both the copyright
8 .\" notice and this permission notice appear in all copies of the
9 .\" software, derivative works or modified versions, and any portions
10 .\" thereof, and that both notices appear in supporting documentation.
11 .\"
12 .\" CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 .\" CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 .\" ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 .\"
16 .\" Carnegie Mellon requests users of this software to return to
17 .\"
18 .\" Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 .\" School of Computer Science
20 .\" Carnegie Mellon University
21 .\" Pittsburgh PA 15213-3890
22 .\"
23 .\" any improvements or extensions that they make and grant Carnegie Mellon
24 .\" the rights to redistribute these changes.
25 .\"
26 .\"
27 .\" HISTORY
28 .\" $Log: vm_protect.man,v $
29 .\" Revision 2.6 93/03/18 15:16:54 mrt
30 .\" corrected types
31 .\" [93/03/12 16:55:31 lli]
32 .\"
33 .\" Revision 2.5 91/05/14 17:16:04 mrt
34 .\" Correcting copyright
35 .\"
36 .\" Revision 2.4 91/02/14 14:16:26 mrt
37 .\" Changed to new Mach copyright
38 .\" [91/02/12 18:17:28 mrt]
39 .\"
40 .\" Revision 2.3 90/08/07 21:52:31 rpd
41 .\" Fixed the description of how protection enforcement
42 .\" is machine-dependent.
43 .\" [90/08/07 rpd]
44 .\"
45 .\" Revision 2.2 90/08/07 18:47:51 rpd
46 .\" Created.
47 .\"
48 .TH vm_protect 2 9/19/86
49 .CM 4
50 .SH NAME
51 .nf
52 vm_protect \- change protection of task's memory
53 .SH SYNOPSIS
54 .nf
55 .ft B
56 #include <mach.h>
57
58 .nf
59 .ft B
60 kern_return_t vm_protect(target_task, address, size, set_maximum,
61 new_protection)
62 mach_port_t target_task;
63 vm_address_t address;
64 vm_size_t size;
65 boolean_t set_maximum;
66 vm_prot_t new_protection;
67
68
69 .fi
70 .ft P
71 .SH ARGUMENTS
72 .TP 15
73 .B
74 target_task
75 Task whose virtual memory is to be affected.
76 .TP 15
77 .B
78 address
79 Starting address (will be rounded down to a
80 page boundary).
81 .TP 15
82 .B
83 size
84 Size in bytes of the region for which protection
85 is to change (will be rounded up to give a page boundary).
86 .TP 15
87 .B
88 set_maximum
89 If set, make the protection change apply to the
90 maximum protection associated with this address range;
91 otherwise, the current protection on this
92 range is changed. If the maximum protection is reduced below the
93 current protection, both will be changed to reflect the new maximum.
94 .TP 15
95 .B
96 new_protection
97 A new protection value for this region; a set of:
98 \fBVM_PROT_READ\fR, \fBVM_PROT_WRITE\fR, \fBVM_PROT_EXECUTE\fR.
99
100 .SH DESCRIPTION
101 .B vm_protect
102 sets the virtual memory access privileges for a
103 range of allocated addresses in a task's virtual address space.
104 The protection argument describes a combination of read, write,
105 and execute accesses that should be \fBpermitted\fR.
106
107 The enforcement of virtual memory protection is machine-dependent.
108 Nominally read access requires VM_PROT_READ permission, write access
109 requires VM_PROT_WRITE permission, and execute access requires
110 VM_PROT_EXECUTE permission. However, some combinations of access
111 rights may not be supported. In particular, the kernel interface
112 allows write access to require VM_PROT_READ and VM_PROT_WRITE
113 permission and execute access to require VM_PROT_READ permission.
114
115 .SH DIAGNOSTICS
116 .TP 25
117 KERN_SUCCESS
118 Memory protected.
119 .TP 25
120 KERN_PROTECTION_FAILURE
121 An attempt was made to increase the current
122 or maximum protection beyond the existing maximum protection value.
123 .TP 25
124 KERN_INVALID_ADDRESS
125 Illegal or non-allocated address specified.
Cache object: 8ec6d20ba72f6679b3a485246cd150fc
|