1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */
4 #include <bpf/bpf_helpers.h>
5 #include <bpf/bpf_tracing.h>
6 #include <bpf/bpf_core_read.h>
7 #include "bpf_experimental.h"
10 __uint(type, BPF_MAP_TYPE_ARENA);
11 __uint(map_flags, BPF_F_MMAPABLE);
12 __uint(max_entries, 100); /* number of pages */
15 #include "bpf_arena_htab.h"
17 void __arena *htab_for_user;
23 int arena_htab_llvm(void *ctx)
25 #if defined(__BPF_FEATURE_ADDR_SPACE_CAST) || defined(BPF_ARENA_FORCE_ASM)
26 struct htab __arena *htab;
29 htab = bpf_alloc(sizeof(*htab));
33 /* first run. No old elems in the table */
34 for (i = zero; i < 1000; i++)
35 htab_update_elem(htab, i, i);
37 /* should replace all elems with new ones */
38 for (i = zero; i < 1000; i++)
39 htab_update_elem(htab, i, i);
48 char _license[] SEC("license") = "GPL";