VirtualBox

Changeset 5757 in vbox


Ignore:
Timestamp:
Nov 15, 2007 1:47:55 PM (17 years ago)
Author:
vboxsync
Message:

Added handler for unexpected HW interrupts. If one does occur for some reason,
it is vital to send an EOI, otherwise the PIC is going to get totally confused.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/BIOS/rombios.c

    r5571 r5757  
    904904static void           int70_function();
    905905static void           int74_function();
     906static void           dummy_isr_function();
    906907static Bit16u         get_CS();
    907908static Bit16u         get_SS();
     
    85018502}
    85028503
     8504  void
     8505dummy_isr_function(regs, ds, iret_addr)
     8506  pusha_regs_t regs; // regs pushed from PUSHA instruction
     8507  Bit16u ds; // previous DS:, DS set to 0x0000 by asm wrapper
     8508  iret_addr_t  iret_addr; // CS,IP,Flags pushed from original INT call
     8509{
     8510  // Interrupt handler for unexpected hardware interrupts. We have to clear
     8511  // the PIC because if we don't, the next EOI will clear the wrong interrupt
     8512  // and all hell will break loose! This routine also masks the unexpected
     8513  // interrupt so it will generally be called only once for each unexpected
     8514  // interrupt level.
     8515  Bit8u isrA, isrB, imr, last_int = 0xFF;
     8516
     8517  outb( 0x20, 0x0B );
     8518  isrA = inb( 0x20 );
     8519  if (isrA) {
     8520    outb( 0xA0, 0x0B );
     8521    isrB = inb( 0xA0 );
     8522    if (isrB) {
     8523        imr = inb( 0xA1 );
     8524        outb( 0xA1, imr | isrB );       // Mask this interrupt
     8525        outb( 0xA0, 0x20 );             // Send EOI on slave PIC
     8526    } else {
     8527        imr = inb( 0x21 );
     8528        isrA &= 0xFB;                   // Never mask the cascade interrupt
     8529        outb( 0x21, imr | isrA);        // Mask this interrupt
     8530    }
     8531    outb( 0x20, 0x20 );                 // Send EOI on master PIC
     8532    last_int = isrA;
     8533  }
     8534  write_byte( 0x40, 0x6B, last_int );   // Write INTR_FLAG
     8535}
    85038536
    85048537ASM_START
     
    92079240;--------------------
    92089241; relocated here because the primary POST area isnt big enough.
     9242; the SET_INT_VECTORs have nothing to do with EBDA but do not
     9243; fit into the primary POST area either
    92099244ebda_post:
     9245  SET_INT_VECTOR(0x0D, #0xF000, #dummy_isr);    IRQ 5
     9246  SET_INT_VECTOR(0x0F, #0xF000, #dummy_isr);    IRQ 7
     9247  SET_INT_VECTOR(0x72, #0xF000, #dummy_isr);    IRQ 11
     9248  SET_INT_VECTOR(0x77, #0xF000, #dummy_isr);    IRQ 15
     9249
    92109250#if BX_USE_EBDA
    92119251  mov ax, #EBDA_SEG
     
    1133011370db 0x00    ;; base  23:16
    1133111371
     11372;;
     11373;; Handler for unexpected hardware interrupts
     11374;;
     11375dummy_isr:
     11376  push ds
     11377  pushad
     11378  xor  ax, ax
     11379  mov  ds, ax
     11380  call _dummy_isr_function
     11381  popad
     11382  pop  ds
     11383  iret
    1133211384
    1133311385;----------
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette