blob: 7f48b7af82ef1b25a15cbe4bc0302ea8399d1124 [file] [log] [blame]
Christopher Ferris9ce28842018-10-25 12:11:39 -07001/****************************************************************************
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
24struct 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 Ferris9584fa42019-12-09 15:36:13 -080034#define BTF_MAX_TYPE 0x000fffff
35#define BTF_MAX_NAME_OFFSET 0x00ffffff
Christopher Ferris9ce28842018-10-25 12:11:39 -070036#define BTF_MAX_VLEN 0xffff
37struct btf_type {
38 __u32 name_off;
39 __u32 info;
40 union {
41 __u32 size;
42 __u32 type;
43 };
44};
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +000045#define BTF_INFO_KIND(info) (((info) >> 24) & 0x1f)
Christopher Ferris9ce28842018-10-25 12:11:39 -070046#define BTF_INFO_VLEN(info) ((info) & 0xffff)
Christopher Ferrisd842e432019-03-07 10:21:59 -080047#define BTF_INFO_KFLAG(info) ((info) >> 31)
Christopher Ferris9ce28842018-10-25 12:11:39 -070048#define BTF_KIND_UNKN 0
49#define BTF_KIND_INT 1
50#define BTF_KIND_PTR 2
51#define BTF_KIND_ARRAY 3
52#define BTF_KIND_STRUCT 4
53#define BTF_KIND_UNION 5
54#define BTF_KIND_ENUM 6
55#define BTF_KIND_FWD 7
56#define BTF_KIND_TYPEDEF 8
57#define BTF_KIND_VOLATILE 9
58#define BTF_KIND_CONST 10
59#define BTF_KIND_RESTRICT 11
Christopher Ferrisd842e432019-03-07 10:21:59 -080060#define BTF_KIND_FUNC 12
61#define BTF_KIND_FUNC_PROTO 13
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -070062#define BTF_KIND_VAR 14
63#define BTF_KIND_DATASEC 15
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +000064#define BTF_KIND_FLOAT 16
65#define BTF_KIND_MAX BTF_KIND_FLOAT
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -070066#define NR_BTF_KINDS (BTF_KIND_MAX + 1)
Christopher Ferris9ce28842018-10-25 12:11:39 -070067#define BTF_INT_ENCODING(VAL) (((VAL) & 0x0f000000) >> 24)
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -070068#define BTF_INT_OFFSET(VAL) (((VAL) & 0x00ff0000) >> 16)
Christopher Ferris9ce28842018-10-25 12:11:39 -070069#define BTF_INT_BITS(VAL) ((VAL) & 0x000000ff)
70#define BTF_INT_SIGNED (1 << 0)
71#define BTF_INT_CHAR (1 << 1)
72#define BTF_INT_BOOL (1 << 2)
73struct btf_enum {
74 __u32 name_off;
75 __s32 val;
76};
77struct btf_array {
78 __u32 type;
79 __u32 index_type;
80 __u32 nelems;
81};
82struct btf_member {
83 __u32 name_off;
84 __u32 type;
85 __u32 offset;
86};
Christopher Ferrisd842e432019-03-07 10:21:59 -080087#define BTF_MEMBER_BITFIELD_SIZE(val) ((val) >> 24)
88#define BTF_MEMBER_BIT_OFFSET(val) ((val) & 0xffffff)
89struct btf_param {
90 __u32 name_off;
91 __u32 type;
92};
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -070093enum {
94 BTF_VAR_STATIC = 0,
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070095 BTF_VAR_GLOBAL_ALLOCATED = 1,
96 BTF_VAR_GLOBAL_EXTERN = 2,
97};
98enum btf_func_linkage {
99 BTF_FUNC_STATIC = 0,
100 BTF_FUNC_GLOBAL = 1,
101 BTF_FUNC_EXTERN = 2,
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700102};
103struct btf_var {
104 __u32 linkage;
105};
106struct btf_var_secinfo {
107 __u32 type;
108 __u32 offset;
109 __u32 size;
110};
Christopher Ferris9ce28842018-10-25 12:11:39 -0700111#endif