#15658: System freeze after 3-rd icon when booting
-----------------------------+----------------------------
Reporter: X512 | Owner: nobody
Type: bug | Status: new
Priority: normal | Milestone: Unscheduled
Component: System/Kernel | Version: R1/Development
Resolution: | Keywords:
Blocked By: | Blocking:
Has a Patch: 0 | Platform: x86
-----------------------------+----------------------------
Comment (by pulkomandy):
This change is mainly moving code around, but there is some change in the
system_time function.
New implementation (the rdtsc() function returns the result of rdtsc as a
64bit number):
{{{
extern "C" bigtime_t
system_time()
{
return rdtsc() * gTimeConversionFactor;
}
}}}
Old implementation for 32bit:
{{{
FUNCTION(system_time):
/* load 64-bit factor into %eax (low), %edx (high) */
/* hand-assemble rdtsc -- read time stamp counter */
rdtsc /* time in %edx,%eax */
pushl %ebx
movl gTimeConversionFactor, %ebx
movl %edx, %ecx /* save high half */
mull %ebx /* truncate %eax, but keep %edx */
movl %ecx, %eax
movl %edx, %ecx /* save high half of low */
mull %ebx /*, %eax*/
/* now compute [%edx, %eax] + [%ecx], propagating carry */
subl %ebx, %ebx /* need zero to propagate carry */
addl %ecx, %eax
adc %ebx, %edx
popl %ebx
ret
}}}
Old implementation for 64bit:
{{{
extern "C" bigtime_t
system_time()
{
uint64 lo, hi;
asm("rdtsc": "=a"(lo), "=d"(hi));
return ((lo * gTimeConversionFactor) >> 32) + hi *
gTimeConversionFactor;
}
}}}
--
Ticket URL: <https://dev.haiku-os.org/ticket/15658#comment:3>
Haiku <https://dev.haiku-os.org>
The Haiku operating system.