diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2012-12-01 06:29:08 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2012-12-03 10:44:02 -0500 |
commit | 3247274536729b6cc23208cc087e50fdef3de6ba (patch) | |
tree | 6d6bc563256dc2c1d74be2dad2a2f63bad5c73ac /arch/s390 | |
parent | d99e79ec5574fc556c988f613ed6175f6de66f4a (diff) |
s390/bpf,jit: add support MOD instruction
Add support for MOD operation for s390's JIT.
Same as 280050cc "x86 bpf_jit: support MOD operation" for x86 which
adds JIT support for the generic new MOD operation introduced with
b6069a9570 "filter: add MOD operation".
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/net/bpf_jit_comp.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c index 9b355b406afa..1ff930167348 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 */ |