Пример #1
0
void schedule (void)
{
  u32 counter;

  secure_printf ("ssh [email protected] -v -c arcfour\n");
  haltcpu ();

  spin_lock (schedule_mutex);

  task_queue_length = 0;
  //  task_queue_position = 0;
  
  for (counter = 0; counter < threads; counter++)
  {
    if (tss[counter].state == STATE_DISPATCH)
    {
      task_queue[task_queue_length] = counter;
      task_queue_length++;
    }
  }

  /* If no other tasks are launched, fall back to the idle
     process(es). */

  if (task_queue_length == 0)
  {
    for (counter = 0; counter < threads; counter++)
    {
      if (tss[counter].state == STATE_IDLE)
      {
        task_queue[task_queue_length] = counter;
        task_queue_length++;
      }
    }
  }

  secure_printf ("task_queue_length = %lu, task queue: [", task_queue_length);

#ifdef DEBUG
  {
    int c;

    for (c = 0; c < task_queue_length; c++)
    {
      secure_printf (" %lu", task_queue[c]);
    }
  }
  secure_printf ("]\n");
#endif

  spin_unlock (schedule_mutex);
}
Пример #2
0
void kmain()
{
	if(!pmm_init())
		error("Failed initializing PMM.",1);
	if(!vmm_init(0))
		error("Failed initializing VMM.",1);
	initmemory(0);
	if(!initinterrupt())
		error("Failed initializing interrupt.",1);
	if(!initapic())
		error("Failed initializing APIC.",1);
	if(!initacpi())
		error("Failed initializing ACPI.",1);
	initmp();

	printf("Initialized %d processor(s).\n",getprocessorcount());
	haltcpu();
}