[19/27] sim: bpf: invert sim_cpu storage

Message ID 20221101151158.24916-20-vapier@gentoo.org
State Committed
Headers
Series sim: sim_cpu: invert sim_cpu storage |

Commit Message

Mike Frysinger Nov. 1, 2022, 3:11 p.m. UTC
  The cpu.h change is in generated cgen code, but that has been sent
upstream too, so the next regen should include it automatically.
---
 sim/bpf/cpu.h      | 2 +-
 sim/bpf/sim-main.h | 9 ++++-----
 2 files changed, 5 insertions(+), 6 deletions(-)
  

Patch

diff --git a/sim/bpf/cpu.h b/sim/bpf/cpu.h
index 5dd42de6a756..fb5344e0b767 100644
--- a/sim/bpf/cpu.h
+++ b/sim/bpf/cpu.h
@@ -54,7 +54,7 @@  do { \
 CPU (h_pc) = (x);\
 ;} while (0)
   } hardware;
-#define CPU_CGEN_HW(cpu) (& (cpu)->cpu_data.hardware)
+#define CPU_CGEN_HW(cpu) (& BPF_SIM_CPU (cpu)->cpu_data.hardware)
 } BPFBF_CPU_DATA;
 
 /* Cover fns for register access.  */
diff --git a/sim/bpf/sim-main.h b/sim/bpf/sim-main.h
index 80538840886e..bb6037737f98 100644
--- a/sim/bpf/sim-main.h
+++ b/sim/bpf/sim-main.h
@@ -19,6 +19,8 @@ 
 #ifndef SIM_MAIN_H
 #define SIM_MAIN_H
 
+#define SIM_HAVE_COMMON_SIM_CPU
+
 #include "sim-basics.h"
 #include "cgen-types.h"
 #include "bpf-desc.h"
@@ -29,15 +31,12 @@ 
 #include "bpf-sim.h"
 #include "bpf-helpers.h"
 
-
-struct _sim_cpu
+struct bpf_sim_cpu
 {
-  sim_cpu_base base;
-  CGEN_CPU cgen_cpu;
-
 #if defined (WANT_CPU_BPFBF)
   BPFBF_CPU_DATA cpu_data;
 #endif
 };
+#define BPF_SIM_CPU(cpu) ((struct bpf_sim_cpu *) CPU_ARCH_DATA (cpu))
 
 #endif /* ! SIM_MAIN_H */