diff options
author | David S. Miller <davem@davemloft.net> | 2012-04-17 16:08:29 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-04-17 16:08:29 -0400 |
commit | 7b56f76edf2da7ab3e356cc0db16f9af4c6a26e2 (patch) | |
tree | 655860580d081c983e643589e6f56cc1a01138f3 /arch/sparc/net | |
parent | b3d7b2f2f07ff0ab87442f2d499f2860ef59bfaa (diff) |
net: filter: Fix some minor issues in sparc JIT.
Correct conventions comments. %o4 and %o5 were swapped,
%g3 was not documented.
Use r_TMP instead of r_SKB_DATA + r_OFF where possible in
assembler stubs.
Correct discussion of %o4 and %o5 in one of bpf_jit_compile()'s
comments.
Based upon feedback from Richard Mortimer.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/net')
-rw-r--r-- | arch/sparc/net/bpf_jit.h | 5 | ||||
-rw-r--r-- | arch/sparc/net/bpf_jit_asm.S | 4 | ||||
-rw-r--r-- | arch/sparc/net/bpf_jit_comp.c | 2 |
3 files changed, 6 insertions, 5 deletions
diff --git a/arch/sparc/net/bpf_jit.h b/arch/sparc/net/bpf_jit.h index 74f048be739c..05175be442fb 100644 --- a/arch/sparc/net/bpf_jit.h +++ b/arch/sparc/net/bpf_jit.h | |||
@@ -4,13 +4,14 @@ | |||
4 | /* Conventions: | 4 | /* Conventions: |
5 | * %g1 : temporary | 5 | * %g1 : temporary |
6 | * %g2 : Secondary temporary used by SKB data helper stubs. | 6 | * %g2 : Secondary temporary used by SKB data helper stubs. |
7 | * %g3 : packet offset passed into SKB data helper stubs. | ||
7 | * %o0 : pointer to skb (first argument given to JIT function) | 8 | * %o0 : pointer to skb (first argument given to JIT function) |
8 | * %o1 : BPF A accumulator | 9 | * %o1 : BPF A accumulator |
9 | * %o2 : BPF X accumulator | 10 | * %o2 : BPF X accumulator |
10 | * %o3 : Holds saved %o7 so we can call helper functions without needing | 11 | * %o3 : Holds saved %o7 so we can call helper functions without needing |
11 | * to allocate a register window. | 12 | * to allocate a register window. |
12 | * %o4 : skb->data | 13 | * %o4 : skb->len - skb->data_len |
13 | * %o5 : skb->len - skb->data_len | 14 | * %o5 : skb->data |
14 | */ | 15 | */ |
15 | 16 | ||
16 | #ifndef __ASSEMBLER__ | 17 | #ifndef __ASSEMBLER__ |
diff --git a/arch/sparc/net/bpf_jit_asm.S b/arch/sparc/net/bpf_jit_asm.S index fdc69324aabc..46d8f59f14c5 100644 --- a/arch/sparc/net/bpf_jit_asm.S +++ b/arch/sparc/net/bpf_jit_asm.S | |||
@@ -30,7 +30,7 @@ bpf_jit_load_word_positive_offset: | |||
30 | bne load_word_unaligned | 30 | bne load_word_unaligned |
31 | nop | 31 | nop |
32 | retl | 32 | retl |
33 | ld [r_SKB_DATA + r_OFF], r_A | 33 | ld [r_TMP], r_A |
34 | load_word_unaligned: | 34 | load_word_unaligned: |
35 | ldub [r_TMP + 0x0], r_OFF | 35 | ldub [r_TMP + 0x0], r_OFF |
36 | ldub [r_TMP + 0x1], r_TMP2 | 36 | ldub [r_TMP + 0x1], r_TMP2 |
@@ -59,7 +59,7 @@ bpf_jit_load_half_positive_offset: | |||
59 | bne load_half_unaligned | 59 | bne load_half_unaligned |
60 | nop | 60 | nop |
61 | retl | 61 | retl |
62 | lduh [r_SKB_DATA + r_OFF], r_A | 62 | lduh [r_TMP], r_A |
63 | load_half_unaligned: | 63 | load_half_unaligned: |
64 | ldub [r_TMP + 0x0], r_OFF | 64 | ldub [r_TMP + 0x0], r_OFF |
65 | ldub [r_TMP + 0x1], r_TMP2 | 65 | ldub [r_TMP + 0x1], r_TMP2 |
diff --git a/arch/sparc/net/bpf_jit_comp.c b/arch/sparc/net/bpf_jit_comp.c index 86349cab60c5..ebc89809f585 100644 --- a/arch/sparc/net/bpf_jit_comp.c +++ b/arch/sparc/net/bpf_jit_comp.c | |||
@@ -378,7 +378,7 @@ void bpf_jit_compile(struct sk_filter *fp) | |||
378 | emit_clear(r_X); | 378 | emit_clear(r_X); |
379 | 379 | ||
380 | /* If this filter needs to access skb data, | 380 | /* If this filter needs to access skb data, |
381 | * load %o4 and %o4 with: | 381 | * load %o4 and %o5 with: |
382 | * %o4 = skb->len - skb->data_len | 382 | * %o4 = skb->len - skb->data_len |
383 | * %o5 = skb->data | 383 | * %o5 = skb->data |
384 | * And also back up %o7 into r_saved_O7 so we can | 384 | * And also back up %o7 into r_saved_O7 so we can |