summaryrefslogtreecommitdiff
path: root/src/VBox/HostDrivers/Support/SUPLibAll.cpp
diff options
context:
space:
mode:
authorvboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2021-01-13 12:41:05 +0000
committervboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2021-01-13 12:41:05 +0000
commit4481574cbfef1b2f267fd87f9df644cd80a141ee (patch)
tree55fe9919e623ce53b560fd7c8c7d4e84eadba18d /src/VBox/HostDrivers/Support/SUPLibAll.cpp
parent00db9cb55460ce3935955d6f1841ecb1dece3872 (diff)
downloadVirtualBox-svn-4481574cbfef1b2f267fd87f9df644cd80a141ee.tar.gz
SUP,IPRT: Adjustments for bugref:9898.
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@87235 cfe28804-0f27-0410-a406-dd0f0b0b656f
Diffstat (limited to 'src/VBox/HostDrivers/Support/SUPLibAll.cpp')
-rw-r--r--src/VBox/HostDrivers/Support/SUPLibAll.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/VBox/HostDrivers/Support/SUPLibAll.cpp b/src/VBox/HostDrivers/Support/SUPLibAll.cpp
index 172bebf926d..a09b9c8318c 100644
--- a/src/VBox/HostDrivers/Support/SUPLibAll.cpp
+++ b/src/VBox/HostDrivers/Support/SUPLibAll.cpp
@@ -43,7 +43,6 @@
#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
-
/**
* The slow case for SUPReadTsc where we need to apply deltas.
*
@@ -217,6 +216,7 @@ SUPDECL(uint64_t) SUPReadTscWithDelta(PSUPGLOBALINFOPAGE pGip)
AssertMsgFailed(("iGipCpu=%d (%#x) cCpus=%d fGetGipCpu=%#x\n", iGipCpu, iGipCpu, pGip->cCpus, pGip->fGetGipCpu));
return uTsc;
}
+#endif /* RT_ARCH_AMD64 || RT_ARCH_X86 */
/**
@@ -229,6 +229,7 @@ DECLINLINE(uint16_t) supGetGipCpuIndex(PSUPGLOBALINFOPAGE pGip)
{
uint16_t iGipCpu;
#ifdef IN_RING3
+# if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
if (pGip->fGetGipCpu & SUPGIPGETCPU_IDTR_LIMIT_MASK_MAX_SET_CPUS)
{
/* Storing the IDTR is normally very fast. */
@@ -263,6 +264,15 @@ DECLINLINE(uint16_t) supGetGipCpuIndex(PSUPGLOBALINFOPAGE pGip)
uint8_t idApic = ASMGetApicId();
iGipCpu = pGip->aiCpuFromApicId[idApic];
}
+
+# else
+ int iCpuSet = RTMpCpuIdToSetIndex(RTMpCpuId());
+ if (RT_LIKELY((unsigned)iCpuSet < RT_ELEMENTS(pGip->aiCpuFromCpuSetIdx)))
+ iGipCpu = pGip->aiCpuFromCpuSetIdx[iCpuSet];
+ else
+ iGipCpu = UINT16_MAX;
+# endif
+
#elif defined(IN_RING0)
/* Ring-0: Use use RTMpCpuId() (disables cli to avoid host OS assertions about unsafe CPU number usage). */
RTCCUINTREG uFlags = ASMIntDisableFlags();
@@ -280,6 +290,7 @@ DECLINLINE(uint16_t) supGetGipCpuIndex(PSUPGLOBALINFOPAGE pGip)
iGipCpu = pGip->aiCpuFromCpuSetIdx[iCpuSet];
else
iGipCpu = UINT16_MAX;
+
#else
# error "IN_RING3, IN_RC or IN_RING0 must be defined!"
#endif
@@ -325,6 +336,7 @@ SUPDECL(uint64_t) SUPGetCpuHzFromGipForAsyncMode(PSUPGLOBALINFOPAGE pGip)
}
+
/**
* Worker for SUPIsTscFreqCompatible().
*
@@ -382,5 +394,3 @@ SUPDECL(bool) SUPIsTscFreqCompatible(uint64_t uCpuHz, uint64_t *puGipCpuHz, bool
return fCompat;
}
-#endif /* RT_ARCH_AMD64 || RT_ARCH_X86 */
-