diff options
Diffstat (limited to 'arch/s390/net/bpf_jit_comp.c')
-rw-r--r-- | arch/s390/net/bpf_jit_comp.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c index 9b355b406afa..bb284419b0fd 100644 --- a/arch/s390/net/bpf_jit_comp.c +++ b/arch/s390/net/bpf_jit_comp.c | |||
@@ -341,6 +341,27 @@ static int bpf_jit_insn(struct bpf_jit *jit, struct sock_filter *filter, | |||
341 | /* lr %r5,%r4 */ | 341 | /* lr %r5,%r4 */ |
342 | EMIT2(0x1854); | 342 | EMIT2(0x1854); |
343 | break; | 343 | break; |
344 | case BPF_S_ALU_MOD_X: /* A %= X */ | ||
345 | jit->seen |= SEEN_XREG | SEEN_RET0; | ||
346 | /* ltr %r12,%r12 */ | ||
347 | EMIT2(0x12cc); | ||
348 | /* jz <ret0> */ | ||
349 | EMIT4_PCREL(0xa7840000, (jit->ret0_ip - jit->prg)); | ||
350 | /* lhi %r4,0 */ | ||
351 | EMIT4(0xa7480000); | ||
352 | /* dr %r4,%r12 */ | ||
353 | EMIT2(0x1d4c); | ||
354 | /* lr %r5,%r4 */ | ||
355 | EMIT2(0x1854); | ||
356 | break; | ||
357 | case BPF_S_ALU_MOD_K: /* A %= K */ | ||
358 | /* lhi %r4,0 */ | ||
359 | EMIT4(0xa7480000); | ||
360 | /* d %r4,<d(K)>(%r13) */ | ||
361 | EMIT4_DISP(0x5d40d000, EMIT_CONST(K)); | ||
362 | /* lr %r5,%r4 */ | ||
363 | EMIT2(0x1854); | ||
364 | break; | ||
344 | case BPF_S_ALU_AND_X: /* A &= X */ | 365 | case BPF_S_ALU_AND_X: /* A &= X */ |
345 | jit->seen |= SEEN_XREG; | 366 | jit->seen |= SEEN_XREG; |
346 | /* nr %r5,%r12 */ | 367 | /* nr %r5,%r12 */ |
@@ -368,10 +389,17 @@ static int bpf_jit_insn(struct bpf_jit *jit, struct sock_filter *filter, | |||
368 | EMIT4_DISP(0x5650d000, EMIT_CONST(K)); | 389 | EMIT4_DISP(0x5650d000, EMIT_CONST(K)); |
369 | break; | 390 | break; |
370 | case BPF_S_ANC_ALU_XOR_X: /* A ^= X; */ | 391 | case BPF_S_ANC_ALU_XOR_X: /* A ^= X; */ |
392 | case BPF_S_ALU_XOR_X: | ||
371 | jit->seen |= SEEN_XREG; | 393 | jit->seen |= SEEN_XREG; |
372 | /* xr %r5,%r12 */ | 394 | /* xr %r5,%r12 */ |
373 | EMIT2(0x175c); | 395 | EMIT2(0x175c); |
374 | break; | 396 | break; |
397 | case BPF_S_ALU_XOR_K: /* A ^= K */ | ||
398 | if (!K) | ||
399 | break; | ||
400 | /* x %r5,<d(K)>(%r13) */ | ||
401 | EMIT4_DISP(0x5750d000, EMIT_CONST(K)); | ||
402 | break; | ||
375 | case BPF_S_ALU_LSH_X: /* A <<= X; */ | 403 | case BPF_S_ALU_LSH_X: /* A <<= X; */ |
376 | jit->seen |= SEEN_XREG; | 404 | jit->seen |= SEEN_XREG; |
377 | /* sll %r5,0(%r12) */ | 405 | /* sll %r5,0(%r12) */ |