Skip to content

Commit

Permalink
riscv, bpf: Factor common RISC-V JIT code
Browse files Browse the repository at this point in the history
This patch factors out code that can be used by both the RV64 and RV32
BPF JITs to a common bpf_jit.h and bpf_jit_core.c.

Move struct definitions and macro-like functions to header. Rename
rv_sb_insn/rv_uj_insn to rv_b_insn/rv_j_insn to match the RISC-V
specification.

Move reusable functions emit_body() and bpf_int_jit_compile() to
bpf_jit_core.c with minor simplifications. Rename emit_insn() and
build_{prologue,epilogue}() to be prefixed with "bpf_jit_" as they are
no longer static.

Rename bpf_jit_comp.c to bpf_jit_comp64.c to be more explicit.

Co-developed-by: Xi Wang <[email protected]>
Signed-off-by: Xi Wang <[email protected]>
Signed-off-by: Luke Nelson <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Reviewed-by: Björn Töpel <[email protected]>
Acked-by: Björn Töpel <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
  • Loading branch information
lukenels authored and borkmann committed Mar 5, 2020
1 parent 9ce6010 commit ca6cb54
Show file tree
Hide file tree
Showing 4 changed files with 639 additions and 601 deletions.
3 changes: 2 additions & 1 deletion arch/riscv/net/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_BPF_JIT) += bpf_jit_comp.o

obj-$(CONFIG_BPF_JIT) += bpf_jit_core.o bpf_jit_comp64.o
Loading

0 comments on commit ca6cb54

Please sign in to comment.