1 // Copyright 2016 The Fuchsia Authors
2 //
3 // Use of this source code is governed by a MIT-style
4 // license that can be found in the LICENSE file or at
5 // https://opensource.org/licenses/MIT
6 
7 #pragma once
8 
9 #include <err.h>
10 #include <zircon/compiler.h>
11 #include <zircon/types.h>
12 
13 __BEGIN_CDECLS
14 
15 /*
16  * @brief Copy data from userspace into kernelspace
17  *
18  * This function validates that usermode has access to src before copying the
19  * data.
20  *
21  * @param dst The destination buffer.
22  * @param src The source buffer.
23  * @param len The number of bytes to copy.
24  *
25  * @return ZX_OK on success
26  */
27 zx_status_t arch_copy_from_user(void *dst, const void *src, size_t len);
28 
29 /*
30  * @brief Copy data from kernelspace into userspace
31  *
32  * This function validates that usermode has access to dst before copying the
33  * data.
34  *
35  * @param dst The destination buffer.
36  * @param src The source buffer.
37  * @param len The number of bytes to copy.
38  *
39  * @return ZX_OK on success
40  */
41 zx_status_t arch_copy_to_user(void *dst, const void *src, size_t len);
42 
43 __END_CDECLS
44