src/sys/arm/arm/vm_machdep.c
/*
 * Initialize machine state, mostly pcb and trap frame for a new
 * thread, about to return to userspace.  Put enough state in the new
 * thread's PCB to get it to go back to the fork_return(), which
 * finalizes the thread state and handles peculiarities of the first
 * return to userspace for the new thread.
 */
Initialize machine state, mostly pcb and trap frame for a new
thread, about to return to userspace.  Put enough state in the new
thread's PCB to get it to go back to the fork_return(), which
finalizes the thread state and handles peculiarities of the first
return to userspace for the new thread.
Initialize machine state mostly pcb and trap frame for a new thread about to return to userspace . Put enough state in the new thread ' s PCB to get it to go back to the fork_return () which finalizes the thread state and handles peculiarities of the first return to userspace for the new thread .
void
cpu_copy_thread(struct thread *td, struct thread *td0)
{
	bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe));
	bcopy(td0->td_pcb, td->td_pcb, sizeof(struct pcb));
	td->td_pcb->pcb_regs.sf_r4 = (register_t)fork_return;
	td->td_pcb->pcb_regs.sf_r5 = (register_t)td;
	td->td_pcb->pcb_regs.sf_lr = (register_t)fork_trampoline;
	td->td_pcb->pcb_regs.sf_sp = STACKALIGN(td->td_frame);
	td->td_frame->tf_spsr &= ~PSR_C;
	td->td_frame->tf_r0 = 0;
	td->td_md.md_spinlock_count = 1;
	td->td_md.md_saved_cspr = PSR_SVC32_MODE;
}
void cpu_copy_thread ( struct thread * td , struct thread * td0 ) { bcopy ( td0 -> td_frame , td -> td_frame , sizeof ( struct trapframe ) ) ; bcopy ( td0 -> td_pcb , td -> td_pcb , sizeof ( struct pcb ) ) ; td -> td_pcb -> pcb_regs . sf_r4 = ( register_t ) fork_return ; td -> td_pcb -> pcb_regs . sf_r5 = ( register_t ) td ; td -> td_pcb -> pcb_regs . sf_lr = ( register_t ) fork_trampoline ; td -> td_pcb -> pcb_regs . sf_sp = STACKALIGN ( td -> td_frame ) ; td -> td_frame -> tf_spsr &= ~ PSR_C ; td -> td_frame -> tf_r0 = 0 ; td -> td_md . md_spinlock_count = 1 ; td -> td_md . md_saved_cspr = PSR_SVC32_MODE ; }
Initialize machine state, mostly pcb and trap frame for a new
 thread, about to return to userspace.
Initialize machine state mostly pcb and trap frame for a new thread about to return to userspace .
/* Setup to release spin count in fork_exit(). */