bpf_jit.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * BPF Jit compiler defines
  3. *
  4. * Copyright IBM Corp. 2012,2015
  5. *
  6. * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
  7. * Michael Holzheu <holzheu@linux.vnet.ibm.com>
  8. */
  9. #ifndef __ARCH_S390_NET_BPF_JIT_H
  10. #define __ARCH_S390_NET_BPF_JIT_H
  11. #ifndef __ASSEMBLY__
  12. #include <linux/filter.h>
  13. #include <linux/types.h>
  14. extern u8 sk_load_word_pos[], sk_load_half_pos[], sk_load_byte_pos[];
  15. extern u8 sk_load_word[], sk_load_half[], sk_load_byte[];
  16. #endif /* __ASSEMBLY__ */
  17. /*
  18. * Stackframe layout (packed stack):
  19. *
  20. * ^ high
  21. * +---------------+ |
  22. * | old backchain | |
  23. * +---------------+ |
  24. * | r15 - r6 | |
  25. * +---------------+ |
  26. * | 4 byte align | |
  27. * | tail_call_cnt | |
  28. * BFP -> +===============+ |
  29. * | | |
  30. * | BPF stack | |
  31. * | | |
  32. * +---------------+ |
  33. * | 8 byte skbp | |
  34. * R15+176 -> +---------------+ |
  35. * | 8 byte hlen | |
  36. * R15+168 -> +---------------+ |
  37. * | 4 byte align | |
  38. * +---------------+ |
  39. * | 4 byte temp | |
  40. * | for bpf_jit.S | |
  41. * R15+160 -> +---------------+ |
  42. * | new backchain | |
  43. * R15+152 -> +---------------+ |
  44. * | + 152 byte SA | |
  45. * R15 -> +---------------+ + low
  46. *
  47. * We get 160 bytes stack space from calling function, but only use
  48. * 12 * 8 byte for old backchain, r15..r6, and tail_call_cnt.
  49. */
  50. #define STK_SPACE (MAX_BPF_STACK + 8 + 8 + 4 + 4 + 160)
  51. #define STK_160_UNUSED (160 - 12 * 8)
  52. #define STK_OFF (STK_SPACE - STK_160_UNUSED)
  53. #define STK_OFF_TMP 160 /* Offset of tmp buffer on stack */
  54. #define STK_OFF_HLEN 168 /* Offset of SKB header length on stack */
  55. #define STK_OFF_SKBP 176 /* Offset of SKB pointer on stack */
  56. #define STK_OFF_R6 (160 - 11 * 8) /* Offset of r6 on stack */
  57. #define STK_OFF_TCCNT (160 - 12 * 8) /* Offset of tail_call_cnt on stack */
  58. /* Offset to skip condition code check */
  59. #define OFF_OK 4
  60. #endif /* __ARCH_S390_NET_BPF_JIT_H */