FreeBSD/sys/mips/mips/machdep.c
/*
 * Initialize mips and configure to run kernel
 */
Initialize mips and configure to run kernel
Initialize mips and configure to run kernel
void
mips_proc0_init(void)
{
#ifdef SMP
	if (platform_processor_id() != 0)
		panic("BSP must be processor number 0");
#endif
	proc_linkup0(&proc0, &thread0);
	KASSERT((kstack0 & PAGE_MASK) == 0,
		("kstack0 is not aligned on a page boundary: 0x%0lx",
		(long)kstack0));
	thread0.td_kstack = kstack0;
	thread0.td_kstack_pages = KSTACK_PAGES;
	thread0.td_pcb = (struct pcb *)(thread0.td_kstack +
	    thread0.td_kstack_pages * PAGE_SIZE) - 1;
	thread0.td_frame = &thread0.td_pcb->pcb_regs;
	dpcpu_init((void *)pmap_steal_memory(DPCPU_SIZE), 0);
	PCPU_SET(curpcb, thread0.td_pcb);
}
void mips_proc0_init ( void ) { #ifdef SMP if ( platform_processor_id ( ) != 0 ) panic ( " " ) ; #endif proc_linkup0 ( & proc0 , & thread0 ) ; KASSERT ( ( kstack0 & PAGE_MASK ) == 0 , ( " " , ( long ) kstack0 ) ) ; thread0 . td_kstack = kstack0 ; thread0 . td_kstack_pages = KSTACK_PAGES ; thread0 . td_pcb = ( struct pcb * ) ( thread0 . td_kstack + thread0 . td_kstack_pages * PAGE_SIZE ) - 1 ; thread0 . td_frame = & thread0 . td_pcb -> pcb_regs ; dpcpu_init ( ( void * ) pmap_steal_memory ( DPCPU_SIZE ) , 0 ) ; PCPU_SET ( curpcb , thread0 . td_pcb ) ; }
Initialize mips and configure to run kernel
Initialize mips and configure to run kernel
/* 
	 * Do not use cpu_thread_alloc to initialize these fields 
	 * thread0 is the only thread that has kstack located in KSEG0 
	 * while cpu_thread_alloc handles kstack allocated in KSEG2.
	 */ /* Steal memory for the dynamic per-cpu area. */ /*
	 * There is no need to initialize md_upte array for thread0 as it's
	 * located in .bss section and should be explicitly zeroed during 
	 * kernel initialization.
	 */