Poorly rewrite kernel_main in rust