// Common CPU setup code. static void mpmain(void) { cprintf("cpu%d: starting\n", cpu->id); idtinit(); // load idt register xchg(&cpu->started, 1); // tell startothers() we're up scheduler(); // start running processes }
// Common CPU setup code. static void mpmain(void) { cprintf("cpu%d: starting %d\n", cpuid(), cpuid()); idtinit(); // load idt register xchg(&(mycpu()->started), 1); // tell startothers() we're up scheduler(); // start running processes }
// Common CPU setup code. static void mpmain(void) { cprintf("cpu%d: starting\n", cpu->id); idtinit(); // load idt register xchg(&cpu->started, 1); // tell startothers() we're up . change the state of other cpu scheduler(); // start running processes 这个可能就是最开始多核开始执行的代码,以后的代码都要 }
// Common CPU setup code. static void mpmain(void) { cprintf("cpu%d: starting\n", cpu->id); idtinit(); // load idt register #ifdef CONFIG_MULTI_PROCESS xchg(&cpu->started, 1); // tell startothers() we're up #endif scheduler(); // start running processes }
// Bootstrap processor gets here after setting up the hardware. // Additional processors start here. static void mpmain(void) { cprintf("cpu%d: mpmain\n", cpu()); idtinit(); if(cpu() != mp_bcpu()) lapic_init(cpu()); setupsegs(0); xchg(&cpus[cpu()].booted, 1); cprintf("cpu%d: scheduling\n"); scheduler(); }
// Bootstrap processor gets here after setting up the hardware. // Additional processors start here. static void mpmain(void) { if(cpunum() != mpbcpu()) lapicinit(cpunum()); ksegment(); cprintf("cpu%d: mpmain\n", cpu->id); idtinit(); cpu->dir = kernel_dir; enable_page(cpu->dir); cprintf("-- mpmain -- cpu%d enable paging dir: %x \n", cpu->id, cpu->dir); xchg(&cpu->booted, 1); cprintf("cpu%d: scheduling\n", cpu->id); scheduler(); }