18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * BPF Jit compiler defines 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright IBM Corp. 2012,2015 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com> 88c2ecf20Sopenharmony_ci * Michael Holzheu <holzheu@linux.vnet.ibm.com> 98c2ecf20Sopenharmony_ci */ 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#ifndef __ARCH_S390_NET_BPF_JIT_H 128c2ecf20Sopenharmony_ci#define __ARCH_S390_NET_BPF_JIT_H 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__ 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#include <linux/filter.h> 178c2ecf20Sopenharmony_ci#include <linux/types.h> 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci#endif /* __ASSEMBLY__ */ 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci/* 228c2ecf20Sopenharmony_ci * Stackframe layout (packed stack): 238c2ecf20Sopenharmony_ci * 248c2ecf20Sopenharmony_ci * ^ high 258c2ecf20Sopenharmony_ci * +---------------+ | 268c2ecf20Sopenharmony_ci * | old backchain | | 278c2ecf20Sopenharmony_ci * +---------------+ | 288c2ecf20Sopenharmony_ci * | r15 - r6 | | 298c2ecf20Sopenharmony_ci * +---------------+ | 308c2ecf20Sopenharmony_ci * | 4 byte align | | 318c2ecf20Sopenharmony_ci * | tail_call_cnt | | 328c2ecf20Sopenharmony_ci * BFP -> +===============+ | 338c2ecf20Sopenharmony_ci * | | | 348c2ecf20Sopenharmony_ci * | BPF stack | | 358c2ecf20Sopenharmony_ci * | | | 368c2ecf20Sopenharmony_ci * R15+160 -> +---------------+ | 378c2ecf20Sopenharmony_ci * | new backchain | | 388c2ecf20Sopenharmony_ci * R15+152 -> +---------------+ | 398c2ecf20Sopenharmony_ci * | + 152 byte SA | | 408c2ecf20Sopenharmony_ci * R15 -> +---------------+ + low 418c2ecf20Sopenharmony_ci * 428c2ecf20Sopenharmony_ci * We get 160 bytes stack space from calling function, but only use 438c2ecf20Sopenharmony_ci * 12 * 8 byte for old backchain, r15..r6, and tail_call_cnt. 448c2ecf20Sopenharmony_ci * 458c2ecf20Sopenharmony_ci * The stack size used by the BPF program ("BPF stack" above) is passed 468c2ecf20Sopenharmony_ci * via "aux->stack_depth". 478c2ecf20Sopenharmony_ci */ 488c2ecf20Sopenharmony_ci#define STK_SPACE_ADD (160) 498c2ecf20Sopenharmony_ci#define STK_160_UNUSED (160 - 12 * 8) 508c2ecf20Sopenharmony_ci#define STK_OFF (STK_SPACE_ADD - STK_160_UNUSED) 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci#define STK_OFF_R6 (160 - 11 * 8) /* Offset of r6 on stack */ 538c2ecf20Sopenharmony_ci#define STK_OFF_TCCNT (160 - 12 * 8) /* Offset of tail_call_cnt on stack */ 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci#endif /* __ARCH_S390_NET_BPF_JIT_H */ 56