예제 #1
0
파일: rtl8139.c 프로젝트: Kloniks/muk
/* testing
 */
void rtl8139_test(void)
{
  net_buf_t* nb_head;
  net_buf_t* nb_tail;
  net_buf_t* nb_pos;
  rtl8139_dev_t* dev;

  TRACE_ENTRY();

  dev = (rtl8139_dev_t*)g_device->priv;

  while (1)
    {
/*       icmp_ping(g_device, NET_REMOTE_ADDR); */
      cpu_hlt();
#if 0
      cpu_cli();
      arp_print_table();
      cpu_sti();
#endif
    }

  while (1)
    {
      nb_head = null;
      nb_tail = null;

      cpu_hlt();

      /* safely get the net buffers */
      cpu_cli();
      if (!is_null(dev->nb_head))
	{
	  for (nb_pos = dev->nb_head; nb_pos->next; nb_pos = nb_pos->next)
	    ;

	  if (!is_null(nb_tail))
	    nb_tail->next = dev->nb_head;
	  else
	    nb_head = dev->nb_head;
	  nb_tail = nb_pos;
	}
      dev->nb_head = null;
      cpu_sti();

      /* print and release net buffers */
      while (nb_head)
	{
	  nb_pos = nb_head;
	  nb_head = nb_head->next;
	  /* hexdump(nb_pos->buf, nb_pos->size); */
	  mm_free(nb_pos->buf);
	  mm_free(nb_pos);
	}

      arp_print_table();
    }
}
예제 #2
0
파일: intr.c 프로젝트: kobemiller/Hurlex-II
// 调用中断处理函数
void isr_handler(pt_regs_t *regs)
{
        if (interrupt_handlers[regs->int_no]) {
              interrupt_handlers[regs->int_no](regs);
        } else {
                printk_color(rc_black, rc_blue, "Unhandled interrupt: %d %s\n", regs->int_no, intrname(regs->int_no));
                cpu_hlt();
        }
}
예제 #3
0
파일: intr.c 프로젝트: zmr961006/ParalleX
void isr_handler(pt_regs_t *regs){
    
    if(interrupt_handlers[regs->int_no]){
        interrupt_handlers[regs->int_no](regs);
    }else{
        printk("unable interrupt %d %s\n",regs->int_no,intrname(regs->int_no));
        cpu_hlt();
    }
    return ;
}
예제 #4
0
파일: sched.c 프로젝트: texane/muk
error_t sched_yield(void)
{
    task_t* current;
    volatile uint32_t* timeslice;

    current = sched_get_current();
    timeslice = &current->timeslice;
    *timeslice = 0;

    /* fixme: race here
     */
    while (*timeslice == 0)
        cpu_hlt();

    return ERROR_SUCCESS;
}
예제 #5
0
파일: kio.c 프로젝트: githubofhuo/Hurlex-II
// 读取一个字符
char getchar(void)
{
    char ch;
    char_dev_t *kb_dev = &kboard_dev;

    if (!kb_dev->ops.device_valid()) {
        return 0;
    }

    while (kb_dev->ops.read(&ch, 1) == 1) {
        cpu_hlt();
        return ch;
    }

    return 0;
}
예제 #6
0
파일: mp_init.c 프로젝트: disdi/u-boot-x86
static inline void stop_this_cpu(void)
{
	/* Called by an AP when it is ready to halt and wait for a new task */
	for (;;)
		cpu_hlt();
}
예제 #7
0
파일: kernel.c 프로젝트: Kloniks/muk
void kernel_main(unsigned long magic,
		 unsigned long addr)
{
  multiboot_info_t *mbi;

  if (magic != MULTIBOOT_BOOTLOADER_MAGIC)
    return;

  mbi = (multiboot_info_t*)addr;

  /* kernel init
   */
  serial_init(DEBUG_SERIAL_PORT,
	      DEBUG_SERIAL_SPEED,
	      UART_8BITS_WORD,
	      UART_NO_PARITY,
	      UART_1_STOP_BIT);
  cls();

  cpu_cli();
  printf("[x] interrupts disabled\n");

  gdt_initialize();
  printf("[x] gdt initialized\n");

  idt_initialize();
  printf("[x] idt initialized\n");

  breakpoint_initialize();

#if defined(USE_APIC)
  apic_initialize();
  serial_printl("[x] apic initialized\n");
#else
  pic_initialize();
  serial_printl("[x] pic initialized\n");
#endif /* USE_APIC */

  /* initialize the kernel
   */
  {
    kernel_init(mbi);
  }

  /* memory initialization
   */
  {
    phys_init(mbi);
    phys_debug();
/*     vm_init(); */
/*     unit_test_vm(); */
/*     cpu_hlt(); */
  }

#if defined(USE_PCI)
  pci_initialize();
  pci_list();
#endif

  cpu_sti();

#if defined(USE_TASK)
 {
   /* subsystems
    */
   event_initialize();
   sched_initialize();
   task_initialize();

   /* tasks
    */
   idle_initialize();
   muksh_initialize();
   net_initialize();

/*    task_test(); */

   /* start scheduling
    */
   sched_start();
 }
#endif

 /* endless loop
  */
 serial_printl("[?] kernel loop\n");
 while (1)
   {
     serial_printl("k");
     cpu_hlt();
   }
}