For some experimental purposes i need to create a child kernel process without shared memory. As i know, the kthread\_create and kernel\_thread routines is always call do\_fork with CLONE\_VM. But i need to call do\_fork without CLONE\_VM

I have found in arch/x86\_64/kernel/process.c(x86\_64 is a suitable architecture for the experiment):

```
asmlinkage long sys_fork(struct pt_regs *regs)
{
        return do_fork(SIGCHLD, regs->rsp, regs, 0, NULL, NULL);
}

```

I think, i should call do\_fork(SIGCHLD, regs->rsp, regs, 0, NULL, NULL). But i can't understand how to setup the pt\_regs structure. I want to setup the structure based on registers of the current process.
Is there is a function to fill pt\_regs based on current process? Or maybe there is an different way how to create process with own memory inside kernel?