Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Michael Holzheu | 0546231 | 2015-04-01 16:08:32 +0200 | [diff] [blame] | 2 | /* |
| 3 | * BPF Jit compiler defines |
| 4 | * |
| 5 | * Copyright IBM Corp. 2012,2015 |
| 6 | * |
| 7 | * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com> |
| 8 | * Michael Holzheu <holzheu@linux.vnet.ibm.com> |
| 9 | */ |
| 10 | |
| 11 | #ifndef __ARCH_S390_NET_BPF_JIT_H |
| 12 | #define __ARCH_S390_NET_BPF_JIT_H |
| 13 | |
| 14 | #ifndef __ASSEMBLY__ |
| 15 | |
| 16 | #include <linux/filter.h> |
| 17 | #include <linux/types.h> |
| 18 | |
Michael Holzheu | 0546231 | 2015-04-01 16:08:32 +0200 | [diff] [blame] | 19 | #endif /* __ASSEMBLY__ */ |
| 20 | |
| 21 | /* |
| 22 | * Stackframe layout (packed stack): |
| 23 | * |
| 24 | * ^ high |
| 25 | * +---------------+ | |
| 26 | * | old backchain | | |
| 27 | * +---------------+ | |
| 28 | * | r15 - r6 | | |
Michael Holzheu | 6651ee0 | 2015-06-08 21:51:06 -0700 | [diff] [blame] | 29 | * +---------------+ | |
| 30 | * | 4 byte align | | |
| 31 | * | tail_call_cnt | | |
Michael Holzheu | 0546231 | 2015-04-01 16:08:32 +0200 | [diff] [blame] | 32 | * BFP -> +===============+ | |
| 33 | * | | | |
| 34 | * | BPF stack | | |
| 35 | * | | | |
Michael Holzheu | 0546231 | 2015-04-01 16:08:32 +0200 | [diff] [blame] | 36 | * R15+160 -> +---------------+ | |
| 37 | * | new backchain | | |
| 38 | * R15+152 -> +---------------+ | |
| 39 | * | + 152 byte SA | | |
| 40 | * R15 -> +---------------+ + low |
| 41 | * |
| 42 | * We get 160 bytes stack space from calling function, but only use |
Michael Holzheu | 6651ee0 | 2015-06-08 21:51:06 -0700 | [diff] [blame] | 43 | * 12 * 8 byte for old backchain, r15..r6, and tail_call_cnt. |
Michael Holzheu | 7837270 | 2017-11-07 19:16:25 +0100 | [diff] [blame] | 44 | * |
| 45 | * The stack size used by the BPF program ("BPF stack" above) is passed |
| 46 | * via "aux->stack_depth". |
Michael Holzheu | 0546231 | 2015-04-01 16:08:32 +0200 | [diff] [blame] | 47 | */ |
Daniel Borkmann | e1cf4befa | 2018-05-04 01:08:22 +0200 | [diff] [blame] | 48 | #define STK_SPACE_ADD (160) |
Michael Holzheu | 6651ee0 | 2015-06-08 21:51:06 -0700 | [diff] [blame] | 49 | #define STK_160_UNUSED (160 - 12 * 8) |
Michael Holzheu | 7837270 | 2017-11-07 19:16:25 +0100 | [diff] [blame] | 50 | #define STK_OFF (STK_SPACE_ADD - STK_160_UNUSED) |
Michael Holzheu | 0546231 | 2015-04-01 16:08:32 +0200 | [diff] [blame] | 51 | |
Michael Holzheu | 6651ee0 | 2015-06-08 21:51:06 -0700 | [diff] [blame] | 52 | #define STK_OFF_R6 (160 - 11 * 8) /* Offset of r6 on stack */ |
| 53 | #define STK_OFF_TCCNT (160 - 12 * 8) /* Offset of tail_call_cnt on stack */ |
| 54 | |
Michael Holzheu | 0546231 | 2015-04-01 16:08:32 +0200 | [diff] [blame] | 55 | #endif /* __ARCH_S390_NET_BPF_JIT_H */ |