Ejemplo n.º 1
0
void
main(void)
{
	cgapost(0);
	mach0init();
	options();
	ioinit();
	i8250console();
	quotefmtinstall();
	screeninit();

	print("\nPlan 9\n");

	trapinit0();
	mmuinit0();

	kbdinit();
	i8253init();
	cpuidentify();
	meminit();
	confinit();
	archinit();
	if(!isa20on())
		panic("bootstrap didn't leave a20 address line enabled");
	xinit();
	if(i8237alloc != nil)
		i8237alloc();
	trapinit();
	printinit();
	cpuidprint();
	mmuinit();
	fpsavealloc();
	if(arch->intrinit)	/* launches other processors on an mp */
		arch->intrinit();
	timersinit();
	mathinit();
	kbdenable();
	if(arch->clockenable)
		arch->clockenable();
	procinit0();
	initseg();
	if(delaylink){
		bootlinks();
		pcimatch(0, 0, 0);
	}else
		links();
	conf.monitor = 1;
	chandevreset();
	cgapost(0xcd);

	pageinit();
	i8253link();
	swapinit();
	userinit();
	active.thunderbirdsarego = 1;

	cgapost(0x99);
	schedinit();
}
Ejemplo n.º 2
0
int	main(void) {
	terminit();
	screeninit();
	
	//write(1, "hello", 5);
	sleep(2);

	return 0;
}
Ejemplo n.º 3
0
void
main(void)
{
	extern char edata[], end[];
	uint rev;

	okay(1);
	m = (Mach*)MACHADDR;
	memset(edata, 0, end - edata);	/* clear bss */
	machinit();
	mmuinit1();

	optionsinit("/boot/boot boot");
	quotefmtinstall();
	
	ataginit((Atag*)BOOTARGS);
	confinit();		/* figures out amount of memory */
	xinit();
	uartconsinit();
	screeninit();

	print("\nPlan 9 from Bell Labs\n");
	rev = getfirmware();
	print("firmware: rev %d\n", rev);
	if(rev < Minfirmrev){
		print("Sorry, firmware (start.elf) must be at least rev %d (%s)\n",
			Minfirmrev, Minfirmdate);
		for(;;)
			;
	}
	trapinit();
	clockinit();
	printinit();
	timersinit();
	cpuidprint();
	archreset();

	procinit0();
	initseg();
	links();
	chandevreset();			/* most devices are discovered here */
	pageinit();
	swapinit();
	userinit();
	gpiomeminit();
	schedinit();
	assert(0);			/* shouldn't have returned */
}
Ejemplo n.º 4
0
static long
screenwrite(Chan *c, void *a, long n, vlong off)
{
	switch ((ulong)c->qid.path) {
	case Qdss:
		if(off)
			error(Ebadarg);
		n = settingswrite(&oscreen, a);
		if (n < 0)
			error(Ebadctl);
		screeninit();
		return n;
	default:
		error(Egreg);
	}
	return 0;
}
Ejemplo n.º 5
0
void
main(void)
{
	hwrpb = (Hwrpb*)0x10000000;
	hwrpb = (Hwrpb*)(KZERO|hwrpb->phys);
	arginit();
	machinit();
	options();
	ioinit();
	clockinit();
	confinit();
	archinit();
	xinit();
	memholes();
	if(i8237alloc != nil)
		i8237alloc();
	mmuinit();
	if(arch->coreinit)
		arch->coreinit();
	trapinit();
	screeninit();
	printinit();
	/* it's now safe to print */
	/* dumpopts();			/* DEBUG */
	i8250console();
	quotefmtinstall();
	print("\nPlan 9\n");

	cpuidprint();
	if(arch->corehello)
		arch->corehello();

	procinit0();
	initseg();
	timersinit();
	links();
	chandevreset();
	pageinit();
	swapinit();
	savefpregs(&initfp);
initfp.fpstatus = 0x68028000;
	userinit();
	schedinit();
}
Ejemplo n.º 6
0
Archivo: main.c Proyecto: 8l/inferno
void
main(void)
{


	machinit();
	trapinit();
	quotefmtinstall();
	confinit();
	xinit();
	mmuinit();
	intrinit();
	clockinit();
	printinit();
	screeninit();
	ioinit();
	doc("ioinit..."); 
	ns16552install();
	poolsizeinit();
	doc("ns16552install...");
	kbdinit();
	doc("kbdinit...");
	cacheinit();
	doc("cacheinit...");
	procinit();
	doc("procinit...");
	putphys(MID, 0x1F<<16);	/* enable arbitration */
	links();
	doc("links");
	chandevreset();
	doc("chandevreset...");

	print("\nInferno Operating System\n");
	print("%s-%s \n\n",VERSION, conffile);
	print("JIT Compilation Mode = %d\n",cflag);

	userinit();
	doc("userinit...");

	 /* clear pending processor interrupts */
	putphys(PROCINTCLR, (~0<<17)|(1<<15));
	print("berore schedinit\n");
	schedinit();
}
Ejemplo n.º 7
0
Archivo: main.c Proyecto: 8l/inferno
void
main(void)
{
	machinit();
	options();
	archinit();
	quotefmtinstall();
	confinit();
	cpminit();
	xinit();
	poolsizeinit();
	trapinit();
	mmuinit();
	printinit();
	uartinstall();
	serialconsole();
	doc("screeninit");
	screeninit();
	doc("kbdinit");
	kbdinit();
	doc("clockinit");
	clockinit();
	doc("procinit");
	procinit();
	cpuidprint();
	doc("links");
	links();
	doc("chandevreset");
	chandevreset();

	eve = strdup("inferno");

	print("\nInferno %s\n", VERSION);
	print("Vita Nuova\n");
	print("conf %s (%lud) jit %d\n\n",conffile, kerndate, cflag);

	doc("userinit");
	userinit();
	doc("schedinit");
	schedinit();
}
Ejemplo n.º 8
0
void
main(void)
{
	mmuinvalidate();

	/* zero out bss */
	memset(edata, 0, end-edata);

	/* point to Mach structure */
	m = (Mach*)MACHADDR;
	memset(m, 0, sizeof(Mach));
	m->ticks = 1;

	active.machs = 1;

	rs232power(1);
	quotefmtinstall();
	iprint("\nPlan 9 bitsy kernel\n");
	confinit();
	xinit();
	mmuinit();
	machinit();
	trapinit();
	sa1110_uartsetup(1);
	dmainit();
	screeninit();
	printinit();	/* from here on, print works, before this we need iprint */
	clockinit();
	procinit0();
	initseg();
	links();
	chandevreset();
	pageinit();
	swapinit();
	userinit();
	powerinit();
	schedinit();
}
Ejemplo n.º 9
0
void cbzone_main(
     int argc,
     const char* const argv[])
{
#ifdef DEVELOPER
  int passes = 0;
  struct timeval game_start;
  struct timeval game_end;
#endif //DEVELOPER

  gprinqconfig(&argc, argv);
  limit = opt->delay * 1.2e4;

  /* now that we have parsed the options, we know how large to */
  /* make the world.  Use calloc here as most of the array     */
  /* should start off 0.                                       */

  pl = o = (Genericp) calloc(opt->mobjects,sizeof(Generic));

  if (o == NULL) {
    printf("Malloc failed...trying to create too many objects?\n");
#ifdef WIN32
     return;
#else //X11
     myexit(1);
#endif
  }

  initarray(o);                         /* prepare the main array */
  srandom(time((long *) 0));            /* start things off randomly */
  screeninit();
  updatedisplay(missilerun, lander, score, opt->numleft, sens, False);
  xhairs(aligned);
  gprinqcursor((Position_t *)position);
  event = gprcondeventwait(&key, (Position_t *)position);
  joystick(position, sens, pl);

  /* place the objects out there to start the game.  if the player is */
  /* is_new, then the objects are placed at a random distance, else   */
  /* the objects get placed on the horizon.                           */

  placeobjects(o, missilerun, score);
  pl->attr &= ~IS_NEW;                  /* now the objects can be */
                                        /* placed at the horizon. */

  /* now calculate ranges to all the objects and translate them */
  /* into a player-centric coordinate system                    */

  pl->ca = cos(pl->azm);
  pl->sa = sin(pl->azm);
  for (g=o+opt->estart; g<o+opt->mobjects; g++)
    if (g->attr & IS_ALIVE) {
      dx = g->x - pl->x;
      dy = g->y - pl->y;
      g->range = sqrt(dx*dx + dy*dy);
      g->proy = -dx * pl->sa + dy * pl->ca;
      g->prox = dx * pl->ca + dy * pl->sa;
    }

  scanner(o);
  drawhorizon(pl->azm);

  /* now the work really starts....we just iterate through */
  /* the following loop until the player dies or quits     */
#ifdef DEVELOPER
  gettimeofday(&game_start, 0);
#endif
}
Ejemplo n.º 10
0
static void
vgactl(Cmdbuf *cb)
{
    int align, i, size, x, y, z;
    char *chanstr, *p;
    ulong chan;
    Cmdtab *ct;
    VGAscr *scr;
    extern VGAdev *vgadev[];
    extern VGAcur *vgacur[];

    scr = &vgascreen[0];
    ct = lookupcmd(cb, vgactlmsg, nelem(vgactlmsg));
    switch(ct->index) {
    case CMhwgc:
        if(strcmp(cb->f[1], "off") == 0) {
            lock(&cursor);
            if(scr->cur) {
                if(scr->cur->disable)
                    scr->cur->disable(scr);
                scr->cur = nil;
            }
            unlock(&cursor);
            return;
        }
        if(strcmp(cb->f[1], "soft") == 0) {
            lock(&cursor);
            swcursorinit();
            if(scr->cur && scr->cur->disable)
                scr->cur->disable(scr);
            scr->cur = &swcursor;
            if(scr->cur->enable)
                scr->cur->enable(scr);
            unlock(&cursor);
            return;
        }
        for(i = 0; vgacur[i]; i++) {
            if(strcmp(cb->f[1], vgacur[i]->name))
                continue;
            lock(&cursor);
            if(scr->cur && scr->cur->disable)
                scr->cur->disable(scr);
            scr->cur = vgacur[i];
            if(scr->cur->enable)
                scr->cur->enable(scr);
            unlock(&cursor);
            return;
        }
        break;

    case CMtype:
        for(i = 0; vgadev[i]; i++) {
            if(strcmp(cb->f[1], vgadev[i]->name))
                continue;
            if(scr->dev && scr->dev->disable)
                scr->dev->disable(scr);
            scr->dev = vgadev[i];
            if(scr->dev->enable)
                scr->dev->enable(scr);
            return;
        }
        break;

    case CMtextmode:
        screeninit();
        return;

    case CMsize:

        x = strtoul(cb->f[1], &p, 0);
        if(x == 0 || x > 10240)
            error(Ebadarg);
        if(*p)
            p++;

        y = strtoul(p, &p, 0);
        if(y == 0 || y > 10240)
            error(Ebadarg);
        if(*p)
            p++;

        z = strtoul(p, &p, 0);

        chanstr = cb->f[2];
        if((chan = strtochan(chanstr)) == 0)
            error("bad channel");

        if(chantodepth(chan) != z)
            error("depth, channel do not match");

        cursoroff(1);
        deletescreenimage();
        if(screensize(x, y, z, chan))
            error(Egreg);
        vgascreenwin(scr);
        resetscreenimage();
        cursoron(1);
        return;

    case CMactualsize:
        if(scr->gscreen == nil)
            error("set the screen size first");

        x = strtoul(cb->f[1], &p, 0);
        if(x == 0 || x > 2048)
            error(Ebadarg);
        if(*p)
            p++;

        y = strtoul(p, nil, 0);
        if(y == 0 || y > 2048)
            error(Ebadarg);

        if(x > scr->gscreen->r.max.x || y > scr->gscreen->r.max.y)
            error("physical screen bigger than virtual");

        physgscreenr = Rect(0,0,x,y);
        scr->gscreen->clipr = physgscreenr;
        return;

    case CMpalettedepth:
        x = strtoul(cb->f[1], &p, 0);
        if(x != 8 && x != 6)
            error(Ebadarg);

        scr->palettedepth = x;
        return;

    case CMdrawinit:
        memimagedraw(scr->gscreen, scr->gscreen->r, memblack, ZP, nil, ZP, S);
        if(scr && scr->dev && scr->dev->drawinit)
            scr->dev->drawinit(scr);
        return;

    case CMlinear:
        if(cb->nf!=2 && cb->nf!=3)
            error(Ebadarg);
        size = strtoul(cb->f[1], 0, 0);
        if(cb->nf == 2)
            align = 0;
        else
            align = strtoul(cb->f[2], 0, 0);
        if(screenaperture(size, align) < 0)
            error("not enough free address space");
        return;
    /*
    	case CMmemset:
    		memset((void*)strtoul(cb->f[1], 0, 0), atoi(cb->f[2]), atoi(cb->f[3]));
    		return;
    */

    case CMblank:
        drawblankscreen(1);
        return;

    case CMunblank:
        drawblankscreen(0);
        return;

    case CMblanktime:
        blanktime = strtoul(cb->f[1], 0, 0);
        return;

    case CMpanning:
        if(strcmp(cb->f[1], "on") == 0) {
            if(scr == nil || scr->cur == nil)
                error("set screen first");
            if(!scr->cur->doespanning)
                error("panning not supported");
            scr->gscreen->clipr = scr->gscreen->r;
            panning = 1;
        }
        else if(strcmp(cb->f[1], "off") == 0) {
            scr->gscreen->clipr = physgscreenr;
            panning = 0;
        } else
            break;
        return;

    case CMhwaccel:
        if(strcmp(cb->f[1], "on") == 0)
            hwaccel = 1;
        else if(strcmp(cb->f[1], "off") == 0)
            hwaccel = 0;
        else
            break;
        return;

    case CMhwblank:
        if(strcmp(cb->f[1], "on") == 0)
            hwblank = 1;
        else if(strcmp(cb->f[1], "off") == 0)
            hwblank = 0;
        else
            break;
        return;
    }

    cmderror(cb, "bad VGA control message");
}
Ejemplo n.º 11
0
void
main() {
	uint j=0,i=0,k=0;
	uint rev;
	ulong pc;

	pc = getpc();
	pl011_addr((void *)pc, 1);
	pl011_puts("Entered main() at ");
	pl011_addr(&main, 0);
	pl011_puts(" with SP=");
	pl011_addr((void *)getsp(), 0);
	pl011_puts(" with SC=");
	pl011_addr((void *)getsc(), 0);
	pl011_puts(" with CPSR=");
	pl011_addr((void *)getcpsr(), 0);
	pl011_puts(" with SPSR=");
	pl011_addr((void *)getspsr(), 1);

	pl011_puts("Clearing Mach:  ");
	memset(m, 0, sizeof(Mach));
	pl011_addr((char *)m,		0); pl011_puts("-");
	pl011_addr((char *)(m+1),	1);

	pl011_puts("Clearing edata: ");
	memset(edata, 0, end-edata);
	pl011_addr((char *)&edata,	0); pl011_puts("-");
	pl011_addr((char *)&end,	1);

	conf.nmach = 1;

	quotefmtinstall();
	confinit();
	mmuinit1();
	xinit();
	poolinit();
	poolsizeinit();
	//uartconsinit();
	screeninit();
	trapinit();
	timersinit();
	clockinit();
	printinit();
	swcursorinit();

	rev = getfirmware();
	print("\nARM %ld MHz id %8.8lux firmware: rev %d, mem: %ld\n"
		,(m->cpuhz+500000)/1000000, getcpuid(), rev, conf.topofmem/MB);
	print("Inferno OS %s Vita Nuova\n", VERSION);
	print("Ported to Raspberry Pi (BCM2835) by LynxLine\n\n");

	procinit();
	links();
	chandevreset();

	eve = strdup("inferno");

	userinit();
	schedinit();

	pl011_puts("to inifinite loop\n\n");
	for (;;);
}
Ejemplo n.º 12
0
void
main(void)
{
	Proc *savup;
	static ulong vfy = Datamagic;
	static char novga[] = "\nno vga; serial console only\n";

	savup = up;
	up = nil;
	/* m has been set by l32v.s */

	/*
	 * disable address wraps at 1MB boundaries.
	 * if we're 9boot, ldecomp.s already did this.
	 */
	a20init();

	mach0init();
//	options();		/* we don't get options passed to us */
	ioinit();
	/* we later call i8250console after plan9.ini has been read */
	i8250config("0");	/* configure serial port 0 with defaults */
	quotefmtinstall();
 	fmtinstall('i', eipfmt);
 	fmtinstall('I', eipfmt);
 	fmtinstall('E', eipfmt);
 	fmtinstall('V', eipfmt);
 	fmtinstall('M', eipfmt);
	screeninit();			/* cga setup */
	cgapost(0xc);

	trapinit0();
	mmuinit0();

	kbdinit();
	i8253init();
	cpuidentify();
	readlsconf();
	meminit();
	confinit();
	archinit();
	xinit();
	if(i8237alloc != nil)
		i8237alloc();		/* dma (for floppy) init */
	trapinit();
	printinit();
	sanity();
	cgapost(1);

	/*
	 * soekris servers have no built-in video but each has a serial port.
	 * they must see serial output, if any, before cga output because
	 * otherwise the soekris bios will translate cga output to serial
	 * output, which will garble serial console output.
	 */
	pcimatch(nil, 0, 0);		/* force scan of pci table */
	if (!pcivga) {
		screenputs = nil;
		uartputs(novga, sizeof novga - 1);
	}
	print(" %s\n\n", hellomsg);

	if (vfy != Datamagic)
		panic("data segment incorrectly aligned or loaded");
	if (savup)
		print("up was non-nil (%#p) upon entry to main; bss wasn't zeroed!\n",
			savup);

//	xsummary();
	cpuidprint();
	mmuinit();
	if(arch->intrinit)	/* launches other processors on an mp */
		arch->intrinit();
	timersinit();
	mathinit();
	kbdenable();
	/*
	 * 9loadusb runs much faster if we don't use the clock.
	 * perhaps we're competing with the bios for the use of it?
	 */
	if(!noclock && arch->clockenable)
		arch->clockenable();
	procinit0();
	initseg();
	if(delaylink){
		bootlinks();
		pcimatch(0, 0, 0);
	}else
		links();
	conf.monitor = 1;
	cgapost(0xcd);
	chandevreset();
	cgapost(2);
	pageinit();	/* must follow xinit, and conf.mem must be populated */
	i8253link();
	userinit();

	active.thunderbirdsarego = 1;
	cgapost(0xb0);
	schedinit();
}
Ejemplo n.º 13
0
void
main(void)
{
//	int i;
	extern char bdata[], edata[], end[], etext[];
	static ulong vfy = 0xcafebabe;

	/* l.s has already printed "Plan 9 from Be" */
//	m = mach;					/* now done in l.s */

	/* realign data seg; apparently -H0 -R4096 does not pad the text seg */
	if (vfy != 0xcafebabe) {
//		wave('<'); wave('-');
		memmove(bdata, etext, edata - bdata);
	}
	/*
	 * once data segment is in place, always zero bss since we may
	 * have been loaded by another Plan 9 kernel.
	 */
	memset(edata, 0, end - edata);		/* zero BSS */
	cacheuwbinv();
	l2cacheuwbinv();

	if (vfy != 0xcafebabe)
		panic("data segment misaligned");
	vfy = 0;

wave('l');
	machinit();
	mmuinit();

	optionsinit("/boot/boot boot");
	quotefmtinstall();

	/* want plan9.ini to be able to affect memory sizing in confinit */
	plan9iniinit();		/* before we step on plan9.ini in low memory */

	trapinit();		/* so confinit can probe memory to size it */
	confinit();		/* figures out amount of memory */
	/* xinit prints (if it can), so finish up the banner here. */
	delay(500);
	iprint("l Labs\n\n");
	delay(500);
	xinit();

	mainmem->flags |= POOL_ANTAGONISM /* | POOL_PARANOIA */ ;

	/*
	 * Printinit will cause the first malloc call.
	 * (printinit->qopen->malloc) unless any of the
	 * above (like clockinit) do an irqenable, which
	 * will call malloc.
	 * If the system dies here it's probably due
	 * to malloc(->xalloc) not being initialised
	 * correctly, or the data segment is misaligned
	 * (it's amazing how far you can get with
	 * things like that completely broken).
	 *
	 * (Should be) boilerplate from here on.
	 */

	archreset();			/* configure clock signals */
	clockinit();			/* start clocks */
	timersinit();
	watchdoginit();

	delay(250);			/* let uart catch up */
	printinit();
//	kbdenable();

	cpuidprint();
//	chkmissing();

	procinit0();
	initseg();

	dmainit();
	links();
	conf.monitor = 1;
	screeninit();
	chandevreset();			/* most devices are discovered here */

//	i8250console();			/* too early; see init0 */

	pageinit();
	swapinit();
	userinit();
	schedinit();
}