github.com/lianghucheng/zrddz@v0.0.0-20200923083010-c71f680932e2/src/golang.org/x/net/bpf/testdata/all_instructions.txt (about) 1 # This filter is compiled to all_instructions.bpf by the `bpf_asm` 2 # tool, which can be found in the linux kernel source tree under 3 # tools/bpf. 4 5 # Load immediate 6 ld #42 7 ldx #42 8 9 # Load scratch 10 ld M[3] 11 ldx M[3] 12 13 # Load absolute 14 ldb [42] 15 ldh [42] 16 ld [42] 17 18 # Load indirect 19 ldb [x + 42] 20 ldh [x + 42] 21 ld [x + 42] 22 23 # Load IPv4 header length 24 ldx 4*([42]&0xf) 25 26 # Run extension function 27 ld #len 28 ld #proto 29 ld #type 30 ld #rand 31 32 # Store scratch 33 st M[3] 34 stx M[3] 35 36 # A <op> constant 37 add #42 38 sub #42 39 mul #42 40 div #42 41 or #42 42 and #42 43 lsh #42 44 rsh #42 45 mod #42 46 xor #42 47 48 # A <op> X 49 add x 50 sub x 51 mul x 52 div x 53 or x 54 and x 55 lsh x 56 rsh x 57 mod x 58 xor x 59 60 # !A 61 neg 62 63 # Jump A <op> constant 64 ja end 65 jeq #42,prev,end 66 jne #42,end 67 jlt #42,end 68 jle #42,end 69 jgt #42,prev,end 70 jge #42,prev,end 71 jset #42,prev,end 72 73 # Jump A <op> X 74 jeq x,prev,end 75 jne x,end 76 jlt x,end 77 jle x,end 78 jgt x,prev,end 79 jge x,prev,end 80 jset x,prev,end 81 82 # Register transfers 83 tax 84 txa 85 86 # Returns 87 prev: ret a 88 end: ret #42