1# zx_vmar_unmap
2
3## NAME
4
5<!-- Updated by update-docs-from-abigen, do not edit. -->
6
7vmar_unmap - unmap virtual memory pages
8
9## SYNOPSIS
10
11<!-- Updated by update-docs-from-abigen, do not edit. -->
12
13```
14#include <zircon/syscalls.h>
15
16zx_status_t zx_vmar_unmap(zx_handle_t handle, zx_vaddr_t addr, uint64_t len);
17```
18
19## DESCRIPTION
20
21`zx_vmar_unmap()` unmaps all VMO mappings and destroys (as if [`zx_vmar_destroy()`]
22were called) all sub-regions within the absolute range including *addr* and ending
23before exclusively at `addr + len`.  Any sub-region that is in the range must
24be fully in the range (i.e. partial overlaps are an error).  If a mapping is
25only partially in the range, the mapping is split and the requested portion is
26unmapped.
27
28*len* must be page-aligned.
29
30## RIGHTS
31
32<!-- Updated by update-docs-from-abigen, do not edit. -->
33
34TODO(ZX-2399)
35
36## RETURN VALUE
37
38`zx_vmar_unmap()` returns **ZX_OK** on success.
39
40## ERRORS
41
42**ZX_ERR_BAD_HANDLE**  *handle* is not a valid handle.
43
44**ZX_ERR_WRONG_TYPE**  *handle* is not a VMAR handle.
45
46**ZX_ERR_INVALID_ARGS**  *addr* is not page-aligned, *len* is 0 or not page-aligned,
47or the requested range partially overlaps a sub-region.
48
49**ZX_ERR_BAD_STATE**  *handle* refers to a destroyed handle.
50
51**ZX_ERR_NOT_FOUND**  Could not find the requested mapping.
52
53## NOTES
54
55## SEE ALSO
56
57 - [`zx_vmar_allocate()`]
58 - [`zx_vmar_destroy()`]
59 - [`zx_vmar_map()`]
60 - [`zx_vmar_protect()`]
61
62<!-- References updated by update-docs-from-abigen, do not edit. -->
63
64[`zx_vmar_allocate()`]: vmar_allocate.md
65[`zx_vmar_destroy()`]: vmar_destroy.md
66[`zx_vmar_map()`]: vmar_map.md
67[`zx_vmar_protect()`]: vmar_protect.md
68