1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (c) 2019 Facebook
6 #include "bpf_helpers.h"
7 #include "bpf_core_read.h"
9 char _license
[] SEC("license") = "GPL";
16 struct core_reloc_bitfields
{
17 /* unsigned bitfields */
21 /* signed bitfields */
29 /* bitfield read results, all as plain integers */
30 struct core_reloc_bitfields_output
{
42 struct trace_sys_enter
{
47 SEC("tp_btf/sys_enter")
48 int test_core_bitfields_direct(void *ctx
)
50 struct core_reloc_bitfields
*in
= (void *)&data
.in
;
51 struct core_reloc_bitfields_output
*out
= (void *)&data
.out
;
53 out
->ub1
= BPF_CORE_READ_BITFIELD(in
, ub1
);
54 out
->ub2
= BPF_CORE_READ_BITFIELD(in
, ub2
);
55 out
->ub7
= BPF_CORE_READ_BITFIELD(in
, ub7
);
56 out
->sb4
= BPF_CORE_READ_BITFIELD(in
, sb4
);
57 out
->sb20
= BPF_CORE_READ_BITFIELD(in
, sb20
);
58 out
->u32
= BPF_CORE_READ_BITFIELD(in
, u32
);
59 out
->s32
= BPF_CORE_READ_BITFIELD(in
, s32
);