bpf_jit.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #ifndef _BPF_JIT_H
  2. #define _BPF_JIT_H
  3. /* Conventions:
  4. * %g1 : temporary
  5. * %g2 : Secondary temporary used by SKB data helper stubs.
  6. * %g3 : packet offset passed into SKB data helper stubs.
  7. * %o0 : pointer to skb (first argument given to JIT function)
  8. * %o1 : BPF A accumulator
  9. * %o2 : BPF X accumulator
  10. * %o3 : Holds saved %o7 so we can call helper functions without needing
  11. * to allocate a register window.
  12. * %o4 : skb->len - skb->data_len
  13. * %o5 : skb->data
  14. */
  15. #ifndef __ASSEMBLER__
  16. #define G0 0x00
  17. #define G1 0x01
  18. #define G3 0x03
  19. #define G6 0x06
  20. #define O0 0x08
  21. #define O1 0x09
  22. #define O2 0x0a
  23. #define O3 0x0b
  24. #define O4 0x0c
  25. #define O5 0x0d
  26. #define SP 0x0e
  27. #define O7 0x0f
  28. #define FP 0x1e
  29. #define r_SKB O0
  30. #define r_A O1
  31. #define r_X O2
  32. #define r_saved_O7 O3
  33. #define r_HEADLEN O4
  34. #define r_SKB_DATA O5
  35. #define r_TMP G1
  36. #define r_TMP2 G2
  37. #define r_OFF G3
  38. /* assembly code in arch/sparc/net/bpf_jit_asm.S */
  39. extern u32 bpf_jit_load_word[];
  40. extern u32 bpf_jit_load_half[];
  41. extern u32 bpf_jit_load_byte[];
  42. extern u32 bpf_jit_load_byte_msh[];
  43. extern u32 bpf_jit_load_word_positive_offset[];
  44. extern u32 bpf_jit_load_half_positive_offset[];
  45. extern u32 bpf_jit_load_byte_positive_offset[];
  46. extern u32 bpf_jit_load_byte_msh_positive_offset[];
  47. extern u32 bpf_jit_load_word_negative_offset[];
  48. extern u32 bpf_jit_load_half_negative_offset[];
  49. extern u32 bpf_jit_load_byte_negative_offset[];
  50. extern u32 bpf_jit_load_byte_msh_negative_offset[];
  51. #else
  52. #define r_SKB %o0
  53. #define r_A %o1
  54. #define r_X %o2
  55. #define r_saved_O7 %o3
  56. #define r_HEADLEN %o4
  57. #define r_SKB_DATA %o5
  58. #define r_TMP %g1
  59. #define r_TMP2 %g2
  60. #define r_OFF %g3
  61. #endif
  62. #endif /* _BPF_JIT_H */