aboutsummaryrefslogtreecommitdiff
path: root/arch/x86/net/bpf_jit_comp32.c
diff options
context:
space:
mode:
authorPeter Zijlstra <[email protected]>2021-10-26 14:01:47 +0200
committerPeter Zijlstra <[email protected]>2021-10-28 23:25:29 +0200
commitdceba0817ca329868a15e2e1dd46eb6340b69206 (patch)
treedb2c78fdc514cad884fa8f21a2ce7a1abd7b76b4 /arch/x86/net/bpf_jit_comp32.c
parentf8a66d608a3e471e1202778c2a36cbdc96bae73b (diff)
bpf,x86: Simplify computing label offsets
Take an idea from the 32bit JIT, which uses the multi-pass nature of the JIT to compute the instruction offsets on a prior pass in order to compute the relative jump offsets on a later pass. Application to the x86_64 JIT is slightly more involved because the offsets depend on program variables (such as callee_regs_used and stack_depth) and hence the computed offsets need to be kept in the context of the JIT. This removes, IMO quite fragile, code that hard-codes the offsets and tries to compute the length of variable parts of it. Convert both emit_bpf_tail_call_*() functions which have an out: label at the end. Additionally emit_bpt_tail_call_direct() also has a poke table entry, for which it computes the offset from the end (and thus already relies on the previous pass to have computed addrs[i]), also convert this to be a forward based offset. Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Borislav Petkov <[email protected]> Acked-by: Alexei Starovoitov <[email protected]> Acked-by: Josh Poimboeuf <[email protected]> Tested-by: Alexei Starovoitov <[email protected]> Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'arch/x86/net/bpf_jit_comp32.c')
0 files changed, 0 insertions, 0 deletions