FreeBSD/sys/mips/mips/vm_machdep.c
/*
 * Intercept the return address from a freshly forked process that has NOT
 * been scheduled yet.
 *
 * This is needed to make kernel threads stay in kernel mode.
 */
Intercept the return address from a freshly forked process that has NOT
been scheduled yet.

This is needed to make kernel threads stay in kernel mode.
Intercept the return address from a freshly forked process that has NOT been scheduled yet . This is needed to make kernel threads stay in kernel mode .
void
cpu_fork_kthread_handler(struct thread *td, void (*func)(void *), void *arg)
{
	td->td_pcb->pcb_context[PCB_REG_S0] = (register_t)(intptr_t)func;
	td->td_pcb->pcb_context[PCB_REG_S1] = (register_t)(intptr_t)arg;
}
void cpu_fork_kthread_handler ( struct thread * td , void ( * func ) ( void * ) , void * arg ) { td -> td_pcb -> pcb_context [ PCB_REG_S0 ] = ( register_t ) ( intptr_t ) func ; td -> td_pcb -> pcb_context [ PCB_REG_S1 ] = ( register_t ) ( intptr_t ) arg ; }
Intercept the return address from a freshly forked process that has NOT
 been scheduled yet.
Intercept the return address from a freshly forked process that has NOT been scheduled yet .
/*
	 * Note that the trap frame follows the args, so the function
	 * is really called like this:	func(arg, frame);
	 */