1*8c183110SAndrii Nakryiko // SPDX-License-Identifier: GPL-2.0 2*8c183110SAndrii Nakryiko /* Copyright (c) 2020 Facebook */ 3*8c183110SAndrii Nakryiko 4*8c183110SAndrii Nakryiko #include "vmlinux.h" 5*8c183110SAndrii Nakryiko #include <bpf/bpf_helpers.h> 6*8c183110SAndrii Nakryiko #include <bpf/bpf_endian.h> 7*8c183110SAndrii Nakryiko 8*8c183110SAndrii Nakryiko #define IN16 0x1234 9*8c183110SAndrii Nakryiko #define IN32 0x12345678U 10*8c183110SAndrii Nakryiko #define IN64 0x123456789abcdef0ULL 11*8c183110SAndrii Nakryiko 12*8c183110SAndrii Nakryiko __u16 in16 = 0; 13*8c183110SAndrii Nakryiko __u32 in32 = 0; 14*8c183110SAndrii Nakryiko __u64 in64 = 0; 15*8c183110SAndrii Nakryiko 16*8c183110SAndrii Nakryiko __u16 out16 = 0; 17*8c183110SAndrii Nakryiko __u32 out32 = 0; 18*8c183110SAndrii Nakryiko __u64 out64 = 0; 19*8c183110SAndrii Nakryiko 20*8c183110SAndrii Nakryiko __u16 const16 = 0; 21*8c183110SAndrii Nakryiko __u32 const32 = 0; 22*8c183110SAndrii Nakryiko __u64 const64 = 0; 23*8c183110SAndrii Nakryiko 24*8c183110SAndrii Nakryiko SEC("raw_tp/sys_enter") sys_enter(const void * ctx)25*8c183110SAndrii Nakryikoint sys_enter(const void *ctx) 26*8c183110SAndrii Nakryiko { 27*8c183110SAndrii Nakryiko out16 = __builtin_bswap16(in16); 28*8c183110SAndrii Nakryiko out32 = __builtin_bswap32(in32); 29*8c183110SAndrii Nakryiko out64 = __builtin_bswap64(in64); 30*8c183110SAndrii Nakryiko const16 = ___bpf_swab16(IN16); 31*8c183110SAndrii Nakryiko const32 = ___bpf_swab32(IN32); 32*8c183110SAndrii Nakryiko const64 = ___bpf_swab64(IN64); 33*8c183110SAndrii Nakryiko 34*8c183110SAndrii Nakryiko return 0; 35*8c183110SAndrii Nakryiko } 36*8c183110SAndrii Nakryiko 37*8c183110SAndrii Nakryiko char _license[] SEC("license") = "GPL"; 38