qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 03/10] target/ppc: Move common check in exception handlers to


From: BALATON Zoltan
Subject: Re: [PATCH 03/10] target/ppc: Move common check in exception handlers to a function
Date: Mon, 12 Jun 2023 12:07:59 +0200 (CEST)

On Mon, 12 Jun 2023, Philippe Mathieu-Daudé wrote:
On 12/6/23 00:42, BALATON Zoltan wrote:
All powerpc exception handlers share some code when handling machine
check exceptions. Move this to a common function.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
  target/ppc/excp_helper.c | 112 ++++++++-------------------------------
  1 file changed, 23 insertions(+), 89 deletions(-)

diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
index 3783315fdb..e4532f5088 100644
--- a/target/ppc/excp_helper.c
+++ b/target/ppc/excp_helper.c
@@ -403,6 +403,23 @@ static void powerpc_set_excp_state(PowerPCCPU *cpu, target_ulong vector,
      env->reserve_addr = -1;
  }
  +static void powerpc_checkstop_state(CPUPPCState *env)
+{
+    if (!FIELD_EX64(env->msr, MSR, ME)) {

Preferably inverting this if() and returning early:

Good idea, will wait for some more review in case any other changes are needed before sending a v2 for this.

Regards,
BALATON Zoltan

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

+        CPUState *cs = env_cpu(env);
+
+ /* Machine check exception is not enabled. Enter checkstop state. */
+        fprintf(stderr, "Machine check while not allowed. "
+                "Entering checkstop state\n");
+        if (qemu_log_separate()) {
+            qemu_log("Machine check while not allowed. "
+                     "Entering checkstop state\n");
+        }
+        cs->halted = 1;
+        cpu_interrupt_exittb(cs);
+    }
+}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]