summaryrefslogtreecommitdiff
path: root/src/VBox/HostDrivers/Support/SUPDrvGip.cpp
diff options
context:
space:
mode:
authorvboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2019-11-11 15:23:46 +0000
committervboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2019-11-11 15:23:46 +0000
commite3b34149109cd5d69bf948284831c114c07c0b9c (patch)
tree1ec0818675e2765b01bf0d115c6d321f5c559dfc /src/VBox/HostDrivers/Support/SUPDrvGip.cpp
parente83c81d0543f15e0838bb56b27b94940b00e4357 (diff)
downloadVirtualBox-svn-e3b34149109cd5d69bf948284831c114c07c0b9c.tar.gz
SUPDrv,tstRTInlineAsm: Fixed assertion/failure when trying to use the 0x0b leaf for APIC ID on AMD boxes. bugref:9501
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@81762 cfe28804-0f27-0410-a406-dd0f0b0b656f
Diffstat (limited to 'src/VBox/HostDrivers/Support/SUPDrvGip.cpp')
-rw-r--r--src/VBox/HostDrivers/Support/SUPDrvGip.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/VBox/HostDrivers/Support/SUPDrvGip.cpp b/src/VBox/HostDrivers/Support/SUPDrvGip.cpp
index 77c48583807..bc8e0d0121d 100644
--- a/src/VBox/HostDrivers/Support/SUPDrvGip.cpp
+++ b/src/VBox/HostDrivers/Support/SUPDrvGip.cpp
@@ -199,10 +199,21 @@ static uint32_t supdrvGipGetApicIdSlow(void)
uint32_t uOther = ASMCpuId_EAX(0);
if (uOther >= UINT32_C(0xb) && ASMIsValidStdRange(uOther))
{
- uOther = ASMGetApicIdExt0B();
- if ((uOther & 0xff) == idApic)
- return uOther;
- AssertMsgFailed(("ASMGetApicIdExt0B=>%#x idApic=%#x\n", uOther, idApic));
+ uint32_t uEax = 0;
+ uint32_t uEbx = 0;
+ uint32_t uEcx = 0;
+ uint32_t uEdx = 0;
+#if defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)
+ ASMCpuId_Idx_ECX(0xb, 0, &uEax, &uEbx, &uEcx, &uEdx);
+#else
+ ASMCpuIdExSlow(0xb, 0, 0, 0, &uEax, &uEbx, &uEcx, &uEdx);
+#endif
+ if ((uEcx >> 8) != 0) /* level type != invalid */
+ {
+ if ((uEdx & 0xff) == idApic)
+ return uEdx;
+ AssertMsgFailed(("ASMGetApicIdExt0B=>%#x idApic=%#x\n", uEdx, idApic));
+ }
}
/* The AMD leaf: */
@@ -400,7 +411,7 @@ static DECLCALLBACK(void) supdrvGipDetectGetGipCpuCallback(RTCPUID idCpu, void *
#else
ASMCpuIdExSlow(0xb, 0, 0, 0, &uEax, &uEbx, &uEcx, &uEdx);
#endif
- if (uEax || uEbx || uEcx || uEdx)
+ if ((uEcx >> 8) != 0) /* level type != invalid */
{
if (RT_LIKELY( uEdx < RT_ELEMENTS(pGip->aiCpuFromApicId)
&& !ASMBitTest(pState->bmApicId, uEdx)))