git: DragonFly_RELEASE_6_4 cpu/x86_64: Fix do_cpuid() to explicitly set ECX=0
Aaron LI
aly at crater.dragonflybsd.org
Mon Feb 2 05:16:09 PST 2026
commit 6582506c4b126170053d230aeec9dd800b3af9a3
Author: Aaron LI <aly at aaronly.me>
Date: Mon Jan 26 13:03:04 2026 +0800
cpu/x86_64: Fix do_cpuid() to explicitly set ECX=0
The old do_cpuid() did not initialize ECX before executing the CPUID
instruction, so the results could be incorrect when ECX contained a
non-zero garbage value.
This issue was observed on Intel CPUs when booting a FreeBSD 14.x/15.x
ISO under NVMM, where it caused a general protection fault (#GP) shortly
after the FreeBSD kernel was loaded:
qemu-system-x86_64: NVMM: Mem Assist Failed [gpa=0xbfff8]
qemu-system-x86_64: NVMM: Failed to execute a VCPU.
Abort trap (core dumped)
It occurred when NVMM tried to handle the reading of
IA32_ARCH_CAPABILITIES MSR but the second do_cpuid() returned the
incorrect results indicating that the MSR was unavailable.
The problem was first reported by mneumann in bug #3310 on 2025-11-26 [1].
With this fix applied, NVMM successfully boots FreeBSD 15.0 on my Intel
i5-1340P system.
The root cause was identified by tuxillo with the assistance of the
Claude Opus 4.5 LLM.
[1] https://bugs.dragonflybsd.org/issues/3310#note-9
Credit: Claude Opus 4.5
Wizard: tuxillo
Summary of changes:
sys/cpu/x86_64/include/cpufunc.h | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/6582506c4b126170053d230aeec9dd800b3af9a3
--
DragonFly BSD source repository
More information about the Commits
mailing list