Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/bpf: Use bpf_skip() in bpf_jit_prologue()

Now that we have bpf_skip() for emitting nops, use it in
bpf_jit_prologue() in order to reduce code duplication.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200717165326.6786-6-iii@linux.ibm.com

authored by

Ilya Leoshkevich and committed by
Alexei Starovoitov
94ad428d 1491b733

+5 -4
+5 -4
arch/s390/net/bpf_jit_comp.c
··· 519 519 /* xc STK_OFF_TCCNT(4,%r15),STK_OFF_TCCNT(%r15) */ 520 520 _EMIT6(0xd703f000 | STK_OFF_TCCNT, 0xf000 | STK_OFF_TCCNT); 521 521 } else { 522 - /* j tail_call_start: NOP if no tail calls are used */ 523 - EMIT4_PCREL(0xa7f40000, 6); 524 - /* bcr 0,%0 */ 525 - EMIT2(0x0700, 0, REG_0); 522 + /* 523 + * There are no tail calls. Insert nops in order to have 524 + * tail_call_start at a predictable offset. 525 + */ 526 + bpf_skip(jit, 6); 526 527 } 527 528 /* Tail calls have to skip above initialization */ 528 529 jit->tail_call_start = jit->prg;