Kyle Swenson | 8d8f654 | 2021-03-15 11:02:55 -0600 | [diff] [blame^] | 1 | /* |
| 2 | * BPF Jit compiler defines |
| 3 | * |
| 4 | * Copyright IBM Corp. 2012,2015 |
| 5 | * |
| 6 | * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com> |
| 7 | * Michael Holzheu <holzheu@linux.vnet.ibm.com> |
| 8 | */ |
| 9 | |
| 10 | #ifndef __ARCH_S390_NET_BPF_JIT_H |
| 11 | #define __ARCH_S390_NET_BPF_JIT_H |
| 12 | |
| 13 | #ifndef __ASSEMBLY__ |
| 14 | |
| 15 | #include <linux/filter.h> |
| 16 | #include <linux/types.h> |
| 17 | |
| 18 | extern u8 sk_load_word_pos[], sk_load_half_pos[], sk_load_byte_pos[]; |
| 19 | extern u8 sk_load_word[], sk_load_half[], sk_load_byte[]; |
| 20 | |
| 21 | #endif /* __ASSEMBLY__ */ |
| 22 | |
| 23 | /* |
| 24 | * Stackframe layout (packed stack): |
| 25 | * |
| 26 | * ^ high |
| 27 | * +---------------+ | |
| 28 | * | old backchain | | |
| 29 | * +---------------+ | |
| 30 | * | r15 - r6 | | |
| 31 | * +---------------+ | |
| 32 | * | 4 byte align | | |
| 33 | * | tail_call_cnt | | |
| 34 | * BFP -> +===============+ | |
| 35 | * | | | |
| 36 | * | BPF stack | | |
| 37 | * | | | |
| 38 | * +---------------+ | |
| 39 | * | 8 byte skbp | | |
| 40 | * R15+176 -> +---------------+ | |
| 41 | * | 8 byte hlen | | |
| 42 | * R15+168 -> +---------------+ | |
| 43 | * | 4 byte align | | |
| 44 | * +---------------+ | |
| 45 | * | 4 byte temp | | |
| 46 | * | for bpf_jit.S | | |
| 47 | * R15+160 -> +---------------+ | |
| 48 | * | new backchain | | |
| 49 | * R15+152 -> +---------------+ | |
| 50 | * | + 152 byte SA | | |
| 51 | * R15 -> +---------------+ + low |
| 52 | * |
| 53 | * We get 160 bytes stack space from calling function, but only use |
| 54 | * 12 * 8 byte for old backchain, r15..r6, and tail_call_cnt. |
| 55 | */ |
| 56 | #define STK_SPACE (MAX_BPF_STACK + 8 + 8 + 4 + 4 + 160) |
| 57 | #define STK_160_UNUSED (160 - 12 * 8) |
| 58 | #define STK_OFF (STK_SPACE - STK_160_UNUSED) |
| 59 | #define STK_OFF_TMP 160 /* Offset of tmp buffer on stack */ |
| 60 | #define STK_OFF_HLEN 168 /* Offset of SKB header length on stack */ |
| 61 | #define STK_OFF_SKBP 176 /* Offset of SKB pointer on stack */ |
| 62 | |
| 63 | #define STK_OFF_R6 (160 - 11 * 8) /* Offset of r6 on stack */ |
| 64 | #define STK_OFF_TCCNT (160 - 12 * 8) /* Offset of tail_call_cnt on stack */ |
| 65 | |
| 66 | /* Offset to skip condition code check */ |
| 67 | #define OFF_OK 4 |
| 68 | |
| 69 | #endif /* __ARCH_S390_NET_BPF_JIT_H */ |