@samitouri / QOSamiQemu / commits / a4e9f271d8

target/arm: make whpx use syndrome helpers for decode

Rather than open coding a bunch of shifts and masks we can use the syndrome definitions. While we are at it assert it really is a EC_DATAABORT. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 20260422125250.1303100-19-alex.bennee@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Alex Bennée committed Apr 22, 2026 at 13:52 UTC a4e9f271d87320d9321f9536f02a8f36e48ac2df
1 file changed +7 -6
target/arm/whpx/whpx-all.c
+7 -6
@@ -356,15 +356,16 @@ static int whpx_handle_mmio(CPUState *cpu, WHV_MEMORY_ACCESS_CONTEXT *ctx)
356 {
357 uint64_t syndrome = ctx->Syndrome;
358
359 - bool isv = syndrome & ARM_EL_ISV;
360 - bool iswrite = (syndrome >> 6) & 1;
361 - bool sse = (syndrome >> 21) & 1;
362 - uint32_t sas = (syndrome >> 22) & 3;
359 + bool isv = FIELD_EX32(syndrome, DABORT_ISS, ISV);
360 + bool iswrite = FIELD_EX32(syndrome, DABORT_ISS, WNR);
361 + bool sse = FIELD_EX32(syndrome, DABORT_ISS, SSE);
362 + uint32_t sas = FIELD_EX32(syndrome, DABORT_ISS, SAS);
363 uint32_t len = 1 << sas;
364 - uint32_t srt = (syndrome >> 16) & 0x1f;
365 - uint32_t cm = (syndrome >> 8) & 0x1;
364 + uint32_t srt = FIELD_EX32(syndrome, DABORT_ISS, SRT);
365 + uint32_t cm = FIELD_EX32(syndrome, DABORT_ISS, CM);
366 uint64_t val = 0;
367
368 + assert(syn_get_ec(syndrome) == EC_DATAABORT);
369 assert(!cm);
370 assert(isv);
371