// 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(); }
void kmain (void) { cpu = &cpus[0]; uart_init (P2V(UART0)); init_vmm (); kpt_freerange (align_up(&end, PT_SZ), P2V_WO(INIT_KERNMAP)); paging_init (INIT_KERNMAP, PHYSTOP); kmem_init (); kmem_init2(P2V(INIT_KERNMAP), P2V(PHYSTOP)); trap_init (); // vector table and stacks for models gic_init(P2V(VIC_BASE)); // arm v2 gic init uart_enable_rx (); // interrupt for uart consoleinit (); // console pinit (); // process (locks) binit (); // buffer cache fileinit (); // file table iinit (); // inode cache ideinit (); // ide (memory block device) #ifdef INCLUDE_REMOVED timer_init (HZ); // the timer (ticker) #endif sti (); userinit(); // first user process scheduler(); // start running processes }
// 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(); }
// 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(); }
// 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(); }
// 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(); }
// 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(); }
// 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(); }
/*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(); }
// 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(); }
// 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 }
// 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 }
// 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(); }
int main(int _argc, char **_argv) { int framecount=0; int sramcount=0; argc=_argc, argv=_argv; defaultExceptionHandler(); fifoSendValue32(FIFO_USER_06, (u32)ipc_region); DS_init(); //DS init. #ifndef ROM_EMBEDED active_interface = fatInitDefault(); //init file operations to your external card. initNiFi(); #endif EMU_Init(); //emulation init. irqSet(IRQ_VBLANK, vblankinterrupt); irqEnable(IRQ_HBLANK); //fifoSetValue32Handler(FIFO_USER_06, aliveinterrupt, 0); //fifoSetValue32Handler(FIFO_USER_05, reg4015interrupt, 0); IPC_ALIVE = 0; IPC_APUIRQ = 0; IPC_REG4015 = 0; consoleinit(); //init subscreen to show chars. crcinit(); //init the crc table. //pre-alocate memory.... //IPC_FILES = malloc(MAXFILES * 256 + MAXFILES * 4); //IPC_ROM = malloc(ROM_MAX_SIZE); #ifndef ROM_EMBEDED if(!bootext()) { //chdir("/"); do_rommenu(); //show a menu selecting rom files. } #else do_romebd(); #endif //__emuflags |= PALSYNC; while(1) { // main loop to do the emulation framecount++; if(__emuflags & PALTIMING && global_playcount == 0) { framecount--; } if(debuginfo[VBLS]>59) { debuginfo[VBLS]-=60; debuginfo[1] = debuginfo[0]; debuginfo[0] = 0; debuginfo[FPS]=framecount; framecount=0; } scanKeys(); IPC_KEYS = keysCurrent(); //change nsf states if(__emuflags & NSFFILE) { static int oldkey = 0; int keydown = IPC_KEYS & (~oldkey); oldkey = IPC_KEYS; if(keydown & KEY_LEFT) { if(__nsfsongno == 0) { __nsfsongno = nsfheader.TotalSong-1; } else { __nsfsongno--; } } if(keydown & KEY_RIGHT) { if(++__nsfsongno > nsfheader.TotalSong-1) { __nsfsongno = 0; } } if(keydown & KEY_UP) { __nsfplay = 1; __nsfinit = 1; } if(keydown & KEY_DOWN) { __nsfplay = 0; Sound_reset(); } } do_shortcuts(); if((__emuflags & AUTOSRAM)) { if(__emuflags & NEEDSRAM) { sramcount = 1; __emuflags&=~NEEDSRAM; } if(sramcount > 0) sramcount++; if(sramcount > 120) { //need auto save for sram. sramcount = 0; save_sram(); } } touch_update(); // do menu functions. do_menu(); //do control menu. do_multi(); if(nifi_stat == 0 || nifi_stat >= 5) play(); //emulate a frame of the NES game. else swiWaitForVBlank(); } }