bpf-prologue.h 847 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Copyright (C) 2015, He Kuang <hekuang@huawei.com>
  3. * Copyright (C) 2015, Huawei Inc.
  4. */
  5. #ifndef __BPF_PROLOGUE_H
  6. #define __BPF_PROLOGUE_H
  7. #include <linux/compiler.h>
  8. #include <linux/filter.h>
  9. #include "probe-event.h"
  10. #define BPF_PROLOGUE_MAX_ARGS 3
  11. #define BPF_PROLOGUE_START_ARG_REG BPF_REG_3
  12. #define BPF_PROLOGUE_FETCH_RESULT_REG BPF_REG_2
  13. #ifdef HAVE_BPF_PROLOGUE
  14. int bpf__gen_prologue(struct probe_trace_arg *args, int nargs,
  15. struct bpf_insn *new_prog, size_t *new_cnt,
  16. size_t cnt_space);
  17. #else
  18. static inline int
  19. bpf__gen_prologue(struct probe_trace_arg *args __maybe_unused,
  20. int nargs __maybe_unused,
  21. struct bpf_insn *new_prog __maybe_unused,
  22. size_t *new_cnt,
  23. size_t cnt_space __maybe_unused)
  24. {
  25. if (!new_cnt)
  26. return -EINVAL;
  27. *new_cnt = 0;
  28. return -ENOTSUP;
  29. }
  30. #endif
  31. #endif /* __BPF_PROLOGUE_H */