aboutsummaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
Diffstat (limited to 'sim')
-rw-r--r--sim/bpf/ChangeLog5
-rw-r--r--sim/bpf/bpf-helpers.c3
-rw-r--r--sim/bpf/mloop.in7
3 files changed, 12 insertions, 3 deletions
diff --git a/sim/bpf/ChangeLog b/sim/bpf/ChangeLog
index 7ac0466..7c48d28 100644
--- a/sim/bpf/ChangeLog
+++ b/sim/bpf/ChangeLog
@@ -1,3 +1,8 @@
+2021-06-27 Mike Frysinger <vapier@gentoo.org>
+
+ * bpf-helpers.c (bpf_trace_printk): Move value decl to top of scope.
+ * mloop.in: Move off16 & imm32 decls to top of scope.
+
2021-06-22 Mike Frysinger <vapier@gentoo.org>
* configure: Regenerate.
diff --git a/sim/bpf/bpf-helpers.c b/sim/bpf/bpf-helpers.c
index c308812..79a3a7d 100644
--- a/sim/bpf/bpf-helpers.c
+++ b/sim/bpf/bpf-helpers.c
@@ -72,6 +72,7 @@ bpf_trace_printk (SIM_CPU *current_cpu)
supported, which are read from %r3, %r4 and %r5 respectively. */
for (i = 0, tags_processed = 0; i < size;)
{
+ UDI value;
QI c = GETMEMUQI (current_cpu, CPU_PC_GET (current_cpu),
fmt_address + i);
@@ -88,7 +89,7 @@ bpf_trace_printk (SIM_CPU *current_cpu)
if (i++ >= size)
return -1; /* XXX look for kernel error code. */
- UDI value = GET_H_GPR (3 + tags_processed);
+ value = GET_H_GPR (3 + tags_processed);
switch ((GETMEMUQI (current_cpu, CPU_PC_GET (current_cpu),
fmt_address + i)))
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);