Пример #1
0
static void
cmd_run(int argc, char **argp, void *data) {
    cpu_instance_t *cpu = ((cmd_data_t *)data)->cpu;
    unsigned int i = 0;
    clock_t start = clock();
    clock_t stop;

    cpu_set_flag(cpu, CPU_FLAGS_RUN);
    lprintf(LOG_VERBOSE, "Running...\n");
    while (cpu->flags & CPU_FLAGS_RUN) {
        i++;
        cpu_step(cpu);
        if (i % 1000 == 0) {
            vr12_fade();
#ifdef HAVE_SDL
            sdl_update();
#endif
        }
    }
    stop = clock();

    lprintf(LOG_NORMAL, "Halted at %.4o.\n", cpu->pc);
    lprintf(LOG_NORMAL,
            "Did %i instructions in %f seconds (%f i/s)\n",
            i,
            ((double)(stop - start))/((double)CLOCKS_PER_SEC),
            ((double)i * (double)CLOCKS_PER_SEC)/((double)(stop - start))
        );
}
Пример #2
0
static void
cmd_pdp8(int argc, char **argp, void *data) {
    cpu_instance_t *cpu = ((cmd_data_t *)data)->cpu;
    cpu_set_flag(cpu, CPU_FLAGS_8MODE);
}
Пример #3
0
void bsp_finish_booting(void)
{
  int i;
#if SPROFILE
  sprofiling = 0;      /* we're not profiling until instructed to */
#endif /* SPROFILE */
  cprof_procs_no = 0;  /* init nr of hash table slots used */

  cpu_identify();

  vm_running = 0;
  krandom.random_sources = RANDOM_SOURCES;
  krandom.random_elements = RANDOM_ELEMENTS;

  /* MINIX is now ready. All boot image processes are on the ready queue.
   * Return to the assembly code to start running the current process. 
   */
  
  /* it should point somewhere */
  get_cpulocal_var(bill_ptr) = get_cpulocal_var_ptr(idle_proc);
  get_cpulocal_var(proc_ptr) = get_cpulocal_var_ptr(idle_proc);
  announce();				/* print MINIX startup banner */

  /*
   * we have access to the cpu local run queue, only now schedule the processes.
   * We ignore the slots for the former kernel tasks
   */
  for (i=0; i < NR_BOOT_PROCS - NR_TASKS; i++) {
	RTS_UNSET(proc_addr(i), RTS_PROC_STOP);
  }
  /*
   * enable timer interrupts and clock task on the boot CPU
   */
  if (boot_cpu_init_timer(system_hz)) {
	  panic("FATAL : failed to initialize timer interrupts, "
			  "cannot continue without any clock source!");
  }

  fpu_init();

/* Warnings for sanity checks that take time. These warnings are printed
 * so it's a clear warning no full release should be done with them
 * enabled.
 */
#if DEBUG_SCHED_CHECK
  FIXME("DEBUG_SCHED_CHECK enabled");
#endif
#if DEBUG_VMASSERT
  FIXME("DEBUG_VMASSERT enabled");
#endif
#if DEBUG_PROC_CHECK
  FIXME("PROC check enabled");
#endif

  DEBUGEXTRA(("cycles_accounting_init()... "));
  cycles_accounting_init();
  DEBUGEXTRA(("done\n"));

#ifdef CONFIG_SMP
  cpu_set_flag(bsp_cpu_id, CPU_IS_READY);
  machine.processors_count = ncpus;
  machine.bsp_id = bsp_cpu_id;
#else
  machine.processors_count = 1;
  machine.bsp_id = 0;
#endif

  /* Kernel may no longer use bits of memory as VM will be running soon */
  kernel_may_alloc = 0;

  switch_to_user();
  NOT_REACHABLE;
}