예제 #1
0
파일: hal.c 프로젝트: Rogerrubens/nanvix
/**
 * @brief Raises processor execution level.
 * 
 * @note This function must be called in an interrupt-safe environment.
 */
PUBLIC unsigned processor_raise(unsigned irqlvl)
{
	unsigned old_irqlvl;
	
	old_irqlvl = curr_proc->irqlvl;
	pic_mask(int_masks[curr_proc->irqlvl = irqlvl]);
	
	return (old_irqlvl);
}
예제 #2
0
파일: i8259a.c 프로젝트: Icefroge/auos
static void pic_setup(unsigned irq, unsigned long flags)
{
	if ((flags & HWIRQ_HIGH) || (flags & HWIRQ_LOW))
		debug("Level triggered irqs aren't supported\n");

	if (flags & HWIRQ_DISABLED)
		pic_mask(irq);
	else
		pic_unmask(irq);
}
예제 #3
0
파일: pic.c 프로젝트: helino/aenix
void pic_init(void)
{
    /* ICW1 */
    outb(PIC1_PORT_A, PIC1_ICW1);
    outb(PIC2_PORT_A, PIC2_ICW1);

    /* ICW2 */
    outb(PIC1_PORT_B, PIC1_ICW2);
    outb(PIC2_PORT_B, PIC2_ICW2);

    /* ICW3 */
    outb(PIC1_PORT_B, PIC1_ICW3);
    outb(PIC2_PORT_B, PIC2_ICW3);

    /* ICW4 */
    outb(PIC1_PORT_B, PIC1_ICW4);
    outb(PIC2_PORT_B, PIC2_ICW4);

    pic_mask(0xEC, 0xFF);
}
예제 #4
0
파일: kmain.c 프로젝트: Kijewski/chaOS
void
_start (void)
{
  // debugging
  /*
  volatile char xxx = 0;
  while (xxx == 0)
    asm volatile ("pause" ::: "memory");
  //*/

  // clear BSS:
  memset (&_section_bss_start[0], 0,
          &_section_bss_end[0] - &_section_bss_start[0]);

  videoram_cls (COLOR_NORMAL);

  // some welcoming information:
  videoram_printf ("\n  Welcome to \e%c chaOS! \n\n", COLOR_ERROR);
  put_cpu_info ();
  put_memory_map ();

  if (!nx_bit_present ())
    {
      videoram_puts (" Your CPU does not support the NX bit! \n", COLOR_ERROR);
      khalt ();
    }

  init_subsystem ("interrupt handling", &interrupts_init, NULL);

  videoram_puts ("Running a syscall test: ", COLOR_NORMAL);
  if (syscall_test ())
    videoram_put_right (" ok ", COLOR_INFO);
  else
    {
      videoram_put_right (" FAIL ", COLOR_ERROR);
      khalt ();
    }

  init_subsystem ("PIC", &pic_init, NULL);
  pit_set_handler (pic_handler_fun);
  pic_mask (~PIC_MASK_PIT);

  videoram_puts ("Setting CPU standards", COLOR_NORMAL);
  cr0_set_reset (CR0_WP|CR0_NE, CR0_MP|CR0_EM|CR0_NE|CR0_AM|CR0_CD|CR0_NW);
  msr_set_reset (MSR_EFER, EFER_NXE, 0);
  videoram_put_right (" ok ", COLOR_INFO);

  init_subsystem ("paging", &paging_init, NULL);

  videoram_puts ("Enabling interrupts", COLOR_NORMAL);
  asm volatile ("sti");
  videoram_put_right (" ok ", COLOR_INFO);

  init_subsystem ("real-time clock", &rtc_init, NULL);
  init_subsystem ("timeout handler", &timeout_init, NULL);
  init_subsystem ("random number generator", &random_init, NULL);
  init_subsystem ("frame allocator", &frame_allocator_init, NULL);

  init_subsystem ("Interrupt timer (33Hz)", &pit_init_33hz, NULL);
  pic_mask (~0);

  init_subsystem ("PS/2 keyboard", &keyboard_init, NULL);
  init_subsystem ("PS/2 mouse", &mouse_init, NULL);

  init_subsystem ("keypress handler", &keypress_handler_init, NULL);
  ENSURE (keypress_handler_set_keymap (KEYMAP_QWERTZ_DE_DE));

  // TODO: initialize more subsystems

  put_welcoming_message ();

  // TODO: do something
  for (;;)
    {
      int c = keypress_handler_getc ();
      if (!c)
        break;
      if (c < 128 && c != 127)
        videoram_printf ("C: <%c>\n", c);
    }
  
  khalt ();
}
예제 #5
0
파일: hal.c 프로젝트: Rogerrubens/nanvix
/**
 * @brief Drops processor execution level.
 * 
 * @note This function must be called in an interrupt-safe environment.
 */
PUBLIC void processor_drop(unsigned irqlvl)
{
	pic_mask(int_masks[curr_proc->irqlvl = irqlvl]);
}
예제 #6
0
파일: hal.c 프로젝트: Rogerrubens/nanvix
/**
 * @brief Reloads the processor execution level.
 * 
 * @note This function must be called in an interrupt-safe environment.
 */
PUBLIC void processor_reload(void)
{
	pic_mask(int_masks[curr_proc->irqlvl]);
}