From 9e895e9032993485dbb9bc5740607dfe5eb5e124 Mon Sep 17 00:00:00 2001 From: vhaudiquet Date: Wed, 11 Oct 2023 17:35:32 +0200 Subject: [PATCH] Change WFI behavior : halt simulation --- src/cpu/rv32cpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cpu/rv32cpu.c b/src/cpu/rv32cpu.c index cc09dc8..f21a62c 100644 --- a/src/cpu/rv32cpu.c +++ b/src/cpu/rv32cpu.c @@ -525,7 +525,8 @@ static void cpu_execute(rv32_cpu_t* cpu, instruction_t* instruction) fprintf(stderr, "SFENCE.VMA: Guest kernel must think we have an MMU. We have none.\n"); break; case FUNC7_WFI: - fprintf(stderr, "WFI: Guest kernel must think we have interrupts. We have none.\n"); + fprintf(stderr, "WFI: Guest kernel must think we have interrupts. We have none. Halting simulation.\n"); + cpu->sim_ticks_left = 1; break; default: fprintf(stderr, "FATAL: Unknown IMM for ECALL/EBREAK instruction while executing (IMM=0x%x)\n", instruction->immediate);