1// Copyright 2016 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include <lib/zx/vmar.h>
6
7#include <zircon/syscalls.h>
8
9namespace zx {
10
11zx_status_t vmar::allocate(size_t offset, size_t size, zx_vm_option_t options,
12                           vmar* child, uintptr_t* child_addr) const {
13    // Allow for aliasing of |child| to the same container as |this|.
14    vmar h;
15    zx_status_t status = zx_vmar_allocate(
16        get(), options, offset, size, h.reset_and_get_address(), child_addr);
17    child->reset(h.release());
18    return status;
19}
20
21} // namespace zx
22