#15658: System freeze after 3-rd icon when booting
-----------------------------+----------------------------
Reporter: X512 | Owner: nobody
Type: bug | Status: closed
Priority: normal | Milestone: Unscheduled
Component: System/Kernel | Version: R1/Development
Resolution: fixed | Keywords:
Blocked By: | Blocking:
Has a Patch: 0 | Platform: x86
-----------------------------+----------------------------
Comment (by X512):
This source code:
{{{#!c++
extern "C" bigtime_t
system_time()
{
uint64 tsc = rdtsc();
uint64 lo = (uint32)tsc;
uint64 hi = tsc >> 32;
return ((lo * gTimeConversionFactor) >> 32) + hi *
gTimeConversionFactor;
}
}}}
produce a bit better machine code:
{{{
00000b54 <system_time>:
b54: 55 push ebp
b55: 89 e5 mov ebp,esp
b57: 83 ec 2c sub esp,0x2c
b5a: 57 push edi
b5b: 56 push esi
b5c: 53 push ebx
b5d: e8 fc ff ff ff call b5e <system_time+0xa>
b62: 89 c6 mov esi,eax
b64: 89 d7 mov edi,edx
b66: 89 c1 mov ecx,eax
b68: 89 7d f8 mov DWORD PTR [ebp-8],edi
b6b: c7 45 fc 00 00 00 00 mov DWORD PTR [ebp-4],0x0
b72: a1 00 00 00 00 mov eax,ds:0x0
b77: 31 d2 xor edx,edx
b79: 89 55 e4 mov DWORD PTR [ebp-28],edx
b7c: 8b 75 e4 mov esi,DWORD PTR [ebp-28]
b7f: 89 45 e0 mov DWORD PTR [ebp-32],eax
b82: f7 e1 mul ecx
b84: 0f af f1 imul esi,ecx
b87: 8b 4d e0 mov ecx,DWORD PTR [ebp-32]
b8a: 31 db xor ebx,ebx
b8c: 0f af cb imul ecx,ebx
b8f: 89 45 f0 mov DWORD PTR [ebp-16],eax
b92: 8b 45 f8 mov eax,DWORD PTR [ebp-8]
b95: 01 f2 add edx,esi
b97: 89 55 f4 mov DWORD PTR [ebp-12],edx
b9a: 01 4d f4 add DWORD PTR [ebp-12],ecx
b9d: f7 65 e0 mul DWORD PTR [ebp-32]
ba0: 8b 4d f8 mov ecx,DWORD PTR [ebp-8]
ba3: 0f af 4d e4 imul ecx,DWORD PTR [ebp-28]
ba7: 89 45 e8 mov DWORD PTR [ebp-24],eax
baa: 8b 45 e0 mov eax,DWORD PTR [ebp-32]
bad: 0f af 45 fc imul eax,DWORD PTR [ebp-4]
bb1: 8b 5d f4 mov ebx,DWORD PTR [ebp-12]
bb4: 31 f6 xor esi,esi
bb6: 01 ca add edx,ecx
bb8: 89 55 ec mov DWORD PTR [ebp-20],edx
bbb: 01 45 ec add DWORD PTR [ebp-20],eax
bbe: 89 d8 mov eax,ebx
bc0: 89 f2 mov edx,esi
bc2: 03 45 e8 add eax,DWORD PTR [ebp-24]
bc5: 13 55 ec adc edx,DWORD PTR [ebp-20]
bc8: 5b pop ebx
bc9: 5e pop esi
bca: 5f pop edi
bcb: 89 ec mov esp,ebp
bcd: 5d pop ebp
bce: c3 ret
bcf: 90 nop
}}}
--
Ticket URL: <https://dev.haiku-os.org/ticket/15658#comment:8>
Haiku <https://dev.haiku-os.org>
The Haiku operating system.