Skip to content

Commit 2bea29b

Browse files
mgherzanRussell King
authored andcommitted
ARM: 7421/1: bpf_jit: BPF_S_ANC_ALU_XOR_X support
JIT support for the XOR operation introduced by the commit ffe06c1. Signed-off-by: Mircea Gherzan <mgherzan@gmail.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
1 parent 2307574 commit 2bea29b

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

‎arch/arm/net/bpf_jit_32.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,11 @@ static int build_body(struct jit_ctx *ctx)
762762
update_on_xread(ctx);
763763
emit(ARM_MOV_R(r_A, r_X), ctx);
764764
break;
765+
case BPF_S_ANC_ALU_XOR_X:
766+
/* A ^= X */
767+
update_on_xread(ctx);
768+
emit(ARM_EOR_R(r_A, r_A, r_X), ctx);
769+
break;
765770
case BPF_S_ANC_PROTOCOL:
766771
/* A = ntohs(skb->protocol) */
767772
ctx->seen |= SEEN_SKB;

‎arch/arm/net/bpf_jit_32.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@
6868
#define ARM_INST_CMP_R 0x01500000
6969
#define ARM_INST_CMP_I 0x03500000
7070

71+
#define ARM_INST_EOR_R 0x00200000
72+
7173
#define ARM_INST_LDRB_I 0x05d00000
7274
#define ARM_INST_LDRB_R 0x07d00000
7375
#define ARM_INST_LDRH_I 0x01d000b0
@@ -132,6 +134,8 @@
132134
#define ARM_CMP_R(rn, rm) _AL3_R(ARM_INST_CMP, 0, rn, rm)
133135
#define ARM_CMP_I(rn, imm) _AL3_I(ARM_INST_CMP, 0, rn, imm)
134136

137+
#define ARM_EOR_R(rd, rn, rm) _AL3_R(ARM_INST_EOR, rd, rn, rm)
138+
135139
#define ARM_LDR_I(rt, rn, off) (ARM_INST_LDR_I | (rt) << 12 | (rn) << 16 \
136140
| (off))
137141
#define ARM_LDRB_I(rt, rn, off) (ARM_INST_LDRB_I | (rt) << 12 | (rn) << 16 \

0 commit comments

Comments
 (0)