Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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 activityDownload SCCTChinese

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:

TypeParameterName
const struct bpf_insn_cbs *cbs
const struct bpf_insn *insn
boolallow_ptr_leaks
121  verbose = cb_print
122  class = Instruction classes ( opcode )
124  If class == BPF_ALU || class == alu mode in double word width Then
126  If class == alu mode in double word width Then verbose(private_data, "BUG_alu64_%02x\n", opcode )
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 )
135  Else if BPF_SRC( opcode ) == BPF_X Then
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
149  Else if class == BPF_STX Then
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 )
164  Else if class == BPF_ST 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 )
174  Else if class == BPF_LDX 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 )
183  Else if class == BPF_LD Then
189  Else if BPF BPF_DW 0x18 64-bit ( opcode ) == BPF_IND Then
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
227  strcpy(tmp, "unknown")
233  Else if opcode == (BPF_JMP | BPF_JA) Then
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 )
238  Else if BPF_SRC( opcode ) == BPF_X Then
246  Else
254  Else
255  verbose(private_data, "(%02x) %s\n", opcode , bpf_class_string[class])
Caller
NameDescribe
do_check