|
| 1 | +For reference, the following table lists opcodes in order by value. |
| 2 | + |
| 3 | +====== === ==== =================================================== ======================================== |
| 4 | +opcode src imm description reference |
| 5 | +====== === ==== =================================================== ======================================== |
| 6 | +0x00 0x0 any (additional immediate value) `64-bit immediate instructions`_ |
| 7 | +0x04 0x0 any dst = (u32)((u32)dst + (u32)imm) `Arithmetic instructions`_ |
| 8 | +0x05 0x0 0x00 goto +offset `Jump instructions`_ |
| 9 | +0x07 0x0 any dst += imm `Arithmetic instructions`_ |
| 10 | +0x0c any 0x00 dst = (u32)((u32)dst + (u32)src) `Arithmetic instructions`_ |
| 11 | +0x0f any 0x00 dst += src `Arithmetic instructions`_ |
| 12 | +0x14 0x0 any dst = (u32)((u32)dst - (u32)imm) `Arithmetic instructions`_ |
| 13 | +0x15 0x0 any if dst == imm goto +offset `Jump instructions`_ |
| 14 | +0x16 0x0 any if (u32)dst == imm goto +offset `Jump instructions`_ |
| 15 | +0x17 0x0 any dst -= imm `Arithmetic instructions`_ |
| 16 | +0x18 0x0 any dst = imm64 `64-bit immediate instructions`_ |
| 17 | +0x18 0x1 any dst = map_by_fd(imm) `64-bit immediate instructions`_ |
| 18 | +0x18 0x2 any dst = mva(map_by_fd(imm)) + next_imm `64-bit immediate instructions`_ |
| 19 | +0x18 0x3 any dst = variable_addr(imm) `64-bit immediate instructions`_ |
| 20 | +0x18 0x4 any dst = code_addr(imm) `64-bit immediate instructions`_ |
| 21 | +0x18 0x5 any dst = map_by_idx(imm) `64-bit immediate instructions`_ |
| 22 | +0x18 0x6 any dst = mva(map_by_idx(imm)) + next_imm `64-bit immediate instructions`_ |
| 23 | +0x1c any 0x00 dst = (u32)((u32)dst - (u32)src) `Arithmetic instructions`_ |
| 24 | +0x1d any 0x00 if dst == src goto +offset `Jump instructions`_ |
| 25 | +0x1e any 0x00 if (u32)dst == (u32)src goto +offset `Jump instructions`_ |
| 26 | +0x1f any 0x00 dst -= src `Arithmetic instructions`_ |
| 27 | +0x20 any any (deprecated, implementation-specific) `Legacy BPF Packet access instructions`_ |
| 28 | +0x24 0x0 any dst = (u32)(dst \* imm) `Arithmetic instructions`_ |
| 29 | +0x25 0x0 any if dst > imm goto +offset `Jump instructions`_ |
| 30 | +0x26 0x0 any if (u32)dst > imm goto +offset `Jump instructions`_ |
| 31 | +0x27 0x0 any dst \*= imm `Arithmetic instructions`_ |
| 32 | +0x28 any any (deprecated, implementation-specific) `Legacy BPF Packet access instructions`_ |
| 33 | +0x2c any 0x00 dst = (u32)(dst \* src) `Arithmetic instructions`_ |
| 34 | +0x2d any 0x00 if dst > src goto +offset `Jump instructions`_ |
| 35 | +0x2e any 0x00 if (u32)dst > (u32)src goto +offset `Jump instructions`_ |
| 36 | +0x2f any 0x00 dst \*= src `Arithmetic instructions`_ |
| 37 | +0x30 any any (deprecated, implementation-specific) `Legacy BPF Packet access instructions`_ |
| 38 | +0x34 0x0 any dst = (u32)((imm != 0) ? (dst / imm) : 0) `Arithmetic instructions`_ |
| 39 | +0x35 0x0 any if dst >= imm goto +offset `Jump instructions`_ |
| 40 | +0x36 0x0 any if (u32)dst >= imm goto +offset `Jump instructions`_ |
| 41 | +0x37 0x0 any dst = (imm != 0) ? (dst / imm) : 0 `Arithmetic instructions`_ |
| 42 | +0x38 any any (deprecated, implementation-specific) `Legacy BPF Packet access instructions`_ |
| 43 | +0x3c any 0x00 dst = (u32)((imm != 0) ? (dst / src) : 0) `Arithmetic instructions`_ |
| 44 | +0x3d any 0x00 if dst >= src goto +offset `Jump instructions`_ |
| 45 | +0x3e any 0x00 if (u32)dst >= (u32)src goto +offset `Jump instructions`_ |
| 46 | +0x3f any 0x00 dst = (src !+ 0) ? (dst / src) : 0 `Arithmetic instructions`_ |
| 47 | +0x40 any any (deprecated, implementation-specific) `Legacy BPF Packet access instructions`_ |
| 48 | +0x44 0x0 any dst = (u32)(dst \| imm) `Arithmetic instructions`_ |
| 49 | +0x45 0x0 any if dst & imm goto +offset `Jump instructions`_ |
| 50 | +0x46 0x0 any if (u32)dst & imm goto +offset `Jump instructions`_ |
| 51 | +0x47 0x0 any dst \|= imm `Arithmetic instructions`_ |
| 52 | +0x48 any any (deprecated, implementation-specific) `Legacy BPF Packet access instructions`_ |
| 53 | +0x4c any 0x00 dst = (u32)(dst \| src) `Arithmetic instructions`_ |
| 54 | +0x4d any 0x00 if dst & src goto +offset `Jump instructions`_ |
| 55 | +0x4e any 0x00 if (u32)dst & (u32)src goto +offset `Jump instructions`_ |
| 56 | +0x4f any 0x00 dst \|= src `Arithmetic instructions`_ |
| 57 | +0x50 any any (deprecated, implementation-specific) `Legacy BPF Packet access instructions`_ |
| 58 | +0x54 0x0 any dst = (u32)(dst & imm) `Arithmetic instructions`_ |
| 59 | +0x55 0x0 any if dst != imm goto +offset `Jump instructions`_ |
| 60 | +0x56 0x0 any if (u32)dst != imm goto +offset `Jump instructions`_ |
| 61 | +0x57 0x0 any dst &= imm `Arithmetic instructions`_ |
| 62 | +0x58 any any (deprecated, implementation-specific) `Legacy BPF Packet access instructions`_ |
| 63 | +0x5c any 0x00 dst = (u32)(dst & src) `Arithmetic instructions`_ |
| 64 | +0x5d any 0x00 if dst != src goto +offset `Jump instructions`_ |
| 65 | +0x5e any 0x00 if (u32)dst != (u32)src goto +offset `Jump instructions`_ |
| 66 | +0x5f any 0x00 dst &= src `Arithmetic instructions`_ |
| 67 | +0x61 any 0x00 dst = \*(u32 \*)(src + offset) `Load and store instructions`_ |
| 68 | +0x62 0x0 any \*(u32 \*)(dst + offset) = imm `Load and store instructions`_ |
| 69 | +0x63 any 0x00 \*(u32 \*)(dst + offset) = src `Load and store instructions`_ |
| 70 | +0x64 0x0 any dst = (u32)(dst << imm) `Arithmetic instructions`_ |
| 71 | +0x65 0x0 any if dst s> imm goto +offset `Jump instructions`_ |
| 72 | +0x66 0x0 any if (s32)dst s> (s32)imm goto +offset `Jump instructions`_ |
| 73 | +0x67 0x0 any dst <<= imm `Arithmetic instructions`_ |
| 74 | +0x69 any 0x00 dst = \*(u16 \*)(src + offset) `Load and store instructions`_ |
| 75 | +0x6a 0x0 any \*(u16 \*)(dst + offset) = imm `Load and store instructions`_ |
| 76 | +0x6b any 0x00 \*(u16 \*)(dst + offset) = src `Load and store instructions`_ |
| 77 | +0x6c any 0x00 dst = (u32)(dst << src) `Arithmetic instructions`_ |
| 78 | +0x6d any 0x00 if dst s> src goto +offset `Jump instructions`_ |
| 79 | +0x6e any 0x00 if (s32)dst s> (s32)src goto +offset `Jump instructions`_ |
| 80 | +0x6f any 0x00 dst <<= src `Arithmetic instructions`_ |
| 81 | +0x71 any 0x00 dst = \*(u8 \*)(src + offset) `Load and store instructions`_ |
| 82 | +0x72 0x0 any \*(u8 \*)(dst + offset) = imm `Load and store instructions`_ |
| 83 | +0x73 any 0x00 \*(u8 \*)(dst + offset) = src `Load and store instructions`_ |
| 84 | +0x74 0x0 any dst = (u32)(dst >> imm) `Arithmetic instructions`_ |
| 85 | +0x75 0x0 any if dst s>= imm goto +offset `Jump instructions`_ |
| 86 | +0x76 0x0 any if (s32)dst s>= (s32)imm goto +offset `Jump instructions`_ |
| 87 | +0x77 0x0 any dst >>= imm `Arithmetic instructions`_ |
| 88 | +0x79 any 0x00 dst = \*(u64 \*)(src + offset) `Load and store instructions`_ |
| 89 | +0x7a 0x0 any \*(u64 \*)(dst + offset) = imm `Load and store instructions`_ |
| 90 | +0x7b any 0x00 \*(u64 \*)(dst + offset) = src `Load and store instructions`_ |
| 91 | +0x7c any 0x00 dst = (u32)(dst >> src) `Arithmetic instructions`_ |
| 92 | +0x7d any 0x00 if dst s>= src goto +offset `Jump instructions`_ |
| 93 | +0x7e any 0x00 if (s32)dst s>= (s32)src goto +offset `Jump instructions`_ |
| 94 | +0x7f any 0x00 dst >>= src `Arithmetic instructions`_ |
| 95 | +0x84 0x0 0x00 dst = (u32)-dst `Arithmetic instructions`_ |
| 96 | +0x85 0x0 any call helper function imm `Helper functions`_ |
| 97 | +0x85 0x1 any call PC += offset `eBPF functions`_ |
| 98 | +0x85 0x2 any call runtime function imm `Runtime functions`_ |
| 99 | +0x87 0x0 0x00 dst = -dst `Arithmetic instructions`_ |
| 100 | +0x94 0x0 any dst = (u32)((imm != 0) ? (dst % imm) : dst) `Arithmetic instructions`_ |
| 101 | +0x95 0x0 0x00 return `Jump instructions`_ |
| 102 | +0x97 0x0 any dst = (imm != 0) ? (dst % imm) : dst `Arithmetic instructions`_ |
| 103 | +0x9c any 0x00 dst = (u32)((src != 0) ? (dst % src) : dst) `Arithmetic instructions`_ |
| 104 | +0x9f any 0x00 dst = (src != 0) ? (dst % src) : dst `Arithmetic instructions`_ |
| 105 | +0xa4 0x0 any dst = (u32)(dst ^ imm) `Arithmetic instructions`_ |
| 106 | +0xa5 0x0 any if dst < imm goto +offset `Jump instructions`_ |
| 107 | +0xa6 0x0 any if (u32)dst < imm goto +offset `Jump instructions`_ |
| 108 | +0xa7 0x0 any dst ^= imm `Arithmetic instructions`_ |
| 109 | +0xac any 0x00 dst = (u32)(dst ^ src) `Arithmetic instructions`_ |
| 110 | +0xad any 0x00 if dst < src goto +offset `Jump instructions`_ |
| 111 | +0xae any 0x00 if (u32)dst < (u32)src goto +offset `Jump instructions`_ |
| 112 | +0xaf any 0x00 dst ^= src `Arithmetic instructions`_ |
| 113 | +0xb4 0x0 any dst = (u32) imm `Arithmetic instructions`_ |
| 114 | +0xb5 0x0 any if dst <= imm goto +offset `Jump instructions`_ |
| 115 | +0xa6 0x0 any if (u32)dst <= imm goto +offset `Jump instructions`_ |
| 116 | +0xb7 0x0 any dst = imm `Arithmetic instructions`_ |
| 117 | +0xbc any 0x00 dst = (u32) src `Arithmetic instructions`_ |
| 118 | +0xbd any 0x00 if dst <= src goto +offset `Jump instructions`_ |
| 119 | +0xbe any 0x00 if (u32)dst <= (u32)src goto +offset `Jump instructions`_ |
| 120 | +0xbf any 0x00 dst = src `Arithmetic instructions`_ |
| 121 | +0xc3 any 0x00 lock \*(u32 \*)(dst + offset) += src `Atomic operations`_ |
| 122 | +0xc3 any 0x01 lock:: `Atomic operations`_ |
| 123 | + |
| 124 | + *(u32 *)(dst + offset) += src |
| 125 | + src = *(u32 *)(dst + offset) |
| 126 | +0xc3 any 0x40 \*(u32 \*)(dst + offset) \|= src `Atomic operations`_ |
| 127 | +0xc3 any 0x41 lock:: `Atomic operations`_ |
| 128 | +
|
| 129 | + *(u32 *)(dst + offset) |= src |
| 130 | + src = *(u32 *)(dst + offset) |
| 131 | +0xc3 any 0x50 \*(u32 \*)(dst + offset) &= src `Atomic operations`_ |
| 132 | +0xc3 any 0x51 lock:: `Atomic operations`_ |
| 133 | +
|
| 134 | + *(u32 *)(dst + offset) &= src |
| 135 | + src = *(u32 *)(dst + offset) |
| 136 | +0xc3 any 0xa0 \*(u32 \*)(dst + offset) ^= src `Atomic operations`_ |
| 137 | +0xc3 any 0xa1 lock:: `Atomic operations`_ |
| 138 | +
|
| 139 | + *(u32 *)(dst + offset) ^= src |
| 140 | + src = *(u32 *)(dst + offset) |
| 141 | +0xc3 any 0xe1 lock:: `Atomic operations`_ |
| 142 | +
|
| 143 | + temp = *(u32 *)(dst + offset) |
| 144 | + *(u32 *)(dst + offset) = src |
| 145 | + src = temp |
| 146 | +0xc3 any 0xf1 lock:: `Atomic operations`_ |
| 147 | +
|
| 148 | + temp = *(u32 *)(dst + offset) |
| 149 | + if *(u32)(dst + offset) == R0 |
| 150 | + *(u32)(dst + offset) = src |
| 151 | + R0 = temp |
| 152 | +0xc4 0x0 any dst = (u32)(dst s>> imm) `Arithmetic instructions`_ |
| 153 | +0xc5 0x0 any if dst s< imm goto +offset `Jump instructions`_ |
| 154 | +0xc6 0x0 any if (s32)dst s< (s32)imm goto +offset `Jump instructions`_ |
| 155 | +0xc7 0x0 any dst s>>= imm `Arithmetic instructions`_ |
| 156 | +0xcc any 0x00 dst = (u32)(dst s>> src) `Arithmetic instructions`_ |
| 157 | +0xcd any 0x00 if dst s< src goto +offset `Jump instructions`_ |
| 158 | +0xce any 0x00 if (s32)dst s< (s32)src goto +offset `Jump instructions`_ |
| 159 | +0xcf any 0x00 dst s>>= src `Arithmetic instructions`_ |
| 160 | +0xd4 0x0 0x10 dst = htole16(dst) `Byte swap instructions`_ |
| 161 | +0xd4 0x0 0x20 dst = htole32(dst) `Byte swap instructions`_ |
| 162 | +0xd4 0x0 0x40 dst = htole64(dst) `Byte swap instructions`_ |
| 163 | +0xd5 0x0 any if dst s<= imm goto +offset `Jump instructions`_ |
| 164 | +0xd6 0x0 any if (s32)dst s<= (s32)imm goto +offset `Jump instructions`_ |
| 165 | +0xdb any 0x00 lock \*(u64 \*)(dst + offset) += src `Atomic operations`_ |
| 166 | +0xdb any 0x01 lock:: `Atomic operations`_ |
| 167 | +
|
| 168 | + *(u64 *)(dst + offset) += src |
| 169 | + src = *(u64 *)(dst + offset) |
| 170 | +0xdb any 0x40 \*(u64 \*)(dst + offset) \|= src `Atomic operations`_ |
| 171 | +0xdb any 0x41 lock:: `Atomic operations`_ |
| 172 | +
|
| 173 | + *(u64 *)(dst + offset) |= src |
| 174 | + lock src = *(u64 *)(dst + offset) |
| 175 | +0xdb any 0x50 \*(u64 \*)(dst + offset) &= src `Atomic operations`_ |
| 176 | +0xdb any 0x51 lock:: `Atomic operations`_ |
| 177 | +
|
| 178 | + *(u64 *)(dst + offset) &= src |
| 179 | + src = *(u64 *)(dst + offset) |
| 180 | +0xdb any 0xa0 \*(u64 \*)(dst + offset) ^= src `Atomic operations`_ |
| 181 | +0xdb any 0xa1 lock:: `Atomic operations`_ |
| 182 | +
|
| 183 | + *(u64 *)(dst + offset) ^= src |
| 184 | + src = *(u64 *)(dst + offset) |
| 185 | +0xdb any 0xe1 lock:: `Atomic operations`_ |
| 186 | +
|
| 187 | + temp = *(u64 *)(dst + offset) |
| 188 | + *(u64 *)(dst + offset) = src |
| 189 | + src = temp |
| 190 | +0xdb any 0xf1 lock:: `Atomic operations`_ |
| 191 | +
|
| 192 | + temp = *(u64 *)(dst + offset) |
| 193 | + if *(u64)(dst + offset) == R0 |
| 194 | + *(u64)(dst + offset) = src |
| 195 | + R0 = temp |
| 196 | +0xdc 0x0 0x10 dst = htobe16(dst) `Byte swap instructions`_ |
| 197 | +0xdc 0x0 0x20 dst = htobe32(dst) `Byte swap instructions`_ |
| 198 | +0xdc 0x0 0x40 dst = htobe64(dst) `Byte swap instructions`_ |
| 199 | +0xdd any 0x00 if dst s<= src goto +offset `Jump instructions`_ |
| 200 | +0xde any 0x00 if (s32)dst s<= (s32)src goto +offset `Jump instructions`_ |
| 201 | +====== === ==== =================================================== ======================================== |
0 commit comments