예제 #1
0
/* Move the results from the previous iteration back to the input sockets. */
static void loop_iteration_reset(bNodeTree *ngroup, bNodeStack *gstack)
{
	bNodeSocket *gin, *gout;
	bNodeStack *nsin, *nsout;
	
	gin = ngroup->inputs.first;
	gout = ngroup->outputs.first;
	
	while (gin && gout) {
		/* skip static (non-looping) sockets */
		while (gin && !(gin->flag & SOCK_DYNAMIC))
			gin=gin->next;
		while (gout && !(gout->flag & SOCK_DYNAMIC))
			gout=gout->next;
		
		if (gin && gout) {
			nsin = node_get_socket_stack(gstack, gin);
			nsout = node_get_socket_stack(gstack, gout);
			
			move_stack(nsin, nsout);
			
			gin=gin->next;
			gout=gout->next;
		}
	}
}
예제 #2
0
/* ilk process i (task0, kernel task) olusturur */
void init_kernel_task(struct dirent* root) {
	int r;

	ASSERT_int_disable();

	task_curr = &task0;

	task_curr->init();
	task_curr->shared_mem_list.init();
	task_curr->priority = 3;
	fs_task_init(task_curr, root);

	/* task icin kernel stack alani olustur */
	r = task_curr->pgdir.segment_alloc(MMAP_KERNEL_STACK_BASE,
									   MMAP_KERNEL_STACK_SIZE,
									   PTE_P | PTE_W);
	ASSERT( r == 0 );
	move_stack((uint32_t)&__boot_stack + (0x4000-MMAP_KERNEL_STACK_SIZE),
			   va2kaddr(MMAP_KERNEL_STACK_BASE), MMAP_KERNEL_STACK_SIZE);

	/* process id ata ve runnable listesine ekle */
	set_task_id(task_curr);
	add_to_runnable_list(task_curr);

	print_info(">> task %d created\n", task_curr->id);
}
예제 #3
0
/* Copy internal results to the external outputs.
 */
static void group_move_outputs(bNode *node, bNodeStack **out, bNodeStack *gstack)
{
	bNodeSocket *sock;
	bNodeStack *ns;
	int a;
	for (sock=node->outputs.first, a=0; sock; sock=sock->next, ++a) {
		if (sock->groupsock) {
			ns = node_get_socket_stack(gstack, sock->groupsock);
			move_stack(out[a], ns);
		}
	}
}
예제 #4
0
/* kernel_main()
 *  This is called by the low-level architecture startup routine. It sets up
 *  the kernel proper and generally gets the operating system off the ground.
 */
void kernel_main(unsigned int initial_stack)
{
    initial_esp = initial_stack; /* as given to us by multiboot */
    
    /* Set up the default kernel flags. Change these by adding their 
     * corresponding option when booting the kernel.
     */
    kern.flags.preempt_kernel = TRUE;
    kern.flags.debug_sched = FALSE;
    kern.flags.debug_task = FALSE;
    kern.flags.debug_interrupt = FALSE;
    kern.flags.debug_ticks = FALSE;
    kern.flags.stats = FALSE;

    /* Before we do anything with the higher-level kernel, move the kernel 
     * stack to a known location. This has to copy and remap all absolute
     * memory addresses.
     */
    move_stack((void *)STACK_LOC, STACK_SIZE);

    /* Extract and set any options given to the kernel */
    parse_cmdline(kern.cmdline);
    
    /* Now that all the lower-level startup has been done, we can set up
     * the higher-level kernel functions.
     */
    init_vt();
    print_startup();
    setup_initrd();
    load_kernel_symbols();
    init_sched();
    init_task();
    create_init();

    /* Start the kthread daemon going to set up other kernel threads */
    kthread_create(kthreadd, "kthreadd");

    /* And we're done */
    kprintf("Kernel startup complete in %ldms\n\n",
            kern.current_time_offset.tv_msec);
    
    /* We need to wait a bit here for all the threads to settle themselves 
     * before going away.
     */
    sleep(100);

    /* The kernel task has finished the startup, so remove the task from the
     * system. This should never return, so panic if it does.
     */
    task_exit();
    panic("Kernel task did not die when it was supposed to :-(");
}
/* Copy internal results to the external outputs.
 */
static void group_move_outputs(bNode *gnode, bNodeStack **out, bNodeStack *gstack)
{
	bNodeTree *ngroup = (bNodeTree *)gnode->id;
	bNode *node;
	bNodeSocket *sock;
	bNodeStack *ns;
	int a;
	
	for (node = ngroup->nodes.first; node; node = node->next) {
		if (node->type == NODE_GROUP_OUTPUT && (node->flag & NODE_DO_OUTPUT)) {
			for (sock = node->inputs.first, a = 0; sock; sock = sock->next, ++a) {
				ns = node_get_socket_stack(gstack, sock);
				if (ns)
					move_stack(out[a], ns);
			}
			break;  /* only one active output node */
		}
	}
}
예제 #6
0
int
v_poof(struct command *c)
{

  if (!is_loc_or_ship(c->a)) {
    wout(c->who, "%s is not a location.", c->parse[1]);
    return FALSE;
  }

  move_stack(c->who, c->a);

  wout(c->who, ">poof!<  A cloud of orange smoke appears and "
       "wisks you away...");
  out(c->who, "");

  show_loc(c->who, loc(c->who));

  return TRUE;
}