blob: ecc630229c3e76525d3ea4b5317cd30967d10781 [file] [log] [blame]
Christopher Ferris05d08e92016-02-04 13:16:38 -08001/****************************************************************************
2 ****************************************************************************
3 ***
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
9 ***
10 *** To edit the content of this header, modify the corresponding
11 *** source file (e.g. under external/kernel-headers/original/) then
12 *** run bionic/libc/kernel/tools/update_all.py
13 ***
14 *** Any manual change here will be lost the next time this script will
15 *** be run. You've been warned!
16 ***
17 ****************************************************************************
18 ****************************************************************************/
19#ifndef _LINUX_USERFAULTFD_H
20#define _LINUX_USERFAULTFD_H
21#include <linux/types.h>
22#define UFFD_API ((__u64) 0xAA)
Christopher Ferris1308ad32017-11-14 17:32:13 -080023#define UFFD_API_FEATURES (UFFD_FEATURE_EVENT_FORK | UFFD_FEATURE_EVENT_REMAP | UFFD_FEATURE_EVENT_REMOVE | UFFD_FEATURE_EVENT_UNMAP | UFFD_FEATURE_MISSING_HUGETLBFS | UFFD_FEATURE_MISSING_SHMEM | UFFD_FEATURE_SIGBUS | UFFD_FEATURE_THREAD_ID)
Christopher Ferris05d08e92016-02-04 13:16:38 -080024#define UFFD_API_IOCTLS ((__u64) 1 << _UFFDIO_REGISTER | (__u64) 1 << _UFFDIO_UNREGISTER | (__u64) 1 << _UFFDIO_API)
25#define UFFD_API_RANGE_IOCTLS ((__u64) 1 << _UFFDIO_WAKE | (__u64) 1 << _UFFDIO_COPY | (__u64) 1 << _UFFDIO_ZEROPAGE)
Christopher Ferris525ce912017-07-26 13:12:53 -070026#define UFFD_API_RANGE_IOCTLS_BASIC ((__u64) 1 << _UFFDIO_WAKE | (__u64) 1 << _UFFDIO_COPY)
Christopher Ferris05d08e92016-02-04 13:16:38 -080027#define _UFFDIO_REGISTER (0x00)
Christopher Ferris05d08e92016-02-04 13:16:38 -080028#define _UFFDIO_UNREGISTER (0x01)
29#define _UFFDIO_WAKE (0x02)
30#define _UFFDIO_COPY (0x03)
31#define _UFFDIO_ZEROPAGE (0x04)
Christopher Ferris05d08e92016-02-04 13:16:38 -080032#define _UFFDIO_API (0x3F)
33#define UFFDIO 0xAA
34#define UFFDIO_API _IOWR(UFFDIO, _UFFDIO_API, struct uffdio_api)
35#define UFFDIO_REGISTER _IOWR(UFFDIO, _UFFDIO_REGISTER, struct uffdio_register)
Christopher Ferris05d08e92016-02-04 13:16:38 -080036#define UFFDIO_UNREGISTER _IOR(UFFDIO, _UFFDIO_UNREGISTER, struct uffdio_range)
37#define UFFDIO_WAKE _IOR(UFFDIO, _UFFDIO_WAKE, struct uffdio_range)
38#define UFFDIO_COPY _IOWR(UFFDIO, _UFFDIO_COPY, struct uffdio_copy)
39#define UFFDIO_ZEROPAGE _IOWR(UFFDIO, _UFFDIO_ZEROPAGE, struct uffdio_zeropage)
Christopher Ferris05d08e92016-02-04 13:16:38 -080040struct uffd_msg {
41 __u8 event;
42 __u8 reserved1;
43 __u16 reserved2;
Christopher Ferris05d08e92016-02-04 13:16:38 -080044 __u32 reserved3;
45 union {
46 struct {
47 __u64 flags;
Christopher Ferris05d08e92016-02-04 13:16:38 -080048 __u64 address;
Christopher Ferris1308ad32017-11-14 17:32:13 -080049 union {
50 __u32 ptid;
51 } feat;
Christopher Ferris05d08e92016-02-04 13:16:38 -080052 } pagefault;
53 struct {
Christopher Ferris525ce912017-07-26 13:12:53 -070054 __u32 ufd;
55 } fork;
56 struct {
57 __u64 from;
58 __u64 to;
59 __u64 len;
60 } remap;
61 struct {
62 __u64 start;
63 __u64 end;
64 } remove;
65 struct {
Christopher Ferris05d08e92016-02-04 13:16:38 -080066 __u64 reserved1;
Christopher Ferris05d08e92016-02-04 13:16:38 -080067 __u64 reserved2;
68 __u64 reserved3;
69 } reserved;
70 } arg;
Christopher Ferris05d08e92016-02-04 13:16:38 -080071} __packed;
72#define UFFD_EVENT_PAGEFAULT 0x12
Christopher Ferris525ce912017-07-26 13:12:53 -070073#define UFFD_EVENT_FORK 0x13
74#define UFFD_EVENT_REMAP 0x14
75#define UFFD_EVENT_REMOVE 0x15
76#define UFFD_EVENT_UNMAP 0x16
Christopher Ferris05d08e92016-02-04 13:16:38 -080077#define UFFD_PAGEFAULT_FLAG_WRITE (1 << 0)
78#define UFFD_PAGEFAULT_FLAG_WP (1 << 1)
Christopher Ferris05d08e92016-02-04 13:16:38 -080079struct uffdio_api {
80 __u64 api;
Christopher Ferris525ce912017-07-26 13:12:53 -070081#define UFFD_FEATURE_PAGEFAULT_FLAG_WP (1 << 0)
82#define UFFD_FEATURE_EVENT_FORK (1 << 1)
83#define UFFD_FEATURE_EVENT_REMAP (1 << 2)
84#define UFFD_FEATURE_EVENT_REMOVE (1 << 3)
85#define UFFD_FEATURE_MISSING_HUGETLBFS (1 << 4)
86#define UFFD_FEATURE_MISSING_SHMEM (1 << 5)
87#define UFFD_FEATURE_EVENT_UNMAP (1 << 6)
Christopher Ferris1308ad32017-11-14 17:32:13 -080088#define UFFD_FEATURE_SIGBUS (1 << 7)
89#define UFFD_FEATURE_THREAD_ID (1 << 8)
Christopher Ferris05d08e92016-02-04 13:16:38 -080090 __u64 features;
91 __u64 ioctls;
Christopher Ferris05d08e92016-02-04 13:16:38 -080092};
93struct uffdio_range {
94 __u64 start;
95 __u64 len;
Christopher Ferris05d08e92016-02-04 13:16:38 -080096};
97struct uffdio_register {
98 struct uffdio_range range;
99#define UFFDIO_REGISTER_MODE_MISSING ((__u64) 1 << 0)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800100#define UFFDIO_REGISTER_MODE_WP ((__u64) 1 << 1)
101 __u64 mode;
102 __u64 ioctls;
103};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800104struct uffdio_copy {
105 __u64 dst;
106 __u64 src;
107 __u64 len;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800108#define UFFDIO_COPY_MODE_DONTWAKE ((__u64) 1 << 0)
109 __u64 mode;
110 __s64 copy;
111};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800112struct uffdio_zeropage {
113 struct uffdio_range range;
114#define UFFDIO_ZEROPAGE_MODE_DONTWAKE ((__u64) 1 << 0)
115 __u64 mode;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800116 __s64 zeropage;
117};
118#endif