Is it good idea to allow to freely use FPU in kernel?

also the kernel in Haiku is Hybrid as far as I know. Does anyone have any documentation on this? How to write servers in kernel space in Haiku

Hybrid kernel is MS marketing bullshit. It actually means modular kernel. There are no kernel mode servers in Haiku.

5 Likes

AFAIK, the only place where we actually use floating point in the kernel is to report the level of support in various drivers, and modules. As tialaramex pointed out, this should be very easy to fix using fixed point integers instead, or having 0x0800 and 0x0700 vs. 0.8, and 0.7 wouldn’t be that awkward either.

However, as tqh pointed out, we might want to use SIMD instructions in the kernel, too, for instance for a fast encryption implementation.

So having a solution like Linux (I suppose in userland) where it detects FPU usage, and then lazily restores its state does not sound like a bad solution to me.
Unfortunately, this wouldn’t save you from implementing it for RISC :slight_smile:

Another viable solution would be to forbid FPU usage fow now, and only implement the FPU detection way once needed.

5 Likes

This NetBSD article explains lazy FPU quite well: NetBSD Documentation: How lazy FPU context switch works

1 Like

SIMD != FPU though.

On older CPU’s they shared registers…

I think we should focus on BeOS compatibility for ARM and RISC-V like gcc2 at least until R1 is released. That is, to develop a kernel for these processors compatible with BeOS