Example #1
0
// Bootstrap processor starts running C code here.
// Allocate a real stack and switch to it, first
// doing some setup required for memory allocator to work.
int
main(void)
{
  kinit1(end, P2V(4*1024*1024)); // phys page allocator
  kvmalloc();      // kernel page table
  mpinit();        // collect info about this machine
  lapicinit();
  seginit();       // set up segments
  cprintf("\ncpu%d: starting xv6\n\n", cpu->id);
  picinit();       // interrupt controller
  ioapicinit();    // another interrupt controller
  consoleinit();   // I/O devices & their interrupts
  uartinit();      // serial port
  pinit();         // process table
  tvinit();        // trap vectors
  binit();         // buffer cache
  fileinit();      // file table
  ideinit();       // disk
  if(!ismp)
    timerinit();   // uniprocessor timer
  startothers();   // start other processors
  kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers()
  userinit();      // first user process
  mpmain();
  
}
Example #2
0
File: main.c Project: hubert-he/xv6
// Bootstrap processor starts running C code here.
// Allocate a real stack and switch to it, first
// doing some setup required for memory allocator to work.
int
main(void)
{
  kinit1(end, P2V(4*1024*1024)); // phys page allocator  // kmem. freelist added
  cprintf("%x \n", end);
  kvmalloc();      // kernel page table
#ifdef CONFIG_MULTI_PROCESS
  mpinit();        // collect info about this machine
#endif
  lapicinit();
  seginit();       // set up segments
  picinit();       // interrupt controller: Programmable Interrupt Controller
#ifdef CONFIG_MULTI_PROCESS
  ioapicinit();    // another interrupt controller
#endif
  consoleinit();   // I/O devices & their interrupts
  uartinit();      // serial port
  pinit();         // process table
  tvinit();        // trap vectors
  binit();         // buffer cache
  fileinit();      // file table
  iinit();         // inode cache
  ideinit();       // disk
  if(!ismp)
    timerinit();   // uniprocessor timer
#ifdef CONFIG_MULTI_PROCESS
  startothers();   // start other processors
  kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers()
#endif
  userinit();      // first user process
  // Finish setting up this processor in mpmain.
  mpmain();
}
Example #3
0
// Bootstrap processor starts running C code here.
// Allocate a real stack and switch to it, first
// doing some setup required for memory allocator to work.
int
main(void)
{
  kinit1(end, P2V(4*1024*1024)); // phys page allocator
  kvmalloc();      // kernel page table
  mpinit();        // detect other processors
  lapicinit();     // interrupt controller
  seginit();       // segment descriptors
  cprintf("\ncpu%d: starting xv6\n\n", cpunum());
  picinit();       // another interrupt controller
  ioapicinit();    // another interrupt controller
  consoleinit();   // console hardware
  uartinit();      // serial port
  pinit();         // process table
  tvinit();        // trap vectors
  binit();         // buffer cache
  fileinit();      // file table
  ideinit();       // disk
  if(!ismp)
    timerinit();   // uniprocessor timer
  startothers();   // start other processors
  kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers()
  userinit();      // first user process
  mpmain();        // finish this processor's setup
  init_semaphores_on_boot();
}
Example #4
0
File: main.c Project: ismaellc/SOTR
// Bootstrap processor starts running C code here.
// Allocate a real stack and switch to it, first
// doing some setup required for memory allocator to work.
int
main(void)
{
	unsigned char FB[]="MESSAGE WRITTEN THROUGH FRAMEBUFFER!!";
	fb_init();       // initialize framebuffer device (2015.11.02)
	cprintf("\nUsing Framebuffer still presents some problems :(\n\n");
	cprintf("\nSuggestion: review the way it is used in console.c\n\n");
	fb_write(FB, sizeof(FB)); // Framebuffer maybe could be used before this moment (2015.11.02)
	see_mylock(MYLOCK);
  kinit1(end, P2V(4*1024*1024)); // phys page allocator
  kvmalloc();      // kernel page table
  mpinit();        // collect info about this machine
  lapicinit();
  seginit();       // set up segments
  cprintf("\ncpu%d: starting xv6\n\n", cpu->id);
  picinit();       // interrupt controller
  ioapicinit();    // another interrupt controller
  consoleinit();   // I/O devices & their interrupts
  uartinit();      // serial port
  pinit();         // process table
  tvinit();        // trap vectors
  binit();         // buffer cache
  fileinit();      // file table
  ideinit();       // disk
  if(!ismp)
    timerinit();   // uniprocessor timer
  startothers();   // start other processors
  kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers()
  userinit();      // first user process
  // Finish setting up this processor in mpmain.
  mpmain();
}
Example #5
0
File: main.c Project: hosanli/os4
// 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();
}
Example #6
0
// Bootstrap processor starts running C code here.
// Allocate a real stack and switch to it, first
// doing some setup required for memory allocator to work.
int
main(void)
{
  kvmalloc();      // kernel page table
  mpinit();        // collect info about this machine
  lapicinit(mpbcpu());
  seginit();       // set up segments
  cprintf("\ncpu%d: starting xv6\n\n", cpu->id);
  picinit();       // interrupt controller
  ioapicinit();    // another interrupt controller
  consoleinit();   // I/O devices & their interrupts
  uartinit();      // serial port
  pinit();         // process table
  tvinit();        // trap vectors
  binit();         // buffer cache
  fileinit();      // file table
  iinit();         // inode cache
  ideinit();       // disk
  if(!ismp)
    timerinit();   // uniprocessor timer
  startothers();    // start other processors (must come before kinit)
  kinit();         // initialize memory allocator
  userinit();      // first user process  (must come after kinit)
  // Finish setting up this processor in mpmain.
  mpmain();
}
Example #7
0
// Bootstrap processor starts running C code here.
// Allocate a real stack and switch to it, first
// doing some setup required for memory allocator to work.
int
main(void)
{
    monitor_clear ();

    // Print basic system information.
    cprintf ("Ensidia\n\n");
    cprintf ("Copyright (c) 2013-2014 Fotis Koutoulakis\n");
    cprintf ("Based on xv6 by Russ Cox et al, at MIT CSAIL\n");

    kinit1(end, P2V(4*1024*1024)); // phys page allocator
    kvmalloc();      // kernel page table
    mpinit();        // collect info about this machine
    lapicinit();
    seginit();       // set up segments
    cprintf("\ncpu%d: starting xng kernel\n\n", cpu->id);
    picinit();       // interrupt controller
    ioapicinit();    // another interrupt controller
    consoleinit();   // I/O devices & their interrupts
    uartinit();      // serial port
    pinit();         // process table
    tvinit();        // trap vectors
    binit();         // buffer cache
    fileinit();      // file table
    iinit();         // inode cache
    ideinit();       // disk
    if(!ismp)
        timerinit();   // uniprocessor timer
    startothers();   // start other processors
    kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers()
    userinit();      // first user process
    // Finish setting up this processor in mpmain.
    mpmain();
}
Example #8
0
/*int main(void){*/
void kmain(void){
//  vga_init();
//  puts((uint8_t*)"Hello kernel world!\n");
  /*do some work here, like initialize timer or paging*/
  kinit1(end, P2V(4*1024*1024)); // phys page allocator
  kvmalloc();      // kernel page table
  mpinit();        // collect info about this machine
  lapicinit();
//  gdt_descriptor();
//  puts((uint8_t*)"GDT initialized...\n");
//  idt_descriptor();
//  puts((uint8_t*)"IDT initialized...\n");
//  cprintf("IDT initialized...\n");
  seginit();       // set up segments
  cprintf("\ncpu%d: starting xv6\n\n", cpu->id);
  picinit();       // interrupt controller
  ioapicinit();    // another interrupt controller
  consoleinit();   // I/O devices & their interrupts
  uartinit();      // serial port
  pinit();         // process table
  tvinit();        // trap vectors
  binit();         // buffer cache
  fileinit();      // file table
  ideinit();       // disk
  if(!ismp)
    timerinit();   // uniprocessor timer
  startothers();   // start other processors
  kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers()
  userinit();      // first user process
  // Finish setting up this processor in mpmain.
  mpmain();
}
Example #9
0
/* ----------------------------------------------------- */
int main(int argc,char* argv[])
{
	signal(SIGINT, fs_sigint_handler); 
	fs_set_limit_attr();
	if (mpinit(0, 50)) return -1;

	voolefs.tc = 10;
	voolefs.tpool = threadpool_init(voolefs.tc ,10);
	voolefs.cinc  = 8;
	voolefs.phost = mpcalloc(sizeof(struct host));
	voolefs.phost->host = inet_addr("123.125.149.11");
	voolefs.phost->port = htons(4869);
	voolefs.hostc = 1; 
	voolefs.semc = 20;

	char* pmpoint = fs_create_mountpoint();
	struct fuse_args args = FUSE_ARGS_INIT(argc, argv);	
	char *fsname =(char*)mpcalloc(256);
	sprintf(fsname,"-osubtype=%s,fsname=%s",argv[0],pmpoint);
	mpfree(pmpoint);
	int ret = fuse_opt_parse(&args, NULL,NULL,NULL /*&voolefs, voolefs_opts, fs_opt_proc*/);
	int multithreaded = 0;
	int foreground = 0;
	ret = fuse_opt_insert_arg(&args,1,fsname);
/*	if (fuse_is_lib_option("ac_attr_timeout="))
		fuse_opt_insert_arg(&args, 1, "-oauto_cache,ac_attr_timeout=0");
*/	ret = fuse_parse_cmdline(&args, &voolefs.mountpoint, &multithreaded, &foreground);
	voolefs.ch = fuse_mount(voolefs.mountpoint, &args);
//	event_reinit(voolefs.ev_base);
	if(voolefs.ch)
	{
		ret = fcntl(fuse_chan_fd(voolefs.ch), F_SETFD, FD_CLOEXEC);
		voolefs.fuse = fuse_new(voolefs.ch,&args,&oper,sizeof(struct fuse_operations),NULL);
		if (voolefs.fuse == NULL)
		{
			fs_cleanup();
			abort();
		}
		fs_daemonize(0);
		voole_net_create();
/*		if( multithreaded)
			ret = fuse_loop_mt(voolefs.fuse);
		else
*/			ret = fuse_loop(voolefs.fuse);
	}
	if( voolefs.fuse )
		fuse_remove_signal_handlers(fuse_get_session(voolefs.fuse));
	mpfree(fsname);
	if( voolefs.peventbase )
	{
		event_base_free(voolefs.peventbase);
		voolefs.peventbase = NULL;
	}
	return ret;
}
Example #10
0
// Bootstrap processor starts running C code here.
// Allocate a real stack and switch to it, first
// doing some setup required for memory allocator to work.
int
main(void)
{
  kinit1(end, P2V(4*1024*1024)); // phys page allocator
  kvmalloc();      // kernel page table
  mpinit();        // collect info about this machine
  lapicinit();
  seginit();       // set up segments
  cprintf("\ncpu%d: starting xv6\n\n", cpu->id);
  picinit();       // interrupt controller
  ioapicinit();    // another interrupt controller
  consoleinit();   // I/O devices & their interrupts
  uartinit();      // serial port
    initGraphMode();
    initDom();
    tryOnce();
    toggleOn();
  pinit();         // process table
    toggleOn();
  tvinit();        // trap vectors
    toggleOn();
  binit();         // buffer cache
    toggleOn();
  fileinit();      // file table
    toggleOn();
  iinit();         // inode cache
    toggleOn();
  ideinit();       // disk
    toggleOn();
  if(!ismp)
    timerinit();   // uniprocessor timer

    toggleOn();
  startothers();   // start other processors
    toggleOn();
  kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers()
    toggleOn();
	
  txt_initLock();
  mouseEnable();

  initProcessMsgMap();


  userinit();      // first user process
    toggleOn();
    endToggle();
  // Finish setting up this processor in mpmain.
  mpmain();
}
Example #11
0
// Os procedimentos de inicialização começam a executar o 
// código .C a partir daqui.
// Aloca uma pilha real e troca para ela, primeiro fazendo
// algumas configurações necessárias par o alocador de memória funcionar.
int main(void) {
  kinit1(end, P2V(4*1024*1024)); // alocador de páginas de memória física
  kvmalloc();      // tabela de páginas do kernel
  mpinit();        // detecta outros processadores
  lapicinit();     // controlador de interrupções
  seginit();       // descritores de segmentos
  picinit();       // desabilita pic
  ioapicinit();    // outro controlador de interrupções
  consoleinit();   // console hardware
  uartinit();      // porta serial
  pinit();         // tabela de processos
  tvinit();        // vetores trap
  binit();         // buffer cache
  fileinit();      // tabela de arquivo
  ideinit();       // disco 
  startothers();   // inicia outros processadores
  kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // deve vir após startothers()
  userinit();      // primeiro processo no modo usuário
  mpmain();        // encerra esta configuração de processadores
}
Example #12
0
// Bootstrap processor starts running C code here.
// Allocate a real stack and switch to it, first
// doing some setup required for memory allocator to work.
int
main(void)
{
  kinit1(end, P2V(4*1024*1024)); // phys page allocator
  kvmalloc();      // kernel page table
  mpinit();        // detect other processors
  lapicinit();     // interrupt controller
  seginit();       // segment descriptors
  picinit();       // disable pic
  ioapicinit();    // another interrupt controller
  consoleinit();   // console hardware
  uartinit();      // serial port
  pinit();         // process table
  shminit();       // shared memory
  tvinit();        // trap vectors
  binit();         // buffer cache
  fileinit();      // file table
  ideinit();       // disk 
  startothers();   // start other processors
  kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers()
  userinit();      // first user process
  mpmain();        // finish this processor's setup
}
Example #13
0
static void
pcmpinit(void)
{
	uchar *p, *e;
	Apic *apic;
	void *va;

	/*
	 * Map the local APIC.
	 */
	va = vmap(pcmp->lapicbase, 1024);

	print("LAPIC: %.8lux %#p\n", pcmp->lapicbase, va);
	if(va == nil)
		panic("pcmpinit: cannot map lapic %.8lux", pcmp->lapicbase);

	p = ((uchar*)pcmp)+PCMPsz;
	e = ((uchar*)pcmp)+pcmp->length;
	if(getconf("*dumpmp") != nil)
		dumpmp(p, e);
	if(getconf("*mp") != nil)
		mpoverride(&p, &e);

	/*
	 * Run through the table saving information needed for starting
	 * application processors and initialising any I/O APICs. The table
	 * is guaranteed to be in order such that only one pass is necessary.
	 */
	while(p < e) switch(*p){
	default:
		print("pcmpinit: unknown PCMP type 0x%uX (e-p 0x%luX)\n",
			*p, e-p);
		while(p < e){
			print("%uX ", *p);
			p++;
		}
		break;

	case PcmpPROCESSOR:
		if(apic = mkprocessor((PCMPprocessor*)p)){
			apic->addr = va;
			apic->paddr = pcmp->lapicbase;
		}
		p += PCMPprocessorsz;
		continue;

	case PcmpBUS:
		mkbus((PCMPbus*)p);
		p += PCMPbussz;
		continue;

	case PcmpIOAPIC:
		if(apic = mkioapic((PCMPioapic*)p))
			ioapicinit(apic, apic->apicno);
		p += PCMPioapicsz;
		continue;

	case PcmpIOINTR:
		mkiointr((PCMPintr*)p);
		p += PCMPintrsz;
		continue;

	case PcmpLINTR:
		mklintr((PCMPintr*)p);
		p += PCMPintrsz;
		continue;
	}

	/*
	 * Ininitalize local APIC and start application processors.
	 */
	mpinit();
}
Example #14
0
// Bootstrap processor starts running C code here.
// Allocate a real stack and switch to it, first
// doing some setup required for memory allocator to work.
int
main(void)
{
	monitor_clear();
	xylos_logo();

	kinit1(end, P2V(4 * 1024 * 1024)); // phys page allocator, 16MB for kernel
	kvmalloc();      // kernel page table
	mpinit();        // collect info about this machine
	lapicinit();
	seginit();       // set up segments

	cprintf("Initializing interrupts...             ");
	init_generic_irq_table();
	picinit();       // interrupt controller
	ioapicinit();    // another interrupt controller
	cprintf_color(COLOR_BLACK, COLOR_LIGHT_GREEN, false, "done\n");

	cprintf("Initializing console and serial...     ");
	consoleinit();   // I/O devices & their interrupts
	uartinit();      // serial port
	cprintf_color(COLOR_BLACK, COLOR_LIGHT_GREEN, false, "done\n");

	cprintf("Setting up swap space disk...          ");
	swapinit();
	cprintf_color(COLOR_BLACK, COLOR_LIGHT_GREEN, false, "done\n");

	cprintf("Initializing tasking...                ");
	pinit();         // process table
	tvinit();        // trap vectors
	binit();         // buffer cache
	cprintf_color(COLOR_BLACK, COLOR_LIGHT_GREEN, false, "done\n");

	cprintf("Initializing pipe IPC...               ");
	init_pipe_ipc_system();
	if(pipe_ipc_sanitycheck() == 0) {
		cprintf_color(COLOR_BLACK, COLOR_LIGHT_GREEN, false, "done\n");
	}

	cprintf("Initializing direct IPC...             ");
	init_direct_ipc_table();
	if(direct_ipc_sanitycheck() == 0) {
		cprintf_color(COLOR_BLACK, COLOR_LIGHT_GREEN, false, "done\n");
	}

	cprintf("Mounting root filesystem...            ");
	fileinit();      // file table
	ideinit();       // disk
	cprintf_color(COLOR_BLACK, COLOR_LIGHT_GREEN, false, "done\n");

	if(!ismp) {
		cprintf("Starting up uniprocessor CPU...        ");
		timerinit();   // uniprocessor timer
		cprintf_color(COLOR_BLACK, COLOR_LIGHT_GREEN, false, "done\n");
	}

	if(ismp) {
		if(ncpu > 1) {
			cprintf("Starting up %d CPU cores...             ", ncpu);
		} else {
			cprintf("Starting up %d CPU core...              ", ncpu);
		}
	}

	startothers();   // start other processors
	kinit2(P2V(4 * 1024 * 1024), P2V(PHYSTOP)); // 16MB to PHYSTOP [234MB]

	if(ismp) {
		cprintf_color(COLOR_BLACK, COLOR_LIGHT_GREEN, false, "done\n");
	}

	// detects and starts km drivers
	auto_enable_nic();

	// first user process
	userinit();

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


}