diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2012-12-01 15:29:08 +0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2012-12-03 19:44:02 +0400 |
commit | 3247274536729b6cc23208cc087e50fdef3de6ba (patch) | |
tree | 6d6bc563256dc2c1d74be2dad2a2f63bad5c73ac /arch/s390/net | |
parent | d99e79ec5574fc556c988f613ed6175f6de66f4a (diff) | |
download | linux-3247274536729b6cc23208cc087e50fdef3de6ba.tar.xz |
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/net')
-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, /* lr %r5,%r4 */ EMIT2(0x1854); break; + case BPF_S_ALU_MOD_X: /* A %= X */ + jit->seen |= SEEN_XREG | SEEN_RET0; + /* ltr %r12,%r12 */ + EMIT2(0x12cc); + /* jz <ret0> */ + EMIT4_PCREL(0xa7840000, (jit->ret0_ip - jit->prg)); + /* lhi %r4,0 */ + EMIT4(0xa7480000); + /* dr %r4,%r12 */ + EMIT2(0x1d4c); + /* lr %r5,%r4 */ + EMIT2(0x1854); + break; + case BPF_S_ALU_MOD_K: /* A %= K */ + /* lhi %r4,0 */ + EMIT4(0xa7480000); + /* d %r4,<d(K)>(%r13) */ + EMIT4_DISP(0x5d40d000, EMIT_CONST(K)); + /* lr %r5,%r4 */ + EMIT2(0x1854); + break; case BPF_S_ALU_AND_X: /* A &= X */ jit->seen |= SEEN_XREG; /* nr %r5,%r12 */ |