rewrite kernel.c