int assemble(char *file) { char ofile[100], incfile[20], *p; int i, of; strcpy(ofile, file); if(p = strrchr(ofile, pathchar())) { include[0] = ofile; *p++ = 0; } else p = ofile; if(outfile == 0) { outfile = p; if(p = strrchr(outfile, '.')) if(p[1] == 's' && p[2] == 0) p[0] = 0; p = strrchr(outfile, 0); p[0] = '.'; p[1] = thechar; p[2] = 0; } p = getenv("INCLUDE"); if(p) { setinclude(p); } else { if(systemtype(Plan9)) { sprint(incfile,"/%s/include", thestring); setinclude(strdup(incfile)); } } of = mycreat(outfile, 0664); if(of < 0) { yyerror("%ca: cannot create %s", thechar, outfile); errorexit(); } Binit(&obuf, of, OWRITE); pass = 1; nosched = 0; pinit(file); for(i=0; i<nDlist; i++) dodefine(Dlist[i]); yyparse(); if(nerrors) { cclean(); return nerrors; } pass = 2; nosched = 0; outhist(); pinit(file); for(i=0; i<nDlist; i++) dodefine(Dlist[i]); yyparse(); cclean(); return nerrors; }
int assemble(char *file) { char *ofile, *p; int i, of; ofile = alloc(strlen(file)+3); // +3 for .x\0 (x=thechar) strcpy(ofile, file); p = utfrrune(ofile, pathchar()); if(p) { include[0] = ofile; *p++ = 0; } else p = ofile; if(outfile == 0) { outfile = p; if(outfile){ p = utfrrune(outfile, '.'); if(p) if(p[1] == 's' && p[2] == 0) p[0] = 0; p = utfrune(outfile, 0); p[0] = '.'; p[1] = thechar; p[2] = 0; } else outfile = "/dev/null"; } of = create(outfile, OWRITE, 0664); if(of < 0) { yyerror("%ca: cannot create %s", thechar, outfile); errorexit(); } Binit(&obuf, of, OWRITE); pass = 1; pinit(file); Bprint(&obuf, "go object %s %s %s\n", getgoos(), thestring, getgoversion()); for(i=0; i<nDlist; i++) dodefine(Dlist[i]); yyparse(); if(nerrors) { cclean(); return nerrors; } Bprint(&obuf, "\n!\n"); pass = 2; outhist(); pinit(file); for(i=0; i<nDlist; i++) dodefine(Dlist[i]); yyparse(); cclean(); return nerrors; }
// 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) { 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(); }
ENTRYPOINT void init_providence(ModeInfo *mi) { providencestruct *mp; if(!providence) { if((providence = (providencestruct *) calloc(MI_NUM_SCREENS(mi), sizeof (providencestruct))) == NULL) return; } mp = &providence[MI_SCREEN(mi)]; mp->trackball = gltrackball_init (); mp->position0[0] = 1; mp->position0[1] = 5; mp->position0[2] = 1; mp->position0[3] = 1; mp->camera_velocity = -8.0; mp->mono = MI_IS_MONO(mi); mp->wire = MI_IS_WIREFRAME(mi); /* make multiple screens rotate at slightly different rates. */ mp->theta_scale = 0.7 + frand(0.6); if((mp->glx_context = init_GL(mi)) != NULL) { reshape_providence(mi, MI_WIDTH(mi), MI_HEIGHT(mi)); glDrawBuffer(GL_BACK); pinit(mp); } else MI_CLEARWINDOW(mi); }
ENTRYPOINT void init_providence(ModeInfo *mi) { providencestruct *mp; MI_INIT(mi, providence); mp = &providence[MI_SCREEN(mi)]; mp->trackball = gltrackball_init (False); mp->position0[0] = 1; mp->position0[1] = 5; mp->position0[2] = 1; mp->position0[3] = 1; mp->camera_velocity = -8.0; mp->mono = MI_IS_MONO(mi); mp->wire = MI_IS_WIREFRAME(mi); # ifdef HAVE_JWZGLES /* #### glPolygonMode other than GL_FILL unimplemented */ mp->wire = 0; # endif /* make multiple screens rotate at slightly different rates. */ mp->theta_scale = 0.7 + frand(0.6); if((mp->glx_context = init_GL(mi)) != NULL) { reshape_providence(mi, MI_WIDTH(mi), MI_HEIGHT(mi)); /* glDrawBuffer(GL_BACK); */ pinit(mp); } else MI_CLEARWINDOW(mi); }
/*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(); }
ENTRYPOINT void init_boxed(ModeInfo * mi) { int screen = MI_SCREEN(mi); /* Colormap cmap; */ /* Boolean rgba, doublebuffer, cmap_installed; */ boxedstruct *gp; MI_INIT(mi, boxed, free_boxed); gp = &boxed[screen]; gp->window = MI_WINDOW(mi); if ((gp->glx_context = init_GL(mi)) != NULL) { reshape_boxed(mi, MI_WIDTH(mi), MI_HEIGHT(mi)); glDrawBuffer(GL_BACK); if (!glIsList(gp->listobjects)) { gp->listobjects = glGenLists(3); gp->gllists[0] = 0; gp->gllists[1] = 0; gp->gllists[2] = 0; } pinit(mi); } else { MI_CLEARWINDOW(mi); } }
// 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) { 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 init_morph3d(ModeInfo * mi) { morph3dstruct *mp; if (morph3d == NULL) { if ((morph3d = (morph3dstruct *) calloc(MI_NUM_SCREENS(mi), sizeof (morph3dstruct))) == NULL) return; } mp = &morph3d[MI_SCREEN(mi)]; mp->step = NRAND(90); mp->VisibleSpikes = 1; if ((mp->glx_context = init_GL(mi)) != NULL) { reshape_morph3d(mi, MI_WIDTH(mi), MI_HEIGHT(mi)); glDrawBuffer(GL_BACK); mp->object = MI_COUNT(mi); if (mp->object <= 0 || mp->object > 5) mp->object = NRAND(5) + 1; pinit(mi); } else { MI_CLEARWINDOW(mi); } }
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 }
static void GLUTCALLBACK key( unsigned char k, int x, int y ) { (void) x; (void) y; switch (k) { case '1': object=1; break; case '2': object=2; break; case '3': object=3; break; case '4': object=4; break; case '5': object=5; break; case ' ': mono^=1; break; case 13: smooth^=1; break; case 'f': { sleepTime = sleepTime * 9 / 10; break; } case 's': { sleepTime = sleepTime * 11 / 10; break; } case 27: exit(0); } pinit(); }
// 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(); }
ENTRYPOINT void init_stairs (ModeInfo * mi) { int screen = MI_SCREEN(mi); stairsstruct *sp; if (stairs == NULL) { if ((stairs = (stairsstruct *) calloc(MI_NUM_SCREENS(mi), sizeof (stairsstruct))) == NULL) return; } sp = &stairs[screen]; sp->step = 0.0; sp->rotating = 0; sp->sphere_position = NRAND(NPOSITIONS); sp->sphere_tick = 0; if ((sp->glx_context = init_GL(mi)) != NULL) { reshape_stairs(mi, MI_WIDTH(mi), MI_HEIGHT(mi)); glDrawBuffer(GL_BACK); if (!glIsList(sp->objects)) sp->objects = glGenLists(1); pinit(mi); } else { MI_CLEARWINDOW(mi); } sp->trackball = gltrackball_init (False); }
// 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(); }
ENTRYPOINT void init_moebius (ModeInfo * mi) { moebiusstruct *mp; if (moebius == NULL) { if ((moebius = (moebiusstruct *) calloc(MI_NUM_SCREENS(mi), sizeof (moebiusstruct))) == NULL) return; } mp = &moebius[MI_SCREEN(mi)]; mp->step = NRAND(90); mp->ant_position = NRAND(90); { double rot_speed = 0.3; mp->rot = make_rotator (rot_speed, rot_speed, rot_speed, 1, 0, True); mp->trackball = gltrackball_init (); } if ((mp->glx_context = init_GL(mi)) != NULL) { reshape_moebius(mi, MI_WIDTH(mi), MI_HEIGHT(mi)); glDrawBuffer(GL_BACK); pinit(mi); } else { MI_CLEARWINDOW(mi); } }
static void key( unsigned char k, int x, int y ) { (void) x; (void) y; switch (k) { case '1': object=1; break; case '2': object=2; break; case '3': object=3; break; case '4': object=4; break; case '5': object=5; break; case ' ': mono^=1; break; case 's': smooth^=1; break; case 'a': anim^=1; if (anim) glutIdleFunc( idle_ ); else glutIdleFunc(NULL); break; case 27: exit(0); } pinit(); glutPostRedisplay(); }
ENTRYPOINT void init_antspotlight(ModeInfo *mi) { double rot_speed = 0.3; antspotlightstruct *mp; if(!antspotlight) { if((antspotlight = (antspotlightstruct *) calloc(MI_NUM_SCREENS(mi), sizeof (antspotlightstruct))) == NULL) return; } mp = &antspotlight[MI_SCREEN(mi)]; mp->rot = make_rotator (rot_speed, rot_speed, rot_speed, 1, 0, True); mp->trackball = gltrackball_init (); if((mp->glx_context = init_GL(mi)) != NULL) { reshape_antspotlight(mi, MI_WIDTH(mi), MI_HEIGHT(mi)); glDrawBuffer(GL_BACK); pinit(); } else MI_CLEARWINDOW(mi); glGenTextures(1, &mp->screentexture); glBindTexture(GL_TEXTURE_2D, mp->screentexture); get_snapshot(mi); build_ant(mp); mp->mono = MI_IS_MONO(mi); mp->wire = MI_IS_WIREFRAME(mi); mp->boardsize = 8.0; mp->mag = 1; }
// 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(); }
ENTRYPOINT void change_providence(ModeInfo * mi) { providencestruct *mp = &providence[MI_SCREEN(mi)]; if (!mp->glx_context) return; glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(mp->glx_context)); pinit(); }
ENTRYPOINT void change_antinspect(ModeInfo * mi) { antinspectstruct *mp = &antinspect[MI_SCREEN(mi)]; if (!mp->glx_context) return; glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(mp->glx_context)); pinit(); }
ENTRYPOINT void change_cage (ModeInfo * mi) { cagestruct *cp = &cage[MI_SCREEN(mi)]; if (!cp->glx_context) return; glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(cp->glx_context)); pinit(mi); }
ENTRYPOINT void change_pipes (ModeInfo * mi) { pipesstruct *pp = &pipes[MI_SCREEN(mi)]; if (!pp->glx_context) return; glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(pp->glx_context)); pinit(mi, 1); }
ENTRYPOINT void change_stairs (ModeInfo * mi) { stairsstruct *sp = &stairs[MI_SCREEN(mi)]; if (!sp->glx_context) return; glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(sp->glx_context)); pinit(); }
ENTRYPOINT void change_moebius (ModeInfo * mi) { moebiusstruct *mp = &moebius[MI_SCREEN(mi)]; if (!mp->glx_context) return; glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(mp->glx_context)); pinit(mi); }
void change_morph3d(ModeInfo * mi) { morph3dstruct *mp = &morph3d[MI_SCREEN(mi)]; if (!mp->glx_context) return; mp->object = (mp->object) % 5 + 1; pinit(mi); }
int main() { pinit(); finit(); while(1) { //mputs("ip = "); //mputs(itoa(disk[IP])); execute(IP); //mputs(" rstack = "); //puts(itoa(*rsp - (DSIZE-(RSSIZE+STSIZE+1)))); //stat(); } }
void init_gasket(ModeInfo *mi) { int screen = MI_SCREEN(mi); gasketstruct *gp; if (gasket == NULL) { if ((gasket = (gasketstruct *) calloc(MI_NUM_SCREENS(mi), sizeof (gasketstruct))) == NULL) return; } gp = &gasket[screen]; gp->window = MI_WINDOW(mi); gp->rotx = FLOATRAND(1.0) * RANDSIGN(); gp->roty = FLOATRAND(1.0) * RANDSIGN(); gp->rotz = FLOATRAND(1.0) * RANDSIGN(); /* bell curve from 0-1.5 degrees, avg 0.75 */ gp->dx = (FLOATRAND(1) + FLOATRAND(1) + FLOATRAND(1)) / (360*2); gp->dy = (FLOATRAND(1) + FLOATRAND(1) + FLOATRAND(1)) / (360*2); gp->dz = (FLOATRAND(1) + FLOATRAND(1) + FLOATRAND(1)) / (360*2); gp->d_max = gp->dx * 2; gp->ddx = 0.00006 + FLOATRAND(0.00003); gp->ddy = 0.00006 + FLOATRAND(0.00003); gp->ddz = 0.00006 + FLOATRAND(0.00003); gp->ddx = 0.00001; gp->ddy = 0.00001; gp->ddz = 0.00001; intens_factor = intensity / 65536000.0; gp->ncolors = 255; gp->colors = (XColor *) calloc(gp->ncolors, sizeof(XColor)); make_smooth_colormap (mi, None, gp->colors, &gp->ncolors, False, (Bool *) NULL); if ((gp->glx_context = init_GL(mi)) != NULL) { reshape_gasket(mi, MI_WIDTH(mi), MI_HEIGHT(mi)); pinit(mi); } else { MI_CLEARWINDOW(mi); } }
// 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(); }