Changeset 5461 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Oct 24, 2007 2:18:28 AM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 25635
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/Makefile.kmk
r5459 r5461 209 209 r3/tcp.cpp 210 210 211 #if1of ($(BUILD_TARGET_ARCH),amd64 x86)212 #RuntimeR3_SOURCES += common/time/timesupA.asm213 #else211 if1of ($(BUILD_TARGET_ARCH),amd64 x86) 212 RuntimeR3_SOURCES += common/time/timesupA.asm 213 else 214 214 RuntimeR3_SOURCES += common/time/timesupref.cpp 215 #endif215 endif 216 216 217 217 ifdef IPRT_WITH_KLDR … … 680 680 VBox/strformat-vbox.cpp 681 681 682 #if1of ($(BUILD_TARGET_ARCH),amd64 x86)683 #RuntimeR0_SOURCES += common/time/timesupA.asm684 #else682 if1of ($(BUILD_TARGET_ARCH),amd64 x86) 683 RuntimeR0_SOURCES += common/time/timesupA.asm 684 else 685 685 RuntimeR0_SOURCES += common/time/timesupref.cpp 686 #endif686 endif 687 687 688 688 RuntimeR0_SOURCES.win.amd64 = $(RuntimeWin64ASM_SOURCES) … … 1010 1010 VBox/strformat-vbox.cpp \ 1011 1011 1012 #if1of ($(BUILD_TARGET_ARCH),amd64 x86)1013 #RuntimeGC_SOURCES += common/time/timesupA.asm1014 #else1012 if1of ($(BUILD_TARGET_ARCH),amd64 x86) 1013 RuntimeGC_SOURCES += common/time/timesupA.asm 1014 else 1015 1015 RuntimeGC_SOURCES += common/time/timesupref.cpp 1016 #endif1016 endif 1017 1017 1018 1018 ifeq ($(VBOX_LDR_FMT32),lx) -
trunk/src/VBox/Runtime/common/time/timesup.cpp
r5456 r5461 47 47 *******************************************************************************/ 48 48 #ifndef IN_GUEST 49 /** The previous timestamp value returned by RTTimeNanoTS. */ 50 static uint64_t g_TimeNanoTSPrev = 0; 51 49 52 /** The RTTimeNanoTS data structure that's passed down to the worker functions. */ 50 53 static RTTIMENANOTSDATA g_TimeNanoTSData = 51 54 { 52 /* .u64Prev = */ 0, 55 /* .pu64Prev = */ &g_TimeNanoTSPrev, 56 /* .pfnBad = */ rtTimeNanoTSInternalBitch, 57 /* .pfnRediscover = */ rtTimeNanoTSInternalRediscover, 53 58 /* .c1nsSteps = */ 0, 54 59 /* .cExpired = */ 0, 55 60 /* .cBadPrev = */ 0, 56 /* .cUpdateRaces = */ 0, 57 /* .pfnBad = */ rtTimeNanoTSInternalBitch, 58 /* .pfnRediscover = */ rtTimeNanoTSInternalRediscover 61 /* .cUpdateRaces = */ 0 59 62 }; 60 63 -
trunk/src/VBox/Runtime/common/time/timesupA.asm
r5457 r5461 25 25 ;; Keep this in sync with iprt/time.h. 26 26 struc RTTIMENANOTSDATA 27 .u64Prev resq 1 27 .pu64Prev RTCCPTR_RES 1 28 .pfnBad RTCCPTR_RES 1 29 .pfnRediscover RTCCPTR_RES 1 28 30 .c1nsSteps resd 1 29 31 .cExpired resd 1 30 32 .cBadPrev resd 1 31 33 .cUpdateRaces resd 1 32 .pfnBad RTCCPTR_RES 133 .pfnRediscover RTCCPTR_RES 134 34 endstruc 35 35 -
trunk/src/VBox/Runtime/common/time/timesupA.mac
r5460 r5461 104 104 ; RDTSC result, we try to make sure it has completed as well. 105 105 mov esi, pData 106 mov esi, [esi + RTTIMENANOTSDATA.pu64Prev] 106 107 mov ebx, eax 107 108 mov ecx, edx 108 lock cmpxchg8b [esi + RTTIMENANOTSDATA.u64Prev]109 lock cmpxchg8b [esi] 109 110 mov u64PrevNanoTS, eax 110 111 mov u64PrevNanoTS_Hi, edx … … 191 192 mov ecx, edx 192 193 mov esi, pData 194 mov esi, [esi + RTTIMENANOTSDATA.pu64Prev] 193 195 mov eax, u64PrevNanoTS 194 196 mov edx, u64PrevNanoTS_Hi 195 lock cmpxchg8b [esi + RTTIMENANOTSDATA.u64Prev]197 lock cmpxchg8b [esi] 196 198 jnz .UpdateFailed 197 199 … … 498 500 mov u32UpdateIntervalTSC, [pGipCPU + SUPGIPCPU.u32UpdateIntervalTSC] 499 501 rdtsc 500 mov u64PrevNanoTS, [pData + RTTIMENANOTSDATA.u64Prev] 502 mov u64PrevNanoTS, [pData + RTTIMENANOTSDATA.pu64Prev] 503 mov u64PrevNanoTS, [u64PrevNanoTS] 501 504 shl rdx, 32 502 505 %ifdef u64SavedRetNanoTS ; doing this here saves a tick or so. … … 574 577 .Update: 575 578 ; if (RT_LIKELY(ASMAtomicCmpXchgU64(&pData->u64Prev, u64RetNanoTS, u64PrevNanoTS))) 579 mov rbx, [pData + RTTIMENANOTSDATA.pu64Prev] 576 580 mov rcx, rax 577 581 mov rax, u64PrevNanoTS 578 lock cmpxchg [ pData + RTTIMENANOTSDATA.u64Prev], rcx582 lock cmpxchg [rbx], rcx 579 583 jnz .UpdateFailed 580 584 … … 691 695 lock inc dword [pData + RTTIMENANOTSDATA.cUpdateRaces] 692 696 ; for (i = 0; i < 10; i++) 693 mov e bx, 10697 mov edx, 10 694 698 .UpdateLoop: 695 699 ; if (u64PrevNanoTS >= u64RetNanoTS) … … 699 703 .UpdateLoopLess: 700 704 ; retry 701 lock cmpxchg [ pData + RTTIMENANOTSDATA.u64Prev], rcx705 lock cmpxchg [rbx], rcx 702 706 jz .Updated 703 dec e bx707 dec edx 704 708 jnz .UpdateLoop 705 709 jmp .Updated -
trunk/src/VBox/Runtime/common/time/timesupref.h
r5456 r5461 72 72 u32NanoTSFactor0 = pGip->u32UpdateIntervalNS; 73 73 u64Delta = ASMReadTSC(); 74 u64PrevNanoTS = ASMAtomicReadU64( &pData->u64Prev);74 u64PrevNanoTS = ASMAtomicReadU64(pData->pu64Prev); 75 75 76 76 #ifdef NEED_TRANSACTION_ID … … 142 142 } 143 143 144 if (RT_LIKELY(ASMAtomicCmpXchgU64( &pData->u64Prev, u64NanoTS, u64PrevNanoTS)))144 if (RT_LIKELY(ASMAtomicCmpXchgU64(pData->pu64Prev, u64NanoTS, u64PrevNanoTS))) 145 145 { 146 146 /* … … 154 154 for (int cTries = 25;;) 155 155 { 156 u64PrevNanoTS = ASMAtomicReadU64( &pData->u64Prev);156 u64PrevNanoTS = ASMAtomicReadU64(pData->pu64Prev); 157 157 if (u64PrevNanoTS >= u64NanoTS) 158 158 break; 159 if (ASMAtomicCmpXchgU64( &pData->u64Prev, u64NanoTS, u64PrevNanoTS))159 if (ASMAtomicCmpXchgU64(pData->pu64Prev, u64NanoTS, u64PrevNanoTS)) 160 160 break; 161 161 AssertBreak(--cTries <= 0, );
Note:
See TracChangeset
for help on using the changeset viewer.