From 74433bf083b0766aba81534f92de13194f23ff3e Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Fri, 22 Mar 2019 11:51:19 -0700 Subject: tcg: Split out target/arch/cpu-param.h For all targets, into this new file move TARGET_LONG_BITS, TARGET_PAGE_BITS, TARGET_PHYS_ADDR_SPACE_BITS, TARGET_VIRT_ADDR_SPACE_BITS, and NB_MMU_MODES. Include this new file from exec/cpu-defs.h. This now removes the somewhat odd requirement that target/arch/cpu.h defines TARGET_LONG_BITS before including exec/cpu-defs.h, so push the bulk of the includes within target/arch/cpu.h to the top. Reviewed-by: Peter Maydell Acked-by: Alistair Francis Signed-off-by: Richard Henderson --- target/mips/cpu.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'target/mips/cpu.h') diff --git a/target/mips/cpu.h b/target/mips/cpu.h index 06a8ed4..34e7aec 100644 --- a/target/mips/cpu.h +++ b/target/mips/cpu.h @@ -7,9 +7,9 @@ #include "qemu-common.h" #include "cpu-qom.h" -#include "mips-defs.h" #include "exec/cpu-defs.h" #include "fpu/softfloat.h" +#include "mips-defs.h" #define TCG_GUEST_DEFAULT_MO (0) @@ -103,7 +103,6 @@ struct CPUMIPSFPUContext { #define FP_UNIMPLEMENTED 32 }; -#define NB_MMU_MODES 4 #define TARGET_INSN_START_EXTRA_WORDS 2 typedef struct CPUMIPSMVPContext CPUMIPSMVPContext; -- cgit v1.1 From 4f7c64b3819d559417615ed2b1d028ebc1a49580 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Fri, 22 Mar 2019 15:32:23 -0700 Subject: cpu: Define CPUArchState with typedef For all targets, do this just before including exec/cpu-all.h. Reviewed-by: Peter Maydell Acked-by: Alistair Francis Signed-off-by: Richard Henderson --- target/mips/cpu.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'target/mips/cpu.h') diff --git a/target/mips/cpu.h b/target/mips/cpu.h index 34e7aec..6f65822 100644 --- a/target/mips/cpu.h +++ b/target/mips/cpu.h @@ -3,8 +3,6 @@ #define ALIGNED_ONLY -#define CPUArchState struct CPUMIPSState - #include "qemu-common.h" #include "cpu-qom.h" #include "exec/cpu-defs.h" @@ -13,8 +11,6 @@ #define TCG_GUEST_DEFAULT_MO (0) -struct CPUMIPSState; - typedef struct CPUMIPSTLBContext CPUMIPSTLBContext; /* MSA Context */ @@ -1116,6 +1112,8 @@ static inline int cpu_mmu_index(CPUMIPSState *env, bool ifetch) return hflags_mmu_index(env->hflags); } +typedef CPUMIPSState CPUArchState; + #include "exec/cpu-all.h" /* -- cgit v1.1 From 2161a612b4e1d388046320bc464adefd6bba01a0 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Fri, 22 Mar 2019 15:56:19 -0700 Subject: cpu: Define ArchCPU For all targets, do this just before including exec/cpu-all.h. Reviewed-by: Peter Maydell Acked-by: Alistair Francis Signed-off-by: Richard Henderson --- target/mips/cpu.h | 1 + 1 file changed, 1 insertion(+) (limited to 'target/mips/cpu.h') diff --git a/target/mips/cpu.h b/target/mips/cpu.h index 6f65822..12527ca 100644 --- a/target/mips/cpu.h +++ b/target/mips/cpu.h @@ -1113,6 +1113,7 @@ static inline int cpu_mmu_index(CPUMIPSState *env, bool ifetch) } typedef CPUMIPSState CPUArchState; +typedef MIPSCPU ArchCPU; #include "exec/cpu-all.h" -- cgit v1.1 From 29a0af618ddd21f55df5753c3e16b0625f534b3c Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Fri, 22 Mar 2019 16:07:18 -0700 Subject: cpu: Replace ENV_GET_CPU with env_cpu Now that we have both ArchCPU and CPUArchState, we can define this generically instead of via macro in each target's cpu.h. Reviewed-by: Peter Maydell Acked-by: Alistair Francis Signed-off-by: Richard Henderson --- target/mips/cpu.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'target/mips/cpu.h') diff --git a/target/mips/cpu.h b/target/mips/cpu.h index 12527ca..e684572 100644 --- a/target/mips/cpu.h +++ b/target/mips/cpu.h @@ -1076,8 +1076,6 @@ static inline MIPSCPU *mips_env_get_cpu(CPUMIPSState *env) return container_of(env, MIPSCPU, env); } -#define ENV_GET_CPU(e) CPU(mips_env_get_cpu(e)) - #define ENV_OFFSET offsetof(MIPSCPU, env) void mips_cpu_list(void); -- cgit v1.1 From 5a7330b35cabc9e2fd3a8577b7004b63af8c57f3 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Fri, 22 Mar 2019 18:38:42 -0700 Subject: target/mips: Use env_cpu, env_archcpu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cleanup in the boilerplate that each target must define. Replace mips_env_get_cpu with env_archcpu. The combination CPU(mips_env_get_cpu) should have used ENV_GET_CPU to begin; use env_cpu now. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/mips/cpu.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'target/mips/cpu.h') diff --git a/target/mips/cpu.h b/target/mips/cpu.h index e684572..cb09425 100644 --- a/target/mips/cpu.h +++ b/target/mips/cpu.h @@ -1071,11 +1071,6 @@ struct MIPSCPU { CPUMIPSState env; }; -static inline MIPSCPU *mips_env_get_cpu(CPUMIPSState *env) -{ - return container_of(env, MIPSCPU, env); -} - #define ENV_OFFSET offsetof(MIPSCPU, env) void mips_cpu_list(void); -- cgit v1.1 From 677c4d69ac21961e76a386f9bfc892a44923acc0 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Fri, 22 Mar 2019 17:00:56 -0700 Subject: cpu: Move ENV_OFFSET to exec/gen-icount.h Now that we have ArchCPU, we can define this generically, in the one place that needs it. Reviewed-by: Alistair Francis Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/mips/cpu.h | 1 - 1 file changed, 1 deletion(-) (limited to 'target/mips/cpu.h') diff --git a/target/mips/cpu.h b/target/mips/cpu.h index cb09425..24fe25f 100644 --- a/target/mips/cpu.h +++ b/target/mips/cpu.h @@ -1071,7 +1071,6 @@ struct MIPSCPU { CPUMIPSState env; }; -#define ENV_OFFSET offsetof(MIPSCPU, env) void mips_cpu_list(void); -- cgit v1.1 From 5b146dc716cfd247f99556c04e6e46fbd67565a0 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Fri, 22 Mar 2019 17:16:06 -0700 Subject: cpu: Introduce CPUNegativeOffsetState Nothing in there so far, but all of the plumbing done within the target ArchCPU state. Reviewed-by: Alistair Francis Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/mips/cpu.h | 1 + 1 file changed, 1 insertion(+) (limited to 'target/mips/cpu.h') diff --git a/target/mips/cpu.h b/target/mips/cpu.h index 24fe25f..62af249 100644 --- a/target/mips/cpu.h +++ b/target/mips/cpu.h @@ -1068,6 +1068,7 @@ struct MIPSCPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUMIPSState env; }; -- cgit v1.1 From e8b5fae5161c48e0d0e8b35eaf9dd8f35d692088 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sat, 23 Mar 2019 11:35:53 -0700 Subject: cpu: Remove CPU_COMMON This macro is now always empty, so remove it. This leaves the entire contents of CPUArchState under the control of the guest architecture. Reviewed-by: Alistair Francis Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/mips/cpu.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'target/mips/cpu.h') diff --git a/target/mips/cpu.h b/target/mips/cpu.h index 62af249..bbf1aa8 100644 --- a/target/mips/cpu.h +++ b/target/mips/cpu.h @@ -1041,8 +1041,6 @@ struct CPUMIPSState { /* Fields up to this point are cleared by a CPU reset */ struct {} end_reset_fields; - CPU_COMMON - /* Fields from here on are preserved across CPU reset. */ CPUMIPSMVPContext *mvp; #if !defined(CONFIG_USER_ONLY) -- cgit v1.1