build.mk: Don't build loader.elf with wrong parameters

As explained in issue #545, we have a makefile bug where the rule for
building libosv.so, which depends on loader.elf the variables usually defined
for compiling a .so to be "inherited" by the compilation of loader.elf,
causing some of OSv's objects to be compiled with slightly different flags
than other object files (e.g., we saw runtime.o compile with -fPIC).
The result is that compilation with and without "-j" comes out *not*
identical.

In this patch, we give up the notion of libosv.so being a separate target,
and just build it right after loader.elf - as those are anyway closely
related.

Fixes #545.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
sched: fix rare case of idle thread's runtime becoming NaN

This patch fixes a bug where the idle thread's runtime could become a
NaN value, causing bad decisions by the scheduler in rare cases.

A thread's runtime is updated by thread_runtime::ran_for(). The key line
of code is:
     _Rtt += _priority * (cnew - cold);

In other words, the runtime consumption (cnew-cold) is multiplied by
thread's priority, so that a thread with priority 2 consumes runtime
at twice the normal rate (and as result, will run half of what its
priority 1 comrades will run).

For the idle thread, _priority=Inf, with the intention that the above
addition will lead to _Rtt=Inf, so the idle thread will always lose the
lowest-runtime contest.

Unfortunately, there is one case where this doesn't happen correctly -
when ran_for() is called for an extremely tiny duration. In one extreme
case, I saw it called after the idle thread only ran for 4 nanoseconds!
In that case we can end up with the two single-precision floats cnew and
cold equal, and we end up with a calculation Inf*0, whose result is NaN
instead of Inf.

So this patch changes to code to explicitly set _Rtt=Inf when
_priority=Inf, without attempting the multiplication.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>