bpf_jit.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * BPF Jit compiler defines
  4. *
  5. * Copyright IBM Corp. 2012,2015
  6. *
  7. * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
  8. * Michael Holzheu <holzheu@linux.vnet.ibm.com>
  9. */
  10. #ifndef __ARCH_S390_NET_BPF_JIT_H
  11. #define __ARCH_S390_NET_BPF_JIT_H
  12. #ifndef __ASSEMBLY__
  13. #include <linux/filter.h>
  14. #include <linux/types.h>
  15. #endif /* __ASSEMBLY__ */
  16. /*
  17. * Stackframe layout (packed stack):
  18. *
  19. * ^ high
  20. * +---------------+ |
  21. * | old backchain | |
  22. * +---------------+ |
  23. * | r15 - r6 | |
  24. * +---------------+ |
  25. * | 4 byte align | |
  26. * | tail_call_cnt | |
  27. * BFP -> +===============+ |
  28. * | | |
  29. * | BPF stack | |
  30. * | | |
  31. * R15+160 -> +---------------+ |
  32. * | new backchain | |
  33. * R15+152 -> +---------------+ |
  34. * | + 152 byte SA | |
  35. * R15 -> +---------------+ + low
  36. *
  37. * We get 160 bytes stack space from calling function, but only use
  38. * 12 * 8 byte for old backchain, r15..r6, and tail_call_cnt.
  39. *
  40. * The stack size used by the BPF program ("BPF stack" above) is passed
  41. * via "aux->stack_depth".
  42. */
  43. #define STK_SPACE_ADD (160)
  44. #define STK_160_UNUSED (160 - 12 * 8)
  45. #define STK_OFF (STK_SPACE_ADD - STK_160_UNUSED)
  46. #define STK_OFF_R6 (160 - 11 * 8) /* Offset of r6 on stack */
  47. #define STK_OFF_TCCNT (160 - 12 * 8) /* Offset of tail_call_cnt on stack */
  48. #endif /* __ARCH_S390_NET_BPF_JIT_H */