[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Minios-devel] [UNIKRAFT PATCH v2] lib/nolibc: Fix remaining time in nanosleep
Hi, I also found that that was the problem, I fixed it by adding the uk/plat/time.h to time.c in newlib when I added the nanosleep patch to newlib.
Dafna
Hi Dafna,
On 09/16/2018 12:09 PM, Dafna Hirschfeld wrote:
> Hi,
> I found some bugs when adding the nanosleep fix to newlib,
> It seems that the time measurement returns wrong values.
> I wrote a main function that just calls ukplat_monotonic_clock in a loop,
What you're seeing is that the output jumps between low and very high
values, right?
I tested the code and noticed that your test code doesn't include
uk/plat/time.h, leading to a warning about implicit declaration for
ukplat_monotonic_clock(). While everything links in the end because the
function is available during linking stage, this leads to a subtle
change in behavior: The code generated for main.o assumes that
ukplat_monotonic_clock() returns a signed int (the default assumption
for an unknown function), so the compiler issues a movslq instruction to
cast the return value to an __nsec. As a result, values in bits 32-63
are lost, and if bit 31 is 1, the result, interpreted as an unsigned
long, is very large.
Adding uk/plat/time.h as an include to your test code fixes the problem.
Cheers,
Florian
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel
|