diff options
Diffstat (limited to 'arch/powerpc/net/bpf_jit.h')
| -rw-r--r-- | arch/powerpc/net/bpf_jit.h | 17 | 
1 files changed, 13 insertions, 4 deletions
diff --git a/arch/powerpc/net/bpf_jit.h b/arch/powerpc/net/bpf_jit.h index 7e9b978b768e..b20a2a83a6e7 100644 --- a/arch/powerpc/net/bpf_jit.h +++ b/arch/powerpc/net/bpf_jit.h @@ -31,7 +31,7 @@  			pr_err_ratelimited("Branch offset 0x%lx (@%u) out of range\n", offset, ctx->idx);			\  			return -ERANGE;					      \  		}							      \ -		EMIT(PPC_INST_BRANCH | (offset & 0x03fffffc));		      \ +		EMIT(PPC_RAW_BRANCH(offset));				      \  	} while (0)  /* blr; (unconditional 'branch' with link) to absolute address */ @@ -125,8 +125,7 @@  #define COND_LE		(CR0_GT | COND_CMP_FALSE)  #define SEEN_FUNC	0x20000000 /* might call external helpers */ -#define SEEN_STACK	0x40000000 /* uses BPF stack */ -#define SEEN_TAILCALL	0x80000000 /* uses tail calls */ +#define SEEN_TAILCALL	0x40000000 /* uses tail calls */  #define SEEN_VREG_MASK	0x1ff80000 /* Volatile registers r3-r12 */  #define SEEN_NVREG_MASK	0x0003ffff /* Non volatile registers r14-r31 */ @@ -151,8 +150,15 @@ struct codegen_context {  	unsigned int idx;  	unsigned int stack_size;  	int b2p[ARRAY_SIZE(b2p)]; +	unsigned int exentry_idx;  }; +#ifdef CONFIG_PPC32 +#define BPF_FIXUP_LEN	3 /* Three instructions => 12 bytes */ +#else +#define BPF_FIXUP_LEN	2 /* Two instructions => 8 bytes */ +#endif +  static inline void bpf_flush_icache(void *start, void *end)  {  	smp_wmb();	/* smp write barrier */ @@ -176,11 +182,14 @@ static inline void bpf_clear_seen_register(struct codegen_context *ctx, int i)  void bpf_jit_emit_func_call_rel(u32 *image, struct codegen_context *ctx, u64 func);  int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context *ctx, -		       u32 *addrs, bool extra_pass); +		       u32 *addrs, int pass);  void bpf_jit_build_prologue(u32 *image, struct codegen_context *ctx);  void bpf_jit_build_epilogue(u32 *image, struct codegen_context *ctx);  void bpf_jit_realloc_regs(struct codegen_context *ctx); +int bpf_add_extable_entry(struct bpf_prog *fp, u32 *image, int pass, struct codegen_context *ctx, +			  int insn_idx, int jmp_off, int dst_reg); +  #endif  #endif  |