Exemple #1
0
// Bootstrap processor starts running C code here.
int
main(int memsize)
{
  mpinit(); // collect info about this machine
  lapicinit(mpbcpu());
  ksegment();
  picinit();       // interrupt controller
  ioapicinit();    // another interrupt controller
  consoleinit();   // I/O devices & their interrupts
  uartinit();      // serial port
  cprintf("cpus %p cpu %p\n", cpus, cpu);
  cprintf("\ncpu%d: starting xv6\n\n", cpu->id);
  cprintf("mem: %d kb\n", memsize);
  kinit(memsize);         // physical memory allocator
  pinit();         // process table
  tvinit();        // trap vectors
  binit();         // buffer cache
  fileinit();      // file table
  iinit();         // inode cache
  ideinit();       // disk
  if(!ismp)
    timerinit();   // uniprocessor timer
  pageinit();	   // enable paging
  userinit();      // first user process
  bootothers();    // start other processors

  // Finish setting up this processor in mpmain.
  mpmain();
}
Exemple #2
0
/**
 * Bootstrap processor starts running C code here.
 */
int main(void)
{
	/**
	 * ld会生成如下几个变量用来标识程序的段
	 *
	 *  _etext(etext)	正文段结束后第一个地址
	 *	_edata(edata)	数据段结束后第一个地址
	 *	_end(end)		bss段结束后第一个地址
	 */
	extern char edata[], end[];

  	// clear BSS
  	memset(edata, 0, end - edata);

  	// collect info about this machine
  	mp_init();
  	lapic_init(mp_bcpu());

  	cprintf("\ncpu%d: starting myos\n\n", cpu());
	cprintf("Welcome to myos !\n");

	pinit();         // process table
	binit();         // buffer cache
	pic_init();      // interrupt controller
	ioapic_init();   // another interrupt controller

	kinit();         // physical memory allocator
	tvinit();        // trap vectors
	fileinit();      // file table
	iinit();         // inode cache
	console_init();  // I/O devices & their interrupts
	ide_init();      // disk
	if(!ismp)
			timer_init();  // uniprocessor timer
	userinit();      // first user process
	bootothers();    // start other processors

	// Finish setting up this processor in mpmain.
	mpmain();
}