build.mk: Define a constant for OSv kernel builds

It is sometimes useful to programatically learn if something will end up
in the main ELF or in a shared library. This is the function usually
performed by _KERNEL. However, using that proved quite difficult when
Asias was trying to conditionally compile some zfs tools.  This is
because a lot of our headers expect _KERNEL to be defined and they are
also included in the tools build. Too messy, unfortunately.

Because of that, I am defining a new constant that will be available for
every object that will end up in the main ELF, but won't be defined
otherwise.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
sched: make current inline

We are heavily using this function to grab the address of the current thread.
That means a function call will be issued every time that is done, where a
simple mov instruction would do.

For objects outside the main ELF, we don't want that to be inlined, since that
would mean the resolution would have to go through an expensive __tls_get_addr.
So what we do is that we don't present the symbol as inline for them, and make
sure the symbol is always generated.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
sched: make preempt functions inline

Again, we are currently calling a function everytime we disable/enable preemption
(actually a pair of functions), where simple mov instructions would do.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>