OS-8168: x86_emulate_cpuid() should clear upper 32 bits

Details

Issue Type:Bug
Priority:4 - Normal
Status:Resolved
Created at:2020-05-05T20:30:09.525Z
Updated at:2020-07-01T18:38:04.296Z

People

Created by:Former user
Reported by:Former user

Resolution

Not A Bug: The behaviour described is not a defect -- it is either an intentional part of the design or a result of environmental factors beyond our control.
(Resolution Date: 2020-07-01T18:38:04.280Z)

Labels

bhyve

Description

Patrick Mooney noticed in passing that this code:

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);                              

looked suspicious in its ignoring of the top 32 bits of the register outputs. And indeed, the CPUID description in the Intel manual (what I had to hand) says:

1. On Intel 64 processors, CPUID clears the high 32 bits of the RAX/RBX/RCX/RDX registers in all modes.

Comments

Comment by Former user
Created at 2020-05-18T09:41:35.885Z
Updated at 2020-07-01T18:37:43.765Z

https://www.illumos.org/issues/12746