Moved some code to cpu_init and cpu_init_early()
Improved thread code
Thread state names