lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 06/10/10 22:12, Javier Guerra Giraldez wrote:
> just curious, why was that needed?   is floating point forbidden by
> code conventions?

I don't know about NetBSD specifically, but I do know that on a lot of
platforms --- such as ARM --- only some floating point instructions are
actually implemented in hardware, the rest produce unimplemented
instruction exceptions which the kernel traps and passes to an emulator.

(We have an Android ARM platform where the VFP hardware doesn't support
denormalised numbers. If you do an operation on a denorm number the
kernel attempts to emulate it... and gets it wrong. Sigh.)

This means that supporting floats requires quite a lot of hidden
machinery just to make it all work, and since kernels *contain* that
machinery, it's entirely reasonable to disallow floats from inside the
kernel just to simplify the problem.

(Also, disallowing floats allows various useful optimisations to be
made, such as simplifying the logic when saving/restoring floating point
registers during context switches made from kernel space; as some ARM
VFP chips have 32 x 64bit registers, saving them can use quarter of a
kilobyte of RAM!)

┌─── ───── ─────
│ "To be is to do" -- Nietzche
│ "To do is to be" -- Sartre
│ "Do be do be do" -- Sinatra

Attachment: signature.asc
Description: OpenPGP digital signature