~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/powerpc/net/bpf_jit64.h

Version: ~ [ linux-4.20-rc6 ] ~ [ linux-4.19.8 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.87 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.144 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.166 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.128 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.61 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.39.4 ] ~ [ linux-2.6.38.8 ] ~ [ linux-2.6.37.6 ] ~ [ linux-2.6.36.4 ] ~ [ linux-2.6.35.14 ] ~ [ linux-2.6.34.15 ] ~ [ linux-2.6.33.20 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.31.14 ] ~ [ linux-2.6.30.10 ] ~ [ linux-2.6.29.6 ] ~ [ linux-2.6.28.10 ] ~ [ linux-2.6.27.62 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * bpf_jit64.h: BPF JIT compiler for PPC64
  3  *
  4  * Copyright 2016 Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
  5  *                IBM Corporation
  6  *
  7  * This program is free software; you can redistribute it and/or
  8  * modify it under the terms of the GNU General Public License
  9  * as published by the Free Software Foundation; version 2
 10  * of the License.
 11  */
 12 #ifndef _BPF_JIT64_H
 13 #define _BPF_JIT64_H
 14 
 15 #include "bpf_jit.h"
 16 
 17 /*
 18  * Stack layout:
 19  * Ensure the top half (upto local_tmp_var) stays consistent
 20  * with our redzone usage.
 21  *
 22  *              [       prev sp         ] <-------------
 23  *              [   nv gpr save area    ] 6*8           |
 24  *              [    tail_call_cnt      ] 8             |
 25  *              [    local_tmp_var      ] 8             |
 26  * fp (r31) --> [   ebpf stack space    ] upto 512      |
 27  *              [     frame header      ] 32/112        |
 28  * sp (r1) ---> [    stack pointer      ] --------------
 29  */
 30 
 31 /* for gpr non volatile registers BPG_REG_6 to 10 */
 32 #define BPF_PPC_STACK_SAVE      (6*8)
 33 /* for bpf JIT code internal usage */
 34 #define BPF_PPC_STACK_LOCALS    16
 35 /* stack frame excluding BPF stack, ensure this is quadword aligned */
 36 #define BPF_PPC_STACKFRAME      (STACK_FRAME_MIN_SIZE + \
 37                                  BPF_PPC_STACK_LOCALS + BPF_PPC_STACK_SAVE)
 38 
 39 #ifndef __ASSEMBLY__
 40 
 41 /* BPF register usage */
 42 #define TMP_REG_1       (MAX_BPF_JIT_REG + 0)
 43 #define TMP_REG_2       (MAX_BPF_JIT_REG + 1)
 44 
 45 /* BPF to ppc register mappings */
 46 static const int b2p[] = {
 47         /* function return value */
 48         [BPF_REG_0] = 8,
 49         /* function arguments */
 50         [BPF_REG_1] = 3,
 51         [BPF_REG_2] = 4,
 52         [BPF_REG_3] = 5,
 53         [BPF_REG_4] = 6,
 54         [BPF_REG_5] = 7,
 55         /* non volatile registers */
 56         [BPF_REG_6] = 27,
 57         [BPF_REG_7] = 28,
 58         [BPF_REG_8] = 29,
 59         [BPF_REG_9] = 30,
 60         /* frame pointer aka BPF_REG_10 */
 61         [BPF_REG_FP] = 31,
 62         /* eBPF jit internal registers */
 63         [BPF_REG_AX] = 2,
 64         [TMP_REG_1] = 9,
 65         [TMP_REG_2] = 10
 66 };
 67 
 68 /* PPC NVR range -- update this if we ever use NVRs below r27 */
 69 #define BPF_PPC_NVR_MIN         27
 70 
 71 #define SEEN_FUNC       0x1000 /* might call external helpers */
 72 #define SEEN_STACK      0x2000 /* uses BPF stack */
 73 #define SEEN_TAILCALL   0x4000 /* uses tail calls */
 74 
 75 struct codegen_context {
 76         /*
 77          * This is used to track register usage as well
 78          * as calls to external helpers.
 79          * - register usage is tracked with corresponding
 80          *   bits (r3-r10 and r27-r31)
 81          * - rest of the bits can be used to track other
 82          *   things -- for now, we use bits 16 to 23
 83          *   encoded in SEEN_* macros above
 84          */
 85         unsigned int seen;
 86         unsigned int idx;
 87         unsigned int stack_size;
 88 };
 89 
 90 #endif /* !__ASSEMBLY__ */
 91 
 92 #endif
 93 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp