netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] x86: bpf_jit_comp: add XOR instruction for BPF JIT
@ 2012-09-24 17:34 Daniel Borkmann
  2012-09-24 17:44 ` Eric Dumazet
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Borkmann @ 2012-09-24 17:34 UTC (permalink / raw)
  To: davem; +Cc: eric.dumazet, netdev

This patch is a follow-up for patch "filter: add XOR instruction for use
with X/K" that implements BPF x86 JIT parts for the BPF XOR operation.

Signed-off-by: Daniel Borkmann <daniel.borkmann@tik.ee.ethz.ch>
---
 arch/x86/net/bpf_jit_comp.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
index 106c578..520d2bd 100644
--- a/arch/x86/net/bpf_jit_comp.c
+++ b/arch/x86/net/bpf_jit_comp.c
@@ -335,9 +335,18 @@ void bpf_jit_compile(struct sk_filter *fp)
 					EMIT1_off32(0x0d, K);	/* or imm32,%eax */
 				break;
 			case BPF_S_ANC_ALU_XOR_X: /* A ^= X; */
+			case BPF_S_ALU_XOR_X:
 				seen |= SEEN_XREG;
 				EMIT2(0x31, 0xd8);		/* xor %ebx,%eax */
 				break;
+			case BPF_S_ALU_XOR_K: /* A ^= K; */
+				if (K == 0)
+					break;
+				if (is_imm8(K))
+					EMIT3(0x83, 0xf0, K);	/* xor imm8,%eax */
+				else
+					EMIT1_off32(0x35, K);	/* xor imm32,%eax */
+				break;
 			case BPF_S_ALU_LSH_X: /* A <<= X; */
 				seen |= SEEN_XREG;
 				EMIT4(0x89, 0xd9, 0xd3, 0xe0);	/* mov %ebx,%ecx; shl %cl,%eax */

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] x86: bpf_jit_comp: add XOR instruction for BPF JIT
  2012-09-24 17:34 [PATCH net-next] x86: bpf_jit_comp: add XOR instruction for BPF JIT Daniel Borkmann
@ 2012-09-24 17:44 ` Eric Dumazet
  2012-09-24 20:55   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2012-09-24 17:44 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: davem, netdev

On Mon, 2012-09-24 at 19:34 +0200, Daniel Borkmann wrote:
> This patch is a follow-up for patch "filter: add XOR instruction for use
> with X/K" that implements BPF x86 JIT parts for the BPF XOR operation.
> 
> Signed-off-by: Daniel Borkmann <daniel.borkmann@tik.ee.ethz.ch>
> ---
>  arch/x86/net/bpf_jit_comp.c |    9 +++++++++
>  1 files changed, 9 insertions(+), 0 deletions(-)

Acked-by: Eric Dumazet <edumazet@google.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] x86: bpf_jit_comp: add XOR instruction for BPF JIT
  2012-09-24 17:44 ` Eric Dumazet
@ 2012-09-24 20:55   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2012-09-24 20:55 UTC (permalink / raw)
  To: eric.dumazet; +Cc: dxchgb, netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 24 Sep 2012 19:44:07 +0200

> On Mon, 2012-09-24 at 19:34 +0200, Daniel Borkmann wrote:
>> This patch is a follow-up for patch "filter: add XOR instruction for use
>> with X/K" that implements BPF x86 JIT parts for the BPF XOR operation.
>> 
>> Signed-off-by: Daniel Borkmann <daniel.borkmann@tik.ee.ethz.ch>
>> ---
>>  arch/x86/net/bpf_jit_comp.c |    9 +++++++++
>>  1 files changed, 9 insertions(+), 0 deletions(-)
> 
> Acked-by: Eric Dumazet <edumazet@google.com>

Applied, thanks everyone.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-09-24 20:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-24 17:34 [PATCH net-next] x86: bpf_jit_comp: add XOR instruction for BPF JIT Daniel Borkmann
2012-09-24 17:44 ` Eric Dumazet
2012-09-24 20:55   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).