Function report |
Source Code:kernel\bpf\disasm.c |
Create Date:2022-07-28 13:15:28 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:print_bpf_insn
Proto:void print_bpf_insn(const struct bpf_insn_cbs *cbs, const struct bpf_insn *insn, bool allow_ptr_leaks)
Type:void
Parameter:
Type | Parameter | Name |
---|---|---|
const struct bpf_insn_cbs * | cbs | |
const struct bpf_insn * | insn | |
bool | allow_ptr_leaks |
122 | class = Instruction classes ( opcode ) |
124 | If class == BPF_ALU || class == alu mode in double word width Then |
125 | If alu/jmp fields ( opcode ) == lags for endianness conversion: Then |
126 | If class == alu mode in double word width Then verbose(private_data, "BUG_alu64_%02x\n", opcode ) |
128 | Else print_bpf_end_insn(verbose, private_data, insn) |
130 | Else if alu/jmp fields ( opcode ) == BPF_NEG Then |
131 | verbose(private_data, "(%02x) %c%d = -%c%d\n", opcode , class == BPF_ALU ? 'w' : 'r', dest register , class == BPF_ALU ? 'w' : 'r', dest register ) |
136 | verbose(private_data, "(%02x) %c%d %s %c%d\n", opcode , class == BPF_ALU ? 'w' : 'r', dest register , bpf_alu_string[alu/jmp fields ( opcode ) >> 4], class == BPF_ALU ? 'w' : 'r', source register ) |
142 | Else |
143 | verbose(private_data, "(%02x) %c%d %s %d\n", opcode , class == BPF_ALU ? 'w' : 'r', dest register , bpf_alu_string[alu/jmp fields ( opcode ) >> 4], signed immediate constant ) |
150 | If BPF BPF_DW 0x18 64-bit ( opcode ) == BPF_MEM Then verbose(private_data, "(%02x) *(%s *)(r%d %+d) = r%d\n", opcode , bpf_ldst_string[ld/ldx fields ( opcode ) >> 3], dest register , signed offset , source register ) |
156 | Else if BPF BPF_DW 0x18 64-bit ( opcode ) == xclusive add Then verbose(private_data, "(%02x) lock *(%s *)(r%d %+d) += r%d\n", opcode , bpf_ldst_string[ld/ldx fields ( opcode ) >> 3], dest register , signed offset , source register ) |
162 | Else verbose(private_data, "BUG_%02x\n", opcode ) |
165 | If BPF BPF_DW 0x18 64-bit ( opcode ) != BPF_MEM Then |
166 | verbose(private_data, "BUG_st_%02x\n", opcode ) |
167 | Return |
169 | verbose(private_data, "(%02x) *(%s *)(r%d %+d) = %d\n", opcode , bpf_ldst_string[ld/ldx fields ( opcode ) >> 3], dest register , signed offset , signed immediate constant ) |
175 | If BPF BPF_DW 0x18 64-bit ( opcode ) != BPF_MEM Then |
176 | verbose(private_data, "BUG_ldx_%02x\n", opcode ) |
177 | Return |
179 | verbose(private_data, "(%02x) r%d = *(%s *)(r%d %+d)\n", opcode , dest register , bpf_ldst_string[ld/ldx fields ( opcode ) >> 3], source register , signed offset ) |
184 | If BPF BPF_DW 0x18 64-bit ( opcode ) == BPF_ABS Then |
185 | verbose(private_data, "(%02x) r0 = *(%s *)skb[%d]\n", opcode , bpf_ldst_string[ld/ldx fields ( opcode ) >> 3], signed immediate constant ) |
189 | Else if BPF BPF_DW 0x18 64-bit ( opcode ) == BPF_IND Then |
190 | verbose(private_data, "(%02x) r0 = *(%s *)skb[r%d + %d]\n", opcode , bpf_ldst_string[ld/ldx fields ( opcode ) >> 3], source register , signed immediate constant ) |
194 | Else if BPF BPF_DW 0x18 64-bit ( opcode ) == BPF_IMM && ld/ldx fields ( opcode ) == double word (64-bit) Then |
199 | imm = signed immediate constant << 32 | signed immediate constant |
200 | is_ptr = source register == When BPF ldimm64's insn[0] || source register == BPF_PSEUDO_MAP_VALUE |
204 | If is_ptr && Not allow_ptr_leaks Then imm = 0 |
207 | verbose(private_data, "(%02x) r%d = %s\n", opcode , dest register , __func_imm_name(cbs, insn, imm, tmp, size of tmp )) |
211 | Else |
212 | verbose(private_data, "BUG_ld_%02x\n", opcode ) |
213 | Return |
215 | Else if class == jmp mode in word width || class == BPF_JMP Then |
216 | opcode = alu/jmp fields ( opcode ) |
218 | If opcode == unction call Then |
222 | verbose(private_data, "(%02x) call pc%s\n", opcode , __func_get_name(cbs, insn, tmp, size of tmp )) |
226 | Else |
228 | verbose(private_data, "(%02x) call %s#%d\n", opcode , __func_get_name(cbs, insn, tmp, size of tmp ), signed immediate constant ) |
234 | verbose(private_data, "(%02x) goto pc%+d\n", opcode , signed offset ) |
236 | Else if opcode == (BPF_JMP | unction return ) Then |
237 | verbose(private_data, "(%02x) exit\n", opcode ) |
239 | verbose(private_data, "(%02x) if %c%d %s %c%d goto pc%+d\n", opcode , class == jmp mode in word width ? 'w' : 'r', dest register , bpf_jmp_string[alu/jmp fields ( opcode ) >> 4], class == jmp mode in word width ? 'w' : 'r', source register , signed offset ) |
246 | Else |
247 | verbose(private_data, "(%02x) if %c%d %s 0x%x goto pc%+d\n", opcode , class == jmp mode in word width ? 'w' : 'r', dest register , bpf_jmp_string[alu/jmp fields ( opcode ) >> 4], signed immediate constant , signed offset ) |
254 | Else |
255 | verbose(private_data, "(%02x) %s\n", opcode , bpf_class_string[class]) |
Name | Describe |
---|---|
do_check |
Source code conversion tool public plug-in interface | X |
---|---|
Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |