summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorDiego Nieto Cid <dnietoc@gmail.com>2025-09-21 21:23:42 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2025-09-22 00:51:29 +0200
commit9ae4d99c1d1e7c9c0977cebb4df9b86fa92cca94 (patch)
tree62e1baaaefde974b943755eb8771ad0a2ca182f4 /doc
parent1269629d90b28a23ef9742645cfaf657ea3165bb (diff)
Implement per-task virtual memory limitHEADmaster
* doc/mach.texi: add a "Memory Limitations" section to document the new interfaces. * include/mach/gnumach.defs: (vm_set_size_limit) new routine (vm_get_size_limit) likewise * kern/task.c: (task_create_kernel) if parent_task is not null copy virtual memory limit * tests/test-vm.c: (test_vm_limit) add test for the new routines * vm/vm_map.h: (struct vm_map) new fields size_none, size_cur_limit and size_max_limit (vm_map_find_entry) add new parameters cur_protection and max_protection * vm/vm_map.c: (vm_map_setup) initialize new fields (vm_map_enforce_limit) new function (vm_map_copy_limits) new function (vm_map_find_entry) add protection and max_protection parameters. call limit enforcer function (vm_map_enter) likewise (vm_map_copyout) likewise (vm_map_copyout_page_list) likewise (vm_map_fork) copy parent limit to the new map and compute and set size_none of the new map * vm/vm_user.c: (vm_set_size_limit) new function (vm_get_size_limit) likewise * xen/grant.c: update call to vm_map_find_entry to pass protection parameters Message-ID: <0b71f4f89b7cc2b159893a805480d7493d522d60.1758485757.git.dnietoc@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/mach.texi29
1 files changed, 29 insertions, 0 deletions
diff --git a/doc/mach.texi b/doc/mach.texi
index e2328c1b..1f28cea3 100644
--- a/doc/mach.texi
+++ b/doc/mach.texi
@@ -203,6 +203,7 @@ Virtual Memory Interface
* Data Transfer:: Reading, writing and copying memory.
* Memory Attributes:: Tweaking memory regions.
* Mapping Memory Objects:: How to map memory objects.
+* Memory Limitations:: Tweaking virtual memory space limts.
* Memory Statistics:: How to get statistics about memory usage.
External Memory Management
@@ -3029,6 +3030,7 @@ the kernel.
* Data Transfer:: Reading, writing and copying memory.
* Memory Attributes:: Tweaking memory regions.
* Mapping Memory Objects:: How to map memory objects.
+* Memory Limitations:: Tweaking virtual memory limits.
* Memory Statistics:: How to get statistics about memory usage.
* Memory physical addresses:: How to get physical addresses of memory.
@end menu
@@ -3476,6 +3478,33 @@ found, and @code{KERN_INVALID_ARGUMENT} if an invalid argument was provided.
@end deftypefun
+@node Memory Limitations
+@section Memory Limitations
+
+@deftypefun kern_reutrn_t vm_get_size_limit (@w{vm_task_t @var{map}}, @w{vm_size_t *@var{current_limit}}, @w{vm_size_t *@var{max_limit}})
+This function will return the current limit and the maximum limit of the
+virtual memory address space of the task indicated by the @var{map} argument
+in the parameters @var{current_limit} and @var{max_limit}, respectively.
+@end deftypefun
+
+@deftypefun kern_return_t vm_set_size_limit (@w{mach_port_t @var{host_port}}, @w{vm_task_t @var{map}}, @w{vm_size_t @var{current_limit}}, @w{vm_size_t @var{max_limit}})
+This function shall be used to update the virtual address space limits
+of the task given by the @var{map} argument.
+
+If the value of the argument @var{current_limit} is greater than @var{max_limit},
+the function returns @code{KERN_INVALID_ARGUMENT}. The privileged host port
+must be provided in the @var{host_port} argument when the function is used
+to increase the current max limit of the address space. Otherwise the function
+returns @code{KERN_NO_ACCESS}.
+
+The function returns @code{KERN_INVALID_TASK} or @code{KERN_INVALID_HOST} when
+the arguments @var{map} and @var{host_port} are not a vlaid task or host, respectively.
+
+@code{KERN_SUCCESS} is returned when the map limits could be updated
+successfuly.
+@end deftypefun
+
+
@node Memory Statistics
@section Memory Statistics