diff options
Diffstat (limited to 'arch/arm/net/bpf_jit_32.c')
-rw-r--r-- | arch/arm/net/bpf_jit_32.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c index a34f1e214116..6828ef6ce80e 100644 --- a/arch/arm/net/bpf_jit_32.c +++ b/arch/arm/net/bpf_jit_32.c | |||
@@ -341,10 +341,17 @@ static void emit_load_be16(u8 cond, u8 r_res, u8 r_addr, struct jit_ctx *ctx) | |||
341 | 341 | ||
342 | static inline void emit_swap16(u8 r_dst, u8 r_src, struct jit_ctx *ctx) | 342 | static inline void emit_swap16(u8 r_dst, u8 r_src, struct jit_ctx *ctx) |
343 | { | 343 | { |
344 | emit(ARM_LSL_R(ARM_R1, r_src, 8), ctx); | 344 | /* r_dst = (r_src << 8) | (r_src >> 8) */ |
345 | emit(ARM_ORR_S(r_dst, ARM_R1, r_src, SRTYPE_LSL, 8), ctx); | 345 | emit(ARM_LSL_I(ARM_R1, r_src, 8), ctx); |
346 | emit(ARM_LSL_I(r_dst, r_dst, 8), ctx); | 346 | emit(ARM_ORR_S(r_dst, ARM_R1, r_src, SRTYPE_LSR, 8), ctx); |
347 | emit(ARM_LSL_R(r_dst, r_dst, 8), ctx); | 347 | |
348 | /* | ||
349 | * we need to mask out the bits set in r_dst[23:16] due to | ||
350 | * the first shift instruction. | ||
351 | * | ||
352 | * note that 0x8ff is the encoded immediate 0x00ff0000. | ||
353 | */ | ||
354 | emit(ARM_BIC_I(r_dst, r_dst, 0x8ff), ctx); | ||
348 | } | 355 | } |
349 | 356 | ||
350 | #else /* ARMv6+ */ | 357 | #else /* ARMv6+ */ |