提交 0c5d1878 编写于 作者: R Ralf Baechle

MIPS: BPF: Fix load delay slots.

The entire bpf_jit_asm.S is written in noreorder mode because "we know
better" according to a comment.  This also prevented the assembler from
throwing in the required NOPs for MIPS I processors which have no
load-use interlock, thus the load's consumer might end up using the
old value of the register from prior to the load.

Fixed by putting the assembler in reorder mode for just the affected
load instructions.  This is not enough for gas to actually try to be
clever by looking at the next instruction and inserting a nop only
when needed but as the comment said "we know better", so getting gas
to unconditionally emit a NOP is just right in this case and prevents
adding further ifdefery.
Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
上级 1e16a8f1
...@@ -61,7 +61,9 @@ FEXPORT(sk_load_word_positive) ...@@ -61,7 +61,9 @@ FEXPORT(sk_load_word_positive)
is_offset_in_header(4, word) is_offset_in_header(4, word)
/* Offset within header boundaries */ /* Offset within header boundaries */
PTR_ADDU t1, $r_skb_data, offset PTR_ADDU t1, $r_skb_data, offset
.set reorder
lw $r_A, 0(t1) lw $r_A, 0(t1)
.set noreorder
#ifdef CONFIG_CPU_LITTLE_ENDIAN #ifdef CONFIG_CPU_LITTLE_ENDIAN
# if defined(__mips_isa_rev) && (__mips_isa_rev >= 2) # if defined(__mips_isa_rev) && (__mips_isa_rev >= 2)
wsbh t0, $r_A wsbh t0, $r_A
...@@ -88,7 +90,9 @@ FEXPORT(sk_load_half_positive) ...@@ -88,7 +90,9 @@ FEXPORT(sk_load_half_positive)
is_offset_in_header(2, half) is_offset_in_header(2, half)
/* Offset within header boundaries */ /* Offset within header boundaries */
PTR_ADDU t1, $r_skb_data, offset PTR_ADDU t1, $r_skb_data, offset
.set reorder
lh $r_A, 0(t1) lh $r_A, 0(t1)
.set noreorder
#ifdef CONFIG_CPU_LITTLE_ENDIAN #ifdef CONFIG_CPU_LITTLE_ENDIAN
# if defined(__mips_isa_rev) && (__mips_isa_rev >= 2) # if defined(__mips_isa_rev) && (__mips_isa_rev >= 2)
wsbh t0, $r_A wsbh t0, $r_A
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册