x86 bpf_jit: support BPF_S_ANC_ALU_XOR_X instruction

commit ffe06c17af  (filter: add XOR operation) added generic support
for XOR operation.

This patch implements the XOR instruction in x86 jit.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Eric Dumazet 2012-06-04 21:26:30 +00:00 committed by David S. Miller
parent c2fd03a011
commit 4bfaddf15b
1 changed files with 4 additions and 0 deletions

View File

@ -309,6 +309,10 @@ void bpf_jit_compile(struct sk_filter *fp)
else else
EMIT1_off32(0x0d, K); /* or imm32,%eax */ EMIT1_off32(0x0d, K); /* or imm32,%eax */
break; break;
case BPF_S_ANC_ALU_XOR_X: /* A ^= X; */
seen |= SEEN_XREG;
EMIT2(0x31, 0xd8); /* xor %ebx,%eax */
break;
case BPF_S_ALU_LSH_X: /* A <<= X; */ case BPF_S_ALU_LSH_X: /* A <<= X; */
seen |= SEEN_XREG; seen |= SEEN_XREG;
EMIT4(0x89, 0xd9, 0xd3, 0xe0); /* mov %ebx,%ecx; shl %cl,%eax */ EMIT4(0x89, 0xd9, 0xd3, 0xe0); /* mov %ebx,%ecx; shl %cl,%eax */