aboutsummaryrefslogtreecommitdiff
path: root/sim/bpf/mloop.in
diff options
context:
space:
mode:
Diffstat (limited to 'sim/bpf/mloop.in')
-rw-r--r--sim/bpf/mloop.in7
1 files changed, 5 insertions, 2 deletions
diff --git a/sim/bpf/mloop.in b/sim/bpf/mloop.in
index 91f0c44..75a869b 100644
--- a/sim/bpf/mloop.in
+++ b/sim/bpf/mloop.in
@@ -123,14 +123,17 @@ cat <<EOF
if (CURRENT_TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
{
+ UHI off16;
+ USI imm32;
+
/* eBPF instructions are little-endian, but GETIMEMUDI reads according
to target byte order. Swap to little-endian. */
insn = SWAP_8 (insn);
/* But, the imm32 and offset16 fields within instructions follow target
byte order. Swap those fields back. */
- UHI off16 = (UHI) ((insn & 0x00000000ffff0000) >> 16);
- USI imm32 = (USI) ((insn & 0xffffffff00000000) >> 32);
+ off16 = (UHI) ((insn & 0x00000000ffff0000) >> 16);
+ imm32 = (USI) ((insn & 0xffffffff00000000) >> 32);
off16 = SWAP_2 (off16);
imm32 = SWAP_4 (imm32);