162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright (C) 2015, He Kuang <hekuang@huawei.com> 462306a36Sopenharmony_ci * Copyright (C) 2015, Huawei Inc. 562306a36Sopenharmony_ci */ 662306a36Sopenharmony_ci#ifndef __BPF_PROLOGUE_H 762306a36Sopenharmony_ci#define __BPF_PROLOGUE_H 862306a36Sopenharmony_ci 962306a36Sopenharmony_cistruct probe_trace_arg; 1062306a36Sopenharmony_cistruct bpf_insn; 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci#define BPF_PROLOGUE_MAX_ARGS 3 1362306a36Sopenharmony_ci#define BPF_PROLOGUE_START_ARG_REG BPF_REG_3 1462306a36Sopenharmony_ci#define BPF_PROLOGUE_FETCH_RESULT_REG BPF_REG_2 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci#ifdef HAVE_BPF_PROLOGUE 1762306a36Sopenharmony_ciint bpf__gen_prologue(struct probe_trace_arg *args, int nargs, 1862306a36Sopenharmony_ci struct bpf_insn *new_prog, size_t *new_cnt, 1962306a36Sopenharmony_ci size_t cnt_space); 2062306a36Sopenharmony_ci#else 2162306a36Sopenharmony_ci#include <linux/compiler.h> 2262306a36Sopenharmony_ci#include <errno.h> 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_cistatic inline int 2562306a36Sopenharmony_cibpf__gen_prologue(struct probe_trace_arg *args __maybe_unused, 2662306a36Sopenharmony_ci int nargs __maybe_unused, 2762306a36Sopenharmony_ci struct bpf_insn *new_prog __maybe_unused, 2862306a36Sopenharmony_ci size_t *new_cnt, 2962306a36Sopenharmony_ci size_t cnt_space __maybe_unused) 3062306a36Sopenharmony_ci{ 3162306a36Sopenharmony_ci if (!new_cnt) 3262306a36Sopenharmony_ci return -EINVAL; 3362306a36Sopenharmony_ci *new_cnt = 0; 3462306a36Sopenharmony_ci return -ENOTSUP; 3562306a36Sopenharmony_ci} 3662306a36Sopenharmony_ci#endif 3762306a36Sopenharmony_ci#endif /* __BPF_PROLOGUE_H */ 38