Actions
Bug #12746
closedx86_emulate_cpuid() should clear upper 32 bits
Start date:
Due date:
% Done:
100%
Estimated time:
Difficulty:
Medium
Tags:
bhyve
Gerrit CR:
Description
When investigating a gcc9 gripe in the bhyve codebase, I noticed something that looked amiss:
1516 handled = x86_emulate_cpuid(svm_sc->vm, vcpu, 1517 (uint32_t *)&state->rax, 1518 (uint32_t *)&ctx->sctx_rbx, 1519 (uint32_t *)&ctx->sctx_rcx, 1520 (uint32_t *)&ctx->sctx_rdx);
While gcc9 was complaining about the alignment on the rax-rdx stores, it looked like the upper bits in those registers wouldn't be properly cleared. Indeed the SDM notes that the upper 32-bits of those registers is zeroed by CPUID calls. A quick test under bhyve showed that garbage left in the upper bits remained there after a CPUID call.
While no guest has complained about this to date, bhyve should probably do the right thing and clear those bits. (And in the process, address gcc9's gripe.)
Related issues
Actions