sim: bpf: use CURRENT_TARGET_BYTE_ORDER
authorMike Frysinger <vapier@gentoo.org>
Sun, 6 Jun 2021 02:48:23 +0000 (22:48 -0400)
committerMike Frysinger <vapier@gentoo.org>
Wed, 9 Jun 2021 22:23:48 +0000 (18:23 -0400)
Code should be going through this macro rather than accessing the
underlying value directly.

sim/bpf/ChangeLog
sim/bpf/bpf.c
sim/bpf/mloop.in

index 42143db129d8ecfcaae695b4c1d7b051fc1417c7..f3deab5feeb164587ee8cb35eaca076c57d6f242 100644 (file)
@@ -1,3 +1,10 @@
+2021-06-09  Mike Frysinger  <vapier@gentoo.org>
+
+       * bpf.c (bpf_engine_run_full): Change current_target_byte_order to
+       CURRENT_TARGET_BYTE_ORDER.
+       (bpf_engine_run_fast): Likewise.
+       * mloop.in: Likewise.
+
 2021-06-09  Mike Frysinger  <vapier@gentoo.org>
 
        * sim-if.c (sim_open): Delete cgen_init call.
index c626781adbf8d238f09a8f1ed44732bbbae6f381..f9cdb824d1a9b9a78d81d4aaed8946dd8770aafe 100644 (file)
@@ -222,7 +222,7 @@ bpfbf_prepare_run (SIM_CPU *cpu)
 void
 bpf_engine_run_full (SIM_CPU *cpu)
 {
-  if (current_target_byte_order == BFD_ENDIAN_LITTLE)
+  if (CURRENT_TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE)
     {
       if (!bpf_idesc_le)
         {
@@ -253,7 +253,7 @@ bpf_engine_run_full (SIM_CPU *cpu)
 void
 bpf_engine_run_fast (SIM_CPU *cpu)
 {
-  if (current_target_byte_order == BFD_ENDIAN_LITTLE)
+  if (CURRENT_TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE)
     {
       if (!bpf_idesc_le)
         {
index e666835ed1b867a4a8dcd39b0c21c20352dea981..91f0c445eed059b5cc6ed9b40eb570cbf1e940bc 100644 (file)
@@ -121,7 +121,7 @@ cat <<EOF
 
   UDI insn = GETIMEMUDI (current_cpu, vpc);
 
-  if (current_target_byte_order == BFD_ENDIAN_BIG)
+  if (CURRENT_TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
     {
       /* eBPF instructions are little-endian, but GETIMEMUDI reads according
          to target byte order. Swap to little-endian. */