bpf_jit.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Just-In-Time compiler for BPF filters on MIPS
  3. *
  4. * Copyright (c) 2014 Imagination Technologies Ltd.
  5. * Author: Markos Chandras <markos.chandras@imgtec.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the
  9. * Free Software Foundation; version 2 of the License.
  10. */
  11. #ifndef BPF_JIT_MIPS_OP_H
  12. #define BPF_JIT_MIPS_OP_H
  13. /* Registers used by JIT */
  14. #define MIPS_R_ZERO 0
  15. #define MIPS_R_V0 2
  16. #define MIPS_R_V1 3
  17. #define MIPS_R_A0 4
  18. #define MIPS_R_A1 5
  19. #define MIPS_R_T6 14
  20. #define MIPS_R_T7 15
  21. #define MIPS_R_S0 16
  22. #define MIPS_R_S1 17
  23. #define MIPS_R_S2 18
  24. #define MIPS_R_S3 19
  25. #define MIPS_R_S4 20
  26. #define MIPS_R_S5 21
  27. #define MIPS_R_S6 22
  28. #define MIPS_R_S7 23
  29. #define MIPS_R_SP 29
  30. #define MIPS_R_RA 31
  31. /* Conditional codes */
  32. #define MIPS_COND_EQ 0x1
  33. #define MIPS_COND_GE (0x1 << 1)
  34. #define MIPS_COND_GT (0x1 << 2)
  35. #define MIPS_COND_NE (0x1 << 3)
  36. #define MIPS_COND_ALL (0x1 << 4)
  37. /* Conditionals on X register or K immediate */
  38. #define MIPS_COND_X (0x1 << 5)
  39. #define MIPS_COND_K (0x1 << 6)
  40. #endif /* BPF_JIT_MIPS_OP_H */