[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 37/42] target/ppc: powerpc_excp: Move common code to the caller fu
From: |
Cédric Le Goater |
Subject: |
[PULL 37/42] target/ppc: powerpc_excp: Move common code to the caller function |
Date: |
Thu, 10 Feb 2022 14:00:03 +0100 |
From: Fabiano Rosas <farosas@linux.ibm.com>
Make the cpu-specific powerpc_excp_* functions a bit simpler by moving
the bounds check and logging to powerpc_excp.
Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Message-Id: <20220207183036.1507882-3-farosas@linux.ibm.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
target/ppc/excp_helper.c | 57 +++++++---------------------------------
1 file changed, 9 insertions(+), 48 deletions(-)
diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
index a393730c7bd0..acdeeb405992 100644
--- a/target/ppc/excp_helper.c
+++ b/target/ppc/excp_helper.c
@@ -396,14 +396,6 @@ static void powerpc_excp_40x(PowerPCCPU *cpu, int excp)
target_ulong msr, new_msr, vector;
int srr0, srr1;
- if (excp <= POWERPC_EXCP_NONE || excp >= POWERPC_EXCP_NB) {
- cpu_abort(cs, "Invalid PowerPC exception %d. Aborting\n", excp);
- }
-
- qemu_log_mask(CPU_LOG_INT, "Raise exception at " TARGET_FMT_lx
- " => %s (%d) error=%02x\n", env->nip,
powerpc_excp_name(excp),
- excp, env->error_code);
-
/* new srr1 value excluding must-be-zero bits */
msr = env->msr & ~0x783f0000ULL;
@@ -554,14 +546,6 @@ static void powerpc_excp_6xx(PowerPCCPU *cpu, int excp)
CPUPPCState *env = &cpu->env;
target_ulong msr, new_msr, vector;
- if (excp <= POWERPC_EXCP_NONE || excp >= POWERPC_EXCP_NB) {
- cpu_abort(cs, "Invalid PowerPC exception %d. Aborting\n", excp);
- }
-
- qemu_log_mask(CPU_LOG_INT, "Raise exception at " TARGET_FMT_lx
- " => %s (%d) error=%02x\n", env->nip,
powerpc_excp_name(excp),
- excp, env->error_code);
-
/* new srr1 value excluding must-be-zero bits */
msr = env->msr & ~0x783f0000ULL;
@@ -746,14 +730,6 @@ static void powerpc_excp_7xx(PowerPCCPU *cpu, int excp)
CPUPPCState *env = &cpu->env;
target_ulong msr, new_msr, vector;
- if (excp <= POWERPC_EXCP_NONE || excp >= POWERPC_EXCP_NB) {
- cpu_abort(cs, "Invalid PowerPC exception %d. Aborting\n", excp);
- }
-
- qemu_log_mask(CPU_LOG_INT, "Raise exception at " TARGET_FMT_lx
- " => %s (%d) error=%02x\n", env->nip,
powerpc_excp_name(excp),
- excp, env->error_code);
-
/* new srr1 value excluding must-be-zero bits */
msr = env->msr & ~0x783f0000ULL;
@@ -948,14 +924,6 @@ static void powerpc_excp_74xx(PowerPCCPU *cpu, int excp)
CPUPPCState *env = &cpu->env;
target_ulong msr, new_msr, vector;
- if (excp <= POWERPC_EXCP_NONE || excp >= POWERPC_EXCP_NB) {
- cpu_abort(cs, "Invalid PowerPC exception %d. Aborting\n", excp);
- }
-
- qemu_log_mask(CPU_LOG_INT, "Raise exception at " TARGET_FMT_lx
- " => %s (%d) error=%02x\n", env->nip,
powerpc_excp_name(excp),
- excp, env->error_code);
-
/* new srr1 value excluding must-be-zero bits */
msr = env->msr & ~0x783f0000ULL;
@@ -1143,14 +1111,6 @@ static void powerpc_excp_booke(PowerPCCPU *cpu, int excp)
target_ulong msr, new_msr, vector;
int srr0, srr1;
- if (excp <= POWERPC_EXCP_NONE || excp >= POWERPC_EXCP_NB) {
- cpu_abort(cs, "Invalid PowerPC exception %d. Aborting\n", excp);
- }
-
- qemu_log_mask(CPU_LOG_INT, "Raise exception at " TARGET_FMT_lx
- " => %s (%d) error=%02x\n", env->nip,
powerpc_excp_name(excp),
- excp, env->error_code);
-
msr = env->msr;
/*
@@ -1370,14 +1330,6 @@ static void powerpc_excp_books(PowerPCCPU *cpu, int excp)
target_ulong msr, new_msr, vector;
int srr0, srr1, lev = -1;
- if (excp <= POWERPC_EXCP_NONE || excp >= POWERPC_EXCP_NB) {
- cpu_abort(cs, "Invalid PowerPC exception %d. Aborting\n", excp);
- }
-
- qemu_log_mask(CPU_LOG_INT, "Raise exception at " TARGET_FMT_lx
- " => %s (%d) error=%02x\n", env->nip,
powerpc_excp_name(excp),
- excp, env->error_code);
-
/* new srr1 value excluding must-be-zero bits */
msr = env->msr & ~0x783f0000ULL;
@@ -1664,8 +1616,17 @@ static inline void powerpc_excp_books(PowerPCCPU *cpu,
int excp)
static void powerpc_excp(PowerPCCPU *cpu, int excp)
{
+ CPUState *cs = CPU(cpu);
CPUPPCState *env = &cpu->env;
+ if (excp <= POWERPC_EXCP_NONE || excp >= POWERPC_EXCP_NB) {
+ cpu_abort(cs, "Invalid PowerPC exception %d. Aborting\n", excp);
+ }
+
+ qemu_log_mask(CPU_LOG_INT, "Raise exception at " TARGET_FMT_lx
+ " => %s (%d) error=%02x\n", env->nip,
powerpc_excp_name(excp),
+ excp, env->error_code);
+
switch (env->excp_model) {
case POWERPC_EXCP_40x:
powerpc_excp_40x(cpu, excp);
--
2.34.1
- [PULL 22/42] target/ppc: 6xx: System Call exception cleanup, (continued)
- [PULL 22/42] target/ppc: 6xx: System Call exception cleanup, Cédric Le Goater, 2022/02/10
- [PULL 42/42] spapr/vof: Install rom and nvram binaries, Cédric Le Goater, 2022/02/10
- [PULL 33/42] target/ppc: 7xx: System Reset cleanup, Cédric Le Goater, 2022/02/10
- [PULL 28/42] target/ppc: Simplify powerpc_excp_7xx, Cédric Le Goater, 2022/02/10
- [PULL 02/42] target/ppc: Introduce powerpc_excp_booke, Cédric Le Goater, 2022/02/10
- [PULL 31/42] target/ppc: 7xx: Program exception cleanup, Cédric Le Goater, 2022/02/10
- [PULL 21/42] target/ppc: 6xx: Program exception cleanup, Cédric Le Goater, 2022/02/10
- [PULL 24/42] target/ppc: 6xx: Software TLB exceptions cleanup, Cédric Le Goater, 2022/02/10
- [PULL 25/42] target/ppc: 6xx: Set SRRs directly in exception code, Cédric Le Goater, 2022/02/10
- [PULL 36/42] target/ppc: Remove powerpc_excp_legacy, Cédric Le Goater, 2022/02/10
- [PULL 37/42] target/ppc: powerpc_excp: Move common code to the caller function,
Cédric Le Goater <=
- [PULL 23/42] target/ppc: 6xx: System Reset interrupt cleanup, Cédric Le Goater, 2022/02/10
- [PULL 08/42] target/ppc: booke: External interrupt cleanup, Cédric Le Goater, 2022/02/10
- [PULL 10/42] target/ppc: booke: System Call exception cleanup, Cédric Le Goater, 2022/02/10
- [PULL 13/42] target/ppc: Fix radix logging, Cédric Le Goater, 2022/02/10
- [PULL 35/42] target/ppc: 7xx: Set SRRs directly in exception code, Cédric Le Goater, 2022/02/10
- [PULL 29/42] target/ppc: 7xx: Machine Check exception cleanup, Cédric Le Goater, 2022/02/10
- [PULL 17/42] target/ppc: Simplify powerpc_excp_6xx, Cédric Le Goater, 2022/02/10
- [PULL 39/42] target/ppc: books: Remove excp_model argument from ppc_excp_apply_ail, Cédric Le Goater, 2022/02/10
- [PULL 40/42] target/ppc: Change VSX instructions behavior to fill with zeros, Cédric Le Goater, 2022/02/10
- [PULL 38/42] target/ppc: Assert if MSR bits differ from msr_mask during exceptions, Cédric Le Goater, 2022/02/10