示例#1
0
void install_keyboard_handler() 
{
    struct x86_gate *idt = (struct x86_gate *) sidt();
    
    fill_gate(idt[KEY_IDT_ENTRY].filler, (unsigned int) asm_keyboard_wrapper, KERNEL_CS_SEGSEL, ACC_TRAP_GATE);
    init_kb_buffer();
}
示例#2
0
void install_timer_handler() 
{
    struct x86_gate *idt = (struct x86_gate *) sidt();

    fill_gate(idt[TIMER_IDT_ENTRY].filler, (unsigned int) asm_timer_wrapper, KERNEL_CS_SEGSEL, ACC_TRAP_GATE); 

    outb(TIMER_MODE_IO_PORT, TIMER_SQUARE_WAVE);
    outb(TIMER_PERIOD_IO_PORT, ((TIMER_RATE / 100) & 0xff));
    iodelay(); 
    outb(TIMER_PERIOD_IO_PORT, (((TIMER_RATE / 100) >> 8) & 0xff));
}
示例#3
0
文件: pillbox.c 项目: cacker/imvirt
int main () {
  /* Some of the tests need to be run on the same CPU. */
  cpu_set_t mask;

  if(sched_getaffinity(0, sizeof(mask), &mask) < 0) {
    perror("sched_getaffinity");
    return -1;
  }

  /* Bind onto first online cpu. */
  int n;
  for(n = 0; n < CPU_SETSIZE; n++) {
    if(CPU_ISSET(n, &mask)) {
	CPU_ZERO(&mask);
	CPU_SET(n, &mask);
	break;
    }
  }
  if(!CPU_ISSET(n, &mask)) {
    fprintf(stderr, "Oops, could not find an online CPU!\n");
    return -1;
  }

  if (sched_setaffinity(0, sizeof(mask), &mask) < 0) {
    perror("sched_setaffinity");
    return -1;
  }

  printf("cpu,%d", n);

  sidt();
  sgdt();
  sldt();
  str();

  printf("\n");

  exit(0);
}