Skip to content

Instantly share code, notes, and snippets.

@piscisaureus
Created July 19, 2011 14:47
Show Gist options
  • Save piscisaureus/1092610 to your computer and use it in GitHub Desktop.
Save piscisaureus/1092610 to your computer and use it in GitHub Desktop.
void __declspec(noinline) uv_update_time() {
000000013FBD9730 sub rsp,28h
DWORD ticks = GetTickCount();
000000013FBD9734 call qword ptr [__imp_GetTickCount (13FBED0F0h)]
if (ticks < (LOOP->time & DWORD_MAX)) {
000000013FBD973A mov rcx,qword ptr [uv_main_loop_+10h (13FBFC890h)]
000000013FBD9741 mov edx,eax
000000013FBD9743 mov eax,ecx
000000013FBD9745 cmp rdx,rax
000000013FBD9748 jge uv_update_time+27h (13FBD9757h)
/* GetTickCount has wrapped */
LOOP->time += (int64_t) DWORD_MAX + 1;
000000013FBD974A mov rax,100000000h
000000013FBD9754 add rcx,rax
}
/* Set the low-order dword of the time */
LOOP->time = (int64_t) (LOOP->time & ~(int64_t) DWORD_MAX) | ticks;
000000013FBD9757 mov rax,0FFFFFFFF00000000h
000000013FBD9761 and rcx,rax
000000013FBD9764 or rcx,rdx
000000013FBD9767 mov qword ptr [uv_main_loop_+10h (13FBFC890h)],rcx
}
000000013FBD976E add rsp,28h
000000013FBD9772 ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment