On 8/19/25 6:24 AM, Peter Maydell wrote:
On Fri, 8 Aug 2025 at 07:55, Mohamed Mediouni <moha...@unpredictable.fr> wrote:

OpenProcessorKey and ReadRegU64 adapted from:
https://github.com/FEX-Emu/FEX/blob/e6de17e72ef03aa88ba14fa0ec13163061608c74/Source/Windows/Common/CPUFeatures.cpp#L62

Signed-off-by: Mohamed Mediouni <moha...@unpredictable.fr>

+    /*
+     * MIDR_EL1 is not a global register on WHPX
+     * As such, read the CPU0 from the registry to get a consistent value.
+     * Otherwise, on heterogenous systems, you'll get variance between CPUs.
+     */
+    HKEY ProcessorKey = OpenProcessorKey();


Can you follow the QEMU coding style, please (here and elsewhere)?
Variables and function names should be all lower case,
and variable declarations go at the start of a C code
block, not in the middle of one.


In some cases, including in this function, I feel that the rule to declare variables at the start of a block is not really helpful, and is more related to legacy C than a real point nowadays. As well, it sometimes forces to reuse some variables between various sub blocks, which definitely can create bugs.

Anyway, I'm not discussing the existing QEMU coding style, but just asking if for the current context, is it really a problem to declare variable here?

thanks
-- PMM


Reply via email to