Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 1 | /**************************************************************************** |
| 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 _UAPI__LINUX_BTF_H__ |
| 20 | #define _UAPI__LINUX_BTF_H__ |
| 21 | #include <linux/types.h> |
| 22 | #define BTF_MAGIC 0xeB9F |
| 23 | #define BTF_VERSION 1 |
| 24 | struct btf_header { |
| 25 | __u16 magic; |
| 26 | __u8 version; |
| 27 | __u8 flags; |
| 28 | __u32 hdr_len; |
| 29 | __u32 type_off; |
| 30 | __u32 type_len; |
| 31 | __u32 str_off; |
| 32 | __u32 str_len; |
| 33 | }; |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 34 | #define BTF_MAX_TYPE 0x000fffff |
| 35 | #define BTF_MAX_NAME_OFFSET 0x00ffffff |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 36 | #define BTF_MAX_VLEN 0xffff |
| 37 | struct btf_type { |
| 38 | __u32 name_off; |
| 39 | __u32 info; |
| 40 | union { |
| 41 | __u32 size; |
| 42 | __u32 type; |
| 43 | }; |
| 44 | }; |
Christopher Ferris | fcc3b4f | 2021-07-01 01:30:21 +0000 | [diff] [blame] | 45 | #define BTF_INFO_KIND(info) (((info) >> 24) & 0x1f) |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 46 | #define BTF_INFO_VLEN(info) ((info) & 0xffff) |
Christopher Ferris | d842e43 | 2019-03-07 10:21:59 -0800 | [diff] [blame] | 47 | #define BTF_INFO_KFLAG(info) ((info) >> 31) |
Christopher Ferris | a479261 | 2022-01-10 13:51:15 -0800 | [diff] [blame] | 48 | enum { |
| 49 | BTF_KIND_UNKN = 0, |
| 50 | BTF_KIND_INT = 1, |
| 51 | BTF_KIND_PTR = 2, |
| 52 | BTF_KIND_ARRAY = 3, |
| 53 | BTF_KIND_STRUCT = 4, |
| 54 | BTF_KIND_UNION = 5, |
| 55 | BTF_KIND_ENUM = 6, |
| 56 | BTF_KIND_FWD = 7, |
| 57 | BTF_KIND_TYPEDEF = 8, |
| 58 | BTF_KIND_VOLATILE = 9, |
| 59 | BTF_KIND_CONST = 10, |
| 60 | BTF_KIND_RESTRICT = 11, |
| 61 | BTF_KIND_FUNC = 12, |
| 62 | BTF_KIND_FUNC_PROTO = 13, |
| 63 | BTF_KIND_VAR = 14, |
| 64 | BTF_KIND_DATASEC = 15, |
| 65 | BTF_KIND_FLOAT = 16, |
| 66 | BTF_KIND_DECL_TAG = 17, |
Christopher Ferris | 1ed5534 | 2022-03-22 16:06:25 -0700 | [diff] [blame] | 67 | BTF_KIND_TYPE_TAG = 18, |
Christopher Ferris | 7447a1c | 2022-10-04 18:24:44 -0700 | [diff] [blame] | 68 | BTF_KIND_ENUM64 = 19, |
Christopher Ferris | a479261 | 2022-01-10 13:51:15 -0800 | [diff] [blame] | 69 | NR_BTF_KINDS, |
| 70 | BTF_KIND_MAX = NR_BTF_KINDS - 1, |
| 71 | }; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 72 | #define BTF_INT_ENCODING(VAL) (((VAL) & 0x0f000000) >> 24) |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 73 | #define BTF_INT_OFFSET(VAL) (((VAL) & 0x00ff0000) >> 16) |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 74 | #define BTF_INT_BITS(VAL) ((VAL) & 0x000000ff) |
| 75 | #define BTF_INT_SIGNED (1 << 0) |
| 76 | #define BTF_INT_CHAR (1 << 1) |
| 77 | #define BTF_INT_BOOL (1 << 2) |
| 78 | struct btf_enum { |
| 79 | __u32 name_off; |
| 80 | __s32 val; |
| 81 | }; |
| 82 | struct btf_array { |
| 83 | __u32 type; |
| 84 | __u32 index_type; |
| 85 | __u32 nelems; |
| 86 | }; |
| 87 | struct btf_member { |
| 88 | __u32 name_off; |
| 89 | __u32 type; |
| 90 | __u32 offset; |
| 91 | }; |
Christopher Ferris | d842e43 | 2019-03-07 10:21:59 -0800 | [diff] [blame] | 92 | #define BTF_MEMBER_BITFIELD_SIZE(val) ((val) >> 24) |
| 93 | #define BTF_MEMBER_BIT_OFFSET(val) ((val) & 0xffffff) |
| 94 | struct btf_param { |
| 95 | __u32 name_off; |
| 96 | __u32 type; |
| 97 | }; |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 98 | enum { |
| 99 | BTF_VAR_STATIC = 0, |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 100 | BTF_VAR_GLOBAL_ALLOCATED = 1, |
| 101 | BTF_VAR_GLOBAL_EXTERN = 2, |
| 102 | }; |
| 103 | enum btf_func_linkage { |
| 104 | BTF_FUNC_STATIC = 0, |
| 105 | BTF_FUNC_GLOBAL = 1, |
| 106 | BTF_FUNC_EXTERN = 2, |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 107 | }; |
| 108 | struct btf_var { |
| 109 | __u32 linkage; |
| 110 | }; |
| 111 | struct btf_var_secinfo { |
| 112 | __u32 type; |
| 113 | __u32 offset; |
| 114 | __u32 size; |
| 115 | }; |
Christopher Ferris | a479261 | 2022-01-10 13:51:15 -0800 | [diff] [blame] | 116 | struct btf_decl_tag { |
| 117 | __s32 component_idx; |
| 118 | }; |
Christopher Ferris | 7447a1c | 2022-10-04 18:24:44 -0700 | [diff] [blame] | 119 | struct btf_enum64 { |
| 120 | __u32 name_off; |
| 121 | __u32 val_lo32; |
| 122 | __u32 val_hi32; |
| 123 | }; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 124 | #endif |