int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) { smp_begin(1,visdata,isBeat,framebuffer,fbout,w,h); if (isBeat & 0x80000000) return 0; smp_render(0,1,visdata,isBeat,framebuffer,fbout,w,h); return smp_finish(visdata,isBeat,framebuffer,fbout,w,h); }
static int init(void * unused) { int pid,i; #ifdef CONFIG_BLK_DEV_INITRD int real_root_mountflags; #endif /* Launch bdflush from here, instead of the old syscall way. */ kernel_thread(bdflush, NULL, 0); /* Start the background pageout daemon. */ kswapd_setup(); kernel_thread(kswapd, NULL, 0); #ifdef CONFIG_BLK_DEV_INITRD real_root_dev = ROOT_DEV; real_root_mountflags = root_mountflags; if (initrd_start && mount_initrd) root_mountflags &= ~MS_RDONLY; else mount_initrd =0; #endif setup(); #ifdef __SMP__ /* * With the devices probed and setup we can * now enter SMP mode. */ smp_begin(); #endif #ifdef CONFIG_UMSDOS_FS { /* When mounting a umsdos fs as root, we detect the pseudo_root (/linux) and initialise it here. pseudo_root is defined in fs/umsdos/inode.c */ extern struct inode *pseudo_root; if (pseudo_root != NULL){ current->fs->root = pseudo_root; current->fs->pwd = pseudo_root; } } #endif #ifdef CONFIG_BLK_DEV_INITRD root_mountflags = real_root_mountflags; if (mount_initrd && ROOT_DEV != real_root_dev && ROOT_DEV == MKDEV(RAMDISK_MAJOR,0)) { int error; pid = kernel_thread(do_linuxrc, "/linuxrc", SIGCHLD); if (pid>0) while (pid != wait(&i)); if (real_root_dev != MKDEV(RAMDISK_MAJOR, 0)) { error = change_root(real_root_dev,"/initrd"); if (error) printk(KERN_ERR "Change root to /initrd: " "error %d\n",error); } } #endif /* * This keeps serial console MUCH cleaner, but does assume * the console driver checks there really is a video device * attached (Sparc effectively does). */ if ((open("/dev/tty1",O_RDWR,0) < 0) && (open("/dev/ttyS0",O_RDWR,0) < 0)) printk("Unable to open an initial console.\n"); (void) dup(0); (void) dup(0); if (!execute_command) { execve("/etc/init",argv_init,envp_init); execve("/bin/init",argv_init,envp_init); execve("/sbin/init",argv_init,envp_init); /* if this fails, fall through to original stuff */ pid = kernel_thread(do_rc, "/etc/rc", SIGCHLD); if (pid>0) while (pid != wait(&i)) /* nothing */; } while (1) { pid = kernel_thread(do_shell, execute_command ? execute_command : "/bin/sh", SIGCHLD); if (pid < 0) { printf("Fork failed in init\n\r"); continue; } while (1) if (pid == wait(&i)) break; printf("\n\rchild %d died with code %04x\n\r",pid,i); sync(); } return -1; }
void go_kernel(void) { task_t *t; int i,len; void *ptr,*phys; port_t *uberport; area_t *uberarea; team_t *team; for (i = 0, len = 1; (bdir->bd_entry[i].be_type != BE_TYPE_NONE); i++){ len += bdir->bd_entry[i].be_size; } len *= 0x1000; uberport = rsrc_find_port(uberportnum = port_create(0,"uberport")); uberarea = rsrc_find_area(uberareanum = area_create_uber(len, (void *) 0x100000)); kprintf("uberport allocated with rid = %d",uberportnum); kprintf("uberarea allocated with rid = %d",uberareanum); kernel_team = team_create(); rsrc_set_name(&kernel_team->rsrc, "kernel team"); run_queue = rsrc_find_queue(queue_create("run queue",kernel_team)); reaper_queue = rsrc_find_queue(queue_create("reaper queue",kernel_team)); timer_queue = rsrc_find_queue(queue_create("timer queue",kernel_team)); rsrc_set_owner(&uberarea->rsrc,kernel_team); rsrc_set_owner(&uberport->rsrc,kernel_team); for(i=3;bdir->bd_entry[i].be_type;i++){ if(bdir->bd_entry[i].be_type != BE_TYPE_CODE) continue; team = team_create(); t = new_thread(team, 0x1074 /*bdir->bd_entry[i].be_code_ventr*/, 0); current = t; phys = (void *) (bdir->bd_entry[i].be_offset*0x1000 + 0x100000); team->text_area = area_create(team->aspace,bdir->bd_entry[i].be_size*0x1000, 0x1000, &phys, AREA_PHYSMAP); team->heap_id = area_create(team->aspace,0x2000,0x1000 + bdir->bd_entry[i].be_size* 0x1000, &ptr, 0); /* make the thread own it's address space */ /* rsrc_set_owner(&a->rsrc, t); */ if (!strcmp (bdir->bd_entry[i].be_name, "namer")) { rsrc_set_owner(&uberport->rsrc, team); } rsrc_set_name(&t->rsrc,bdir->bd_entry[i].be_name); rsrc_set_name(&team->rsrc,bdir->bd_entry[i].be_name); kprintf("task %X @ 0x%x, size = 0x%x (%s)",t->rsrc.id, bdir->bd_entry[i].be_offset*4096+0x100000, bdir->bd_entry[i].be_size*4096, t->rsrc.name); } kprintf("creating idler..."); idle_task = new_thread(kernel_team, (int) idler, 1); rsrc_set_name((resource_t*)idle_task,"idler"); kprintf("creating grim reaper..."); current = new_thread(kernel_team, (int) reaper, 1); rsrc_set_name((resource_t*)current,"grim reaper"); reaper_sem = sem_create(0,"death toll"); rsrc_enqueue(run_queue, current); live_tasks++; kprintf("creating pager..."); current = pager_task = new_thread(kernel_team, (int) pager, 1); rsrc_set_name((resource_t*)current,"pager"); pager_port_no = port_create(0,"pager port"); pager_sem_no = sem_create(0, "pager sem"); rsrc_enqueue(run_queue, current); live_tasks++; rsrc_set_name((resource_t*)kernel,"kernel"); #ifdef __SMP__ smp_init (); #endif // DEBUGGER(); kprintf("starting scheduler..."); #ifdef __SMP__ if (smp_configured) { smp_final_setup (); kprintf ("smp: signaling other processors"); smp_begin (); } #endif /* * when the new vm stuffas are done, we can at this point discard any * complete pages in the .text.init and .data.init sections of the kernel * by zeroing them and adding them to the free physical page pool. */ current = kernel; current->flags = tDEAD; current->waiting_on = NULL; swtch(); kprintf("panic: returned from scheduler?"); asm("hlt"); }