123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285 |
-
- .set noreorder
- \
- slti t0, offset, 0
- bgtz t0, bpf_slow_path_##TYPE##_neg; \
-
- \
- addiu $r_s0, $r_skb_hl, -SIZE
- slt t0, $r_s0, offset
- bgtz t0, bpf_slow_path_##TYPE; \
- LEAF(sk_load_word)
- is_offset_negative(word)
- FEXPORT(sk_load_word_positive)
- is_offset_in_header(4, word)
-
- PTR_ADDU t1, $r_skb_data, offset
- .set reorder
- lw $r_A, 0(t1)
- .set noreorder
- wsbh t0, $r_A
- rotr $r_A, t0, 16
- sll t0, $r_A, 24
- srl t1, $r_A, 24
- srl t2, $r_A, 8
- or t0, t0, t1
- andi t2, t2, 0xff00
- andi t1, $r_A, 0xff00
- or t0, t0, t2
- sll t1, t1, 8
- or $r_A, t0, t1
- jr $r_ra
- move $r_ret, zero
- END(sk_load_word)
- LEAF(sk_load_half)
- is_offset_negative(half)
- FEXPORT(sk_load_half_positive)
- is_offset_in_header(2, half)
-
- PTR_ADDU t1, $r_skb_data, offset
- lhu $r_A, 0(t1)
- wsbh $r_A, $r_A
- sll t0, $r_A, 8
- srl t1, $r_A, 8
- andi t0, t0, 0xff00
- or $r_A, t0, t1
- jr $r_ra
- move $r_ret, zero
- END(sk_load_half)
- LEAF(sk_load_byte)
- is_offset_negative(byte)
- FEXPORT(sk_load_byte_positive)
- is_offset_in_header(1, byte)
-
- PTR_ADDU t1, $r_skb_data, offset
- lbu $r_A, 0(t1)
- jr $r_ra
- move $r_ret, zero
- END(sk_load_byte)
- \
- LONG_ADDIU $r_s1, $r_skb_len, -SIZE
- sltu $r_s0, offset, $r_s1
- beqz $r_s0, fault
- \
- LONG_ADDIU a3, zero, SIZE
- PTR_ADDIU $r_sp, $r_sp, -(6 * SZREG)
- PTR_LA t0, skb_copy_bits
- PTR_S $r_ra, (5 * SZREG)($r_sp)
- \
- PTR_ADDIU a2, $r_sp, DS_OFFSET(SIZE)
- jalr t0
- \
- INT_S zero, (4 * SZREG)($r_sp)
-
- \
- \
- PTR_L $r_ra, (5 * SZREG)($r_sp)
- INT_L $r_s0, (4 * SZREG)($r_sp)
- bltz v0, fault
- PTR_ADDIU $r_sp, $r_sp, 6 * SZREG
- move $r_ret, zero
- NESTED(bpf_slow_path_word, (6 * SZREG), $r_sp)
- bpf_slow_path_common(4)
- wsbh t0, $r_s0
- jr $r_ra
- rotr $r_A, t0, 16
- sll t0, $r_s0, 24
- srl t1, $r_s0, 24
- srl t2, $r_s0, 8
- or t0, t0, t1
- andi t2, t2, 0xff00
- andi t1, $r_s0, 0xff00
- or t0, t0, t2
- sll t1, t1, 8
- jr $r_ra
- or $r_A, t0, t1
- jr $r_ra
- move $r_A, $r_s0
- END(bpf_slow_path_word)
- NESTED(bpf_slow_path_half, (6 * SZREG), $r_sp)
- bpf_slow_path_common(2)
- jr $r_ra
- wsbh $r_A, $r_s0
- sll t0, $r_s0, 8
- andi t1, $r_s0, 0xff00
- andi t0, t0, 0xff00
- srl t1, t1, 8
- jr $r_ra
- or $r_A, t0, t1
- jr $r_ra
- move $r_A, $r_s0
- END(bpf_slow_path_half)
- NESTED(bpf_slow_path_byte, (6 * SZREG), $r_sp)
- bpf_slow_path_common(1)
- jr $r_ra
- move $r_A, $r_s0
- END(bpf_slow_path_byte)
- .macro bpf_is_end_of_data
- li t0, SKF_LL_OFF
-
- slt t1, offset, t0
- bgtz t1, fault
-
- .endm
- PTR_ADDIU $r_sp, $r_sp, -(6 * SZREG)
- PTR_LA t0, bpf_internal_load_pointer_neg_helper; \
- PTR_S $r_ra, (5 * SZREG)($r_sp)
- jalr t0
- li a2, SIZE
- PTR_L $r_ra, (5 * SZREG)($r_sp)
- \
- beqz v0, fault
- PTR_ADDIU $r_sp, $r_sp, 6 * SZREG
- \
- move $r_s0, v0
- \
- move $r_ret, zero
- bpf_slow_path_word_neg:
- bpf_is_end_of_data
- NESTED(sk_load_word_negative, (6 * SZREG), $r_sp)
- bpf_negative_common(4)
- jr $r_ra
- lw $r_A, 0($r_s0)
- END(sk_load_word_negative)
- bpf_slow_path_half_neg:
- bpf_is_end_of_data
- NESTED(sk_load_half_negative, (6 * SZREG), $r_sp)
- bpf_negative_common(2)
- jr $r_ra
- lhu $r_A, 0($r_s0)
- END(sk_load_half_negative)
- bpf_slow_path_byte_neg:
- bpf_is_end_of_data
- NESTED(sk_load_byte_negative, (6 * SZREG), $r_sp)
- bpf_negative_common(1)
- jr $r_ra
- lbu $r_A, 0($r_s0)
- END(sk_load_byte_negative)
- fault:
- jr $r_ra
- addiu $r_ret, zero, 1
|