Move "naked" functions to own assembly files and fix I/O functions

At this point the kernel is almost fully functional. We still need
some work in the kernel modules/drivers loader.