diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -326,6 +326,12 @@ td->td_pcb->pcb_rbx = (long) arg; /* first arg */ } +void +cpu_prepare_init_td(struct thread *td) +{ + memset(td->td_frame, 0, sizeof(*td->td_frame)); +} + void cpu_exit(struct thread *td) { diff --git a/sys/arm/arm/vm_machdep.c b/sys/arm/arm/vm_machdep.c --- a/sys/arm/arm/vm_machdep.c +++ b/sys/arm/arm/vm_machdep.c @@ -290,6 +290,11 @@ td->td_pcb->pcb_regs.sf_r5 = (register_t)arg; /* first arg */ } +void +cpu_prepare_init_td(struct thread *td) +{ +} + void cpu_exit(struct thread *td) { diff --git a/sys/arm64/arm64/vm_machdep.c b/sys/arm64/arm64/vm_machdep.c --- a/sys/arm64/arm64/vm_machdep.c +++ b/sys/arm64/arm64/vm_machdep.c @@ -293,6 +293,11 @@ td->td_pcb->pcb_x[PCB_X20] = (uintptr_t)arg; } +void +cpu_prepare_init_td(struct thread *td) +{ +} + void cpu_exit(struct thread *td) { diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -324,6 +324,11 @@ td->td_pcb->pcb_ebx = (int) arg; /* first arg */ } +void +cpu_prepare_init_td(struct thread *td) +{ +} + void cpu_exit(struct thread *td) { diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -784,6 +784,7 @@ */ KASSERT((td->td_pflags & TDP_EXECVMSPC) == 0, ("nested execve")); + cpu_prepare_init_td(td); oldvmspace = p->p_vmspace; error = kern_execve(td, &args, NULL, oldvmspace); KASSERT(error != 0, diff --git a/sys/powerpc/powerpc/vm_machdep.c b/sys/powerpc/powerpc/vm_machdep.c --- a/sys/powerpc/powerpc/vm_machdep.c +++ b/sys/powerpc/powerpc/vm_machdep.c @@ -176,6 +176,11 @@ */ } +void +cpu_prepare_init_td(struct thread *td) +{ +} + /* * Intercept the return address from a freshly forked process that has NOT * been scheduled yet. diff --git a/sys/riscv/riscv/vm_machdep.c b/sys/riscv/riscv/vm_machdep.c --- a/sys/riscv/riscv/vm_machdep.c +++ b/sys/riscv/riscv/vm_machdep.c @@ -249,6 +249,11 @@ td->td_pcb->pcb_sp = (uintptr_t)td->td_frame; } +void +cpu_prepare_init_td(struct thread *td) +{ +} + void cpu_exit(struct thread *td) { diff --git a/sys/sys/proc.h b/sys/sys/proc.h --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1254,6 +1254,7 @@ int cpu_fetch_syscall_args(struct thread *td); void cpu_fork(struct thread *, struct proc *, struct thread *, int); void cpu_fork_kthread_handler(struct thread *, void (*)(void *), void *); +void cpu_prepare_init_td(struct thread *td); int cpu_procctl(struct thread *td, int idtype, id_t id, int com, void *data); void cpu_set_syscall_retval(struct thread *, int);