1// SPDX-License-Identifier: GPL-2.0
2/* Copyright (c) 2022 Benjamin Tissoires */
3
4#include ".output/vmlinux.h"
5#include <bpf/bpf_helpers.h>
6#include <bpf/bpf_tracing.h>
7
8#define HID_BPF_MAX_PROGS 1024
9
10struct {
11	__uint(type, BPF_MAP_TYPE_PROG_ARRAY);
12	__uint(max_entries, HID_BPF_MAX_PROGS);
13	__uint(key_size, sizeof(__u32));
14	__uint(value_size, sizeof(__u32));
15} hid_jmp_table SEC(".maps");
16
17SEC("fmod_ret/__hid_bpf_tail_call")
18int BPF_PROG(hid_tail_call, struct hid_bpf_ctx *hctx)
19{
20	bpf_tail_call(ctx, &hid_jmp_table, hctx->index);
21
22	return 0;
23}
24
25char LICENSE[] SEC("license") = "GPL";
26