/* NOTE! Only a kernel-only process(ie the swapper or direct descendants who haven't done an "execve()") should use this: it will work within a system call from a "real" process, but the process memory space will not be freed until both the parent and the child have exited.  */
int kernel_thread(int(*fn)(void *), void *arg, unsigned long flags)
/* NOTE! Only a kernel-only process(ie the swapper or direct descendants who haven't done an "execve()") should use this: it will work within a system call from a "real" process, but the process memory space will not be freed until both the parent and the child have exited.  */
int kernel_thread(int(*fn)(void *), void *arg, unsigned long flags)
{
	struct pt_regs regs;
	memset(&regs, 0, sizeof(regs));
	regs.regs[2] = (unsigned long)arg;
	regs.regs[3] = (unsigned long)fn;
	regs.pc = (unsigned long)kernel_thread_helper;
	regs.sr = (1 << 30);
	return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0,
		      &regs, 0, NULL, NULL);
}