Ejemplo n.º 1
0
ac_bool test_interrupts(void) {
  ac_bool error = AC_FALSE;
  descriptor_ptr idtr;

  get_idt(&idtr);

  error |= AC_TEST(idtr.limit != 0);
  error |= AC_TEST(idtr.iig != 0);

  // Test we can set an interrupt handler and invoke it
  set_intr_handler(79, intr_79);
  print_idt_intr_gate("idt[79]:", get_idt_intr_gate(79));

  idt_intr_gate *g = get_idt_intr_gate(79);
  error |= AC_TEST(GET_IDT_INTR_GATE_OFFSET(*g) == (ac_uptr)intr_79);

  intr_79_counter = 0;
  ac_printf("invoke intr(79)\n");
  intr(79);
  ac_printf("done   intr(79)\n");

  error |= AC_TEST(intr_79_counter == 1);

  return error;
}
Ejemplo n.º 2
0
AC_ATTR_INTR_HDLR
static void expt_general_protection(IntrFrame *frame, ac_uint error_code) {
  __asm__ volatile(""::: "rax", "rbx", "rcx", "rdx", "rsi", "rdi", // "rbp", rbp is already saved
                         "r8",  "r9",  "r10", "r11", "r12", "r13", "r14", "r15");
  print_full_expt_stack_frame("#GP13", frame);

  expt_general_protection_counter += 1;
  ac_printf(" expt_general_protection_counter: %d\n", expt_general_protection_counter);

  IdtPtr idtp;
  get_idt(&idtp);
  ac_printf(" idt.limit=%d\n", idtp.limit);
  ac_printf(" idt.iig=%p\n", idtp.iig);
  reset_x86();
}