1 /* Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com
3 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of version 2 of the GNU General Public
5 * License as published by the Free Software Foundation.
7 #ifndef _UAPI__LINUX_BPF_H__
8 #define _UAPI__LINUX_BPF_H__
10 #include <linux/types.h>
12 /* Extended instruction set based on top of classic BPF */
14 /* instruction classes */
15 #define BPF_ALU64 0x07 /* alu mode in double word width */
18 #define BPF_DW 0x18 /* double word */
19 #define BPF_XADD 0xc0 /* exclusive add */
22 #define BPF_MOV 0xb0 /* mov reg to reg */
23 #define BPF_ARSH 0xc0 /* sign extending arithmetic shift right */
25 /* change endianness of a register */
26 #define BPF_END 0xd0 /* flags for endianness conversion: */
27 #define BPF_TO_LE 0x00 /* convert to little-endian */
28 #define BPF_TO_BE 0x08 /* convert to big-endian */
29 #define BPF_FROM_LE BPF_TO_LE
30 #define BPF_FROM_BE BPF_TO_BE
32 #define BPF_JNE 0x50 /* jump != */
33 #define BPF_JSGT 0x60 /* SGT is signed '>', GT in x86 */
34 #define BPF_JSGE 0x70 /* SGE is signed '>=', GE in x86 */
35 #define BPF_CALL 0x80 /* function call */
36 #define BPF_EXIT 0x90 /* function return */
38 /* Register numbers */
54 /* BPF has 10 general purpose 64-bit registers and stack frame. */
55 #define MAX_BPF_REG __MAX_BPF_REG
58 __u8 code; /* opcode */
59 __u8 dst_reg:4; /* dest register */
60 __u8 src_reg:4; /* source register */
61 __s16 off; /* signed offset */
62 __s32 imm; /* signed immediate constant */
65 #endif /* _UAPI__LINUX_BPF_H__ */