#include "types.h" #include "defs.h" #include "param.h" #include "mmu.h" #include "proc.h" #include "x86.h" static void bootothers(void); static void mpmain(void) __attribute__((noreturn)); // Bootstrap processor starts running C code here. int main(void) { int bcpu, i; extern char edata[], end[]; // clear BSS memset(edata, 0, end - edata); // pushcli() every processor during bootstrap. for(i=0; istack + KSTACKTOP; *(void**)(code-8) = mpmain; lapic_startap(c->apicid, (uint)code); // Wait for cpu to get through bootstrap. while(c->booted == 0) ; } }