aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/net/bpf_jit_comp.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/net/bpf_jit_comp.c')
-rw-r--r--arch/s390/net/bpf_jit_comp.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
index 7690dc8e1ab5..20c146d1251a 100644
--- a/arch/s390/net/bpf_jit_comp.c
+++ b/arch/s390/net/bpf_jit_comp.c
@@ -443,8 +443,11 @@ static void bpf_jit_epilogue(struct bpf_jit *jit)
443 443
444/* 444/*
445 * Compile one eBPF instruction into s390x code 445 * Compile one eBPF instruction into s390x code
446 *
447 * NOTE: Use noinline because for gcov (-fprofile-arcs) gcc allocates a lot of
448 * stack space for the large switch statement.
446 */ 449 */
447static int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i) 450static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i)
448{ 451{
449 struct bpf_insn *insn = &fp->insnsi[i]; 452 struct bpf_insn *insn = &fp->insnsi[i];
450 int jmp_off, last, insn_count = 1; 453 int jmp_off, last, insn_count = 1;
@@ -588,8 +591,8 @@ static int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i)
588 EMIT4(0xb9160000, dst_reg, rc_reg); 591 EMIT4(0xb9160000, dst_reg, rc_reg);
589 break; 592 break;
590 } 593 }
591 case BPF_ALU64 | BPF_DIV | BPF_X: /* dst = dst / (u32) src */ 594 case BPF_ALU64 | BPF_DIV | BPF_X: /* dst = dst / src */
592 case BPF_ALU64 | BPF_MOD | BPF_X: /* dst = dst % (u32) src */ 595 case BPF_ALU64 | BPF_MOD | BPF_X: /* dst = dst % src */
593 { 596 {
594 int rc_reg = BPF_OP(insn->code) == BPF_DIV ? REG_W1 : REG_W0; 597 int rc_reg = BPF_OP(insn->code) == BPF_DIV ? REG_W1 : REG_W0;
595 598
@@ -602,10 +605,8 @@ static int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i)
602 EMIT4_IMM(0xa7090000, REG_W0, 0); 605 EMIT4_IMM(0xa7090000, REG_W0, 0);
603 /* lgr %w1,%dst */ 606 /* lgr %w1,%dst */
604 EMIT4(0xb9040000, REG_W1, dst_reg); 607 EMIT4(0xb9040000, REG_W1, dst_reg);
605 /* llgfr %dst,%src (u32 cast) */
606 EMIT4(0xb9160000, dst_reg, src_reg);
607 /* dlgr %w0,%dst */ 608 /* dlgr %w0,%dst */
608 EMIT4(0xb9870000, REG_W0, dst_reg); 609 EMIT4(0xb9870000, REG_W0, src_reg);
609 /* lgr %dst,%rc */ 610 /* lgr %dst,%rc */
610 EMIT4(0xb9040000, dst_reg, rc_reg); 611 EMIT4(0xb9040000, dst_reg, rc_reg);
611 break; 612 break;
@@ -632,8 +633,8 @@ static int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i)
632 EMIT4(0xb9160000, dst_reg, rc_reg); 633 EMIT4(0xb9160000, dst_reg, rc_reg);
633 break; 634 break;
634 } 635 }
635 case BPF_ALU64 | BPF_DIV | BPF_K: /* dst = dst / (u32) imm */ 636 case BPF_ALU64 | BPF_DIV | BPF_K: /* dst = dst / imm */
636 case BPF_ALU64 | BPF_MOD | BPF_K: /* dst = dst % (u32) imm */ 637 case BPF_ALU64 | BPF_MOD | BPF_K: /* dst = dst % imm */
637 { 638 {
638 int rc_reg = BPF_OP(insn->code) == BPF_DIV ? REG_W1 : REG_W0; 639 int rc_reg = BPF_OP(insn->code) == BPF_DIV ? REG_W1 : REG_W0;
639 640
@@ -649,7 +650,7 @@ static int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i)
649 EMIT4(0xb9040000, REG_W1, dst_reg); 650 EMIT4(0xb9040000, REG_W1, dst_reg);
650 /* dlg %w0,<d(imm)>(%l) */ 651 /* dlg %w0,<d(imm)>(%l) */
651 EMIT6_DISP_LH(0xe3000000, 0x0087, REG_W0, REG_0, REG_L, 652 EMIT6_DISP_LH(0xe3000000, 0x0087, REG_W0, REG_0, REG_L,
652 EMIT_CONST_U64((u32) imm)); 653 EMIT_CONST_U64(imm));
653 /* lgr %dst,%rc */ 654 /* lgr %dst,%rc */
654 EMIT4(0xb9040000, dst_reg, rc_reg); 655 EMIT4(0xb9040000, dst_reg, rc_reg);
655 break; 656 break;