all_instructions.txt 815 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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/net.
  4. # Load immediate
  5. ld #42
  6. ldx #42
  7. # Load scratch
  8. ld M[3]
  9. ldx M[3]
  10. # Load absolute
  11. ldb [42]
  12. ldh [42]
  13. ld [42]
  14. # Load indirect
  15. ldb [x + 42]
  16. ldh [x + 42]
  17. ld [x + 42]
  18. # Load IPv4 header length
  19. ldx 4*([42]&0xf)
  20. # Run extension function
  21. ld #len
  22. ld #proto
  23. ld #type
  24. ld #rand
  25. # Store scratch
  26. st M[3]
  27. stx M[3]
  28. # A <op> constant
  29. add #42
  30. sub #42
  31. mul #42
  32. div #42
  33. or #42
  34. and #42
  35. lsh #42
  36. rsh #42
  37. mod #42
  38. xor #42
  39. # A <op> X
  40. add x
  41. sub x
  42. mul x
  43. div x
  44. or x
  45. and x
  46. lsh x
  47. rsh x
  48. mod x
  49. xor x
  50. # !A
  51. neg
  52. # Jumps
  53. ja end
  54. jeq #42,prev,end
  55. jne #42,end
  56. jlt #42,end
  57. jle #42,end
  58. jgt #42,prev,end
  59. jge #42,prev,end
  60. jset #42,prev,end
  61. # Register transfers
  62. tax
  63. txa
  64. # Returns
  65. prev: ret a
  66. end: ret #42