Changeset 36254 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Mar 10, 2011 5:22:08 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 70492
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/time/timesupA.mac
r36220 r36254 95 95 mov u32ApicIdPlus, ebx 96 96 %endif 97 ; pGipCpu = &pGip->aCPU[ u8ApicId];97 ; pGipCpu = &pGip->aCPU[pGip->aiCpuFromApicId[u8ApicId]]; 98 98 shr ebx, 24 99 %ifdef SUP_WITH_LOTS_OF_CPUS 100 movzx ebx, word [esi + ebx * 2 + SUPGLOBALINFOPAGE.aiCpuFromApicId] 101 %else 102 and ebx, SUPGLOBALINFOPAGE_CPUS - 1 103 %endif 99 104 mov eax, SUPGIPCPU_size 100 105 mul ebx … … 516 521 mov u32ApicIdPlus, ebx 517 522 %endif 518 ; pGipCpu = &pGip->aCPU[ u8ApicId];523 ; pGipCpu = &pGip->aCPU[pGip->aiCpuFromApicId[u8ApicId]]; 519 524 shr ebx, 24 525 %ifdef SUP_WITH_LOTS_OF_CPUS 526 movzx eax, word [pGip + rbx * 2 + SUPGLOBALINFOPAGE.aiCpuFromApicId] 527 %else 520 528 mov eax, ebx 521 %if SUPGLOBALINFOPAGE_CPUS < 256522 529 and eax, SUPGLOBALINFOPAGE_CPUS - 1 523 530 %endif -
trunk/src/VBox/Runtime/common/time/timesupref.h
r36220 r36254 63 63 64 64 #ifdef ASYNC_GIP 65 uint8_t u8ApicId = ASMGetApicId();66 # if SUPGLOBALINFOPAGE_CPUS < 25667 PSUPGIPCPU pGipCpu = &pGip->aCPUs[ u8ApicId & SUPGLOBALINFOPAGE_CPUS];65 uint8_t u8ApicId = ASMGetApicId(); 66 # ifdef SUP_WITH_LOTS_OF_CPUS 67 PSUPGIPCPU pGipCpu = &pGip->aCPUs[pGip->aiCpuFromApicId[u8ApicId]]; 68 68 # else 69 PSUPGIPCPU pGipCpu = &pGip->aCPUs[u8ApicId ];69 PSUPGIPCPU pGipCpu = &pGip->aCPUs[u8ApicId & (SUPGLOBALINFOPAGE_CPUS - 1)]; 70 70 # endif 71 71 #else -
trunk/src/VBox/Runtime/generic/RTMpGetArraySize-generic.cpp
r33676 r36254 5 5 6 6 /* 7 * Copyright (C) 2010 Oracle Corporation7 * Copyright (C) 2010-2011 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 30 30 *******************************************************************************/ 31 31 #include <iprt/mp.h> 32 #include "internal/iprt.h" 33 34 #include <iprt/asm.h> 32 35 #include <iprt/cpuset.h> 33 #include "internal/iprt.h"34 36 35 37 36 38 RTDECL(uint32_t) RTMpGetArraySize(void) 37 39 { 38 RTCPUSET CpuSet; 39 return RTCpuLastIndex(RTMpGetSet(&CpuSet)) + 1; 40 /* 41 * Cache the result here. This whole point of this function is that it 42 * will always return the same value, so that should be safe. 43 * 44 * Note! Because RTCPUSET may be to small to represent all the CPUs, we 45 * check with RTMpGetCount() as well. 46 */ 47 static uint32_t s_cMaxCpus = 0; 48 uint32_t cCpus = s_cMaxCpus; 49 if (RT_UNLIKELY(cCpus == 0)) 50 { 51 RTCPUSET CpuSet; 52 uint32_t cCpus1 = RTCpuLastIndex(RTMpGetSet(&CpuSet)) + 1; 53 uint32_t cCpus2 = RTMpGetCount(); 54 uint32_t cCpus = RT_MAX(cCpus1, cCpus2); 55 ASMAtomicCmpXchgU32(&s_cMaxCpus, cCpus, 0); 56 return cCpus; 57 } 58 return s_cMaxCpus; 59 40 60 } 41 61 RT_EXPORT_SYMBOL(RTMpGetArraySize);
Note:
See TracChangeset
for help on using the changeset viewer.