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>
This commit is contained in:
parent
b3d7b2f2f0
commit
7b56f76edf
|
@ -4,13 +4,14 @@
|
||||||
/* Conventions:
|
/* Conventions:
|
||||||
* %g1 : temporary
|
* %g1 : temporary
|
||||||
* %g2 : Secondary temporary used by SKB data helper stubs.
|
* %g2 : Secondary temporary used by SKB data helper stubs.
|
||||||
|
* %g3 : packet offset passed into SKB data helper stubs.
|
||||||
* %o0 : pointer to skb (first argument given to JIT function)
|
* %o0 : pointer to skb (first argument given to JIT function)
|
||||||
* %o1 : BPF A accumulator
|
* %o1 : BPF A accumulator
|
||||||
* %o2 : BPF X accumulator
|
* %o2 : BPF X accumulator
|
||||||
* %o3 : Holds saved %o7 so we can call helper functions without needing
|
* %o3 : Holds saved %o7 so we can call helper functions without needing
|
||||||
* to allocate a register window.
|
* to allocate a register window.
|
||||||
* %o4 : skb->data
|
* %o4 : skb->len - skb->data_len
|
||||||
* %o5 : skb->len - skb->data_len
|
* %o5 : skb->data
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __ASSEMBLER__
|
#ifndef __ASSEMBLER__
|
||||||
|
|
|
@ -30,7 +30,7 @@ bpf_jit_load_word_positive_offset:
|
||||||
bne load_word_unaligned
|
bne load_word_unaligned
|
||||||
nop
|
nop
|
||||||
retl
|
retl
|
||||||
ld [r_SKB_DATA + r_OFF], r_A
|
ld [r_TMP], r_A
|
||||||
load_word_unaligned:
|
load_word_unaligned:
|
||||||
ldub [r_TMP + 0x0], r_OFF
|
ldub [r_TMP + 0x0], r_OFF
|
||||||
ldub [r_TMP + 0x1], r_TMP2
|
ldub [r_TMP + 0x1], r_TMP2
|
||||||
|
@ -59,7 +59,7 @@ bpf_jit_load_half_positive_offset:
|
||||||
bne load_half_unaligned
|
bne load_half_unaligned
|
||||||
nop
|
nop
|
||||||
retl
|
retl
|
||||||
lduh [r_SKB_DATA + r_OFF], r_A
|
lduh [r_TMP], r_A
|
||||||
load_half_unaligned:
|
load_half_unaligned:
|
||||||
ldub [r_TMP + 0x0], r_OFF
|
ldub [r_TMP + 0x0], r_OFF
|
||||||
ldub [r_TMP + 0x1], r_TMP2
|
ldub [r_TMP + 0x1], r_TMP2
|
||||||
|
|
|
@ -378,7 +378,7 @@ void bpf_jit_compile(struct sk_filter *fp)
|
||||||
emit_clear(r_X);
|
emit_clear(r_X);
|
||||||
|
|
||||||
/* If this filter needs to access skb data,
|
/* If this filter needs to access skb data,
|
||||||
* load %o4 and %o4 with:
|
* load %o4 and %o5 with:
|
||||||
* %o4 = skb->len - skb->data_len
|
* %o4 = skb->len - skb->data_len
|
||||||
* %o5 = skb->data
|
* %o5 = skb->data
|
||||||
* And also back up %o7 into r_saved_O7 so we can
|
* And also back up %o7 into r_saved_O7 so we can
|
||||||
|
|
Loading…
Reference in New Issue