18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/* Copyright (c) 2019 Facebook */ 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci#include <stdbool.h> 58c2ecf20Sopenharmony_ci#include <linux/bpf.h> 68c2ecf20Sopenharmony_ci#include <bpf/bpf_helpers.h> 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_cistruct s { 98c2ecf20Sopenharmony_ci int a; 108c2ecf20Sopenharmony_ci long long b; 118c2ecf20Sopenharmony_ci} __attribute__((packed)); 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci/* .data section */ 148c2ecf20Sopenharmony_ciint in1 = -1; 158c2ecf20Sopenharmony_cilong long in2 = -1; 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci/* .bss section */ 188c2ecf20Sopenharmony_cichar in3 = '\0'; 198c2ecf20Sopenharmony_cilong long in4 __attribute__((aligned(64))) = 0; 208c2ecf20Sopenharmony_cistruct s in5 = {}; 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci/* .rodata section */ 238c2ecf20Sopenharmony_ciconst volatile struct { 248c2ecf20Sopenharmony_ci const int in6; 258c2ecf20Sopenharmony_ci} in = {}; 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci/* .data section */ 288c2ecf20Sopenharmony_ciint out1 = -1; 298c2ecf20Sopenharmony_cilong long out2 = -1; 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci/* .bss section */ 328c2ecf20Sopenharmony_cichar out3 = 0; 338c2ecf20Sopenharmony_cilong long out4 = 0; 348c2ecf20Sopenharmony_ciint out6 = 0; 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ciextern bool CONFIG_BPF_SYSCALL __kconfig; 378c2ecf20Sopenharmony_ciextern int LINUX_KERNEL_VERSION __kconfig; 388c2ecf20Sopenharmony_cibool bpf_syscall = 0; 398c2ecf20Sopenharmony_ciint kern_ver = 0; 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ciSEC("raw_tp/sys_enter") 428c2ecf20Sopenharmony_ciint handler(const void *ctx) 438c2ecf20Sopenharmony_ci{ 448c2ecf20Sopenharmony_ci static volatile struct s out5; 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci out1 = in1; 478c2ecf20Sopenharmony_ci out2 = in2; 488c2ecf20Sopenharmony_ci out3 = in3; 498c2ecf20Sopenharmony_ci out4 = in4; 508c2ecf20Sopenharmony_ci out5 = in5; 518c2ecf20Sopenharmony_ci out6 = in.in6; 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci bpf_syscall = CONFIG_BPF_SYSCALL; 548c2ecf20Sopenharmony_ci kern_ver = LINUX_KERNEL_VERSION; 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci return 0; 578c2ecf20Sopenharmony_ci} 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_cichar _license[] SEC("license") = "GPL"; 60