Some Basic Rules No memory protection If you corrupt memory, whether in user context or interrupt context, the whole machine will crash. Are you sure you cant do what you want in userspace? No floating point or MMX The FPU context is not saved; even in user context the FPU state probably wont correspond with the current process: you would mess with some user process FPU state. If you really want to do this, you would have to explicitly save/restore the full FPU state (and avoid context switches). It is generally a bad idea; use fixed point arithmetic first. A rigid stack limit The kernel stack is about 6K in 2.2 (for most architectures: its about 14K on the Alpha), and shared with interrupts so you cant use it all. Avoid deep recursion and huge local arrays on the stack (allocate them dynamically instead). The Linux kernel is portable Lets keep it that way.

Your code should be 64-bit clean, and endian-independent. You should also minimize CPU specific stuff, e.g. inline assembly should be cleanly encapsulated and minimized to ease porting. Generally it should be restricted to the architecture-dependent part of the kernel tree.

Download Unreliable Guide To Hacking The Linux Kernel Tutorial Manual