18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/* Copyright (c) 2020 Facebook */ 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci#include "vmlinux.h" 58c2ecf20Sopenharmony_ci#include <bpf/bpf_helpers.h> 68c2ecf20Sopenharmony_ci#include <bpf/bpf_endian.h> 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#define IN16 0x1234 98c2ecf20Sopenharmony_ci#define IN32 0x12345678U 108c2ecf20Sopenharmony_ci#define IN64 0x123456789abcdef0ULL 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci__u16 in16 = 0; 138c2ecf20Sopenharmony_ci__u32 in32 = 0; 148c2ecf20Sopenharmony_ci__u64 in64 = 0; 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci__u16 out16 = 0; 178c2ecf20Sopenharmony_ci__u32 out32 = 0; 188c2ecf20Sopenharmony_ci__u64 out64 = 0; 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci__u16 const16 = 0; 218c2ecf20Sopenharmony_ci__u32 const32 = 0; 228c2ecf20Sopenharmony_ci__u64 const64 = 0; 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ciSEC("raw_tp/sys_enter") 258c2ecf20Sopenharmony_ciint sys_enter(const void *ctx) 268c2ecf20Sopenharmony_ci{ 278c2ecf20Sopenharmony_ci out16 = __builtin_bswap16(in16); 288c2ecf20Sopenharmony_ci out32 = __builtin_bswap32(in32); 298c2ecf20Sopenharmony_ci out64 = __builtin_bswap64(in64); 308c2ecf20Sopenharmony_ci const16 = ___bpf_swab16(IN16); 318c2ecf20Sopenharmony_ci const32 = ___bpf_swab32(IN32); 328c2ecf20Sopenharmony_ci const64 = ___bpf_swab64(IN64); 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci return 0; 358c2ecf20Sopenharmony_ci} 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_cichar _license[] SEC("license") = "GPL"; 38