0001
0002
0003
0004 #include "vmlinux.h"
0005 #include <bpf/bpf_helpers.h>
0006 #include <bpf/bpf_endian.h>
0007
0008 #define IN16 0x1234
0009 #define IN32 0x12345678U
0010 #define IN64 0x123456789abcdef0ULL
0011
0012 __u16 in16 = 0;
0013 __u32 in32 = 0;
0014 __u64 in64 = 0;
0015
0016 __u16 out16 = 0;
0017 __u32 out32 = 0;
0018 __u64 out64 = 0;
0019
0020 __u16 const16 = 0;
0021 __u32 const32 = 0;
0022 __u64 const64 = 0;
0023
0024 SEC("raw_tp/sys_enter")
0025 int sys_enter(const void *ctx)
0026 {
0027 out16 = __builtin_bswap16(in16);
0028 out32 = __builtin_bswap32(in32);
0029 out64 = __builtin_bswap64(in64);
0030 const16 = ___bpf_swab16(IN16);
0031 const32 = ___bpf_swab32(IN32);
0032 const64 = ___bpf_swab64(IN64);
0033
0034 return 0;
0035 }
0036
0037 char _license[] SEC("license") = "GPL";