]> git.proxmox.com Git - mirror_edk2.git/blobdiff - DuetPkg/CpuDxe/Ia32/CpuInterrupt.asm
DuetPkg: Use UefiCpuPkg/CpuDxe instead of DuetPkg/CpuDxe
[mirror_edk2.git] / DuetPkg / CpuDxe / Ia32 / CpuInterrupt.asm
diff --git a/DuetPkg/CpuDxe/Ia32/CpuInterrupt.asm b/DuetPkg/CpuDxe/Ia32/CpuInterrupt.asm
deleted file mode 100644 (file)
index d520223..0000000
+++ /dev/null
@@ -1,835 +0,0 @@
-      TITLE   CpuInterrupt.asm: \r
-;------------------------------------------------------------------------------\r
-;*\r
-;*   Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r
-;*   This program and the accompanying materials                          \r
-;*   are licensed and made available under the terms and conditions of the BSD License         \r
-;*   which accompanies this distribution.  The full text of the license may be found at        \r
-;*   http://opensource.org/licenses/bsd-license.php                                            \r
-;*                                                                                             \r
-;*   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-;*   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
-;*   \r
-;*    CpuInterrupt.asm\r
-;*  \r
-;*   Abstract:\r
-;*\r
-;------------------------------------------------------------------------------\r
-\r
-.686p\r
-.model  flat, C\r
-\r
-PUBLIC SystemTimerHandler\r
-PUBLIC SystemExceptionHandler\r
-EXTERNDEF mExceptionCodeSize:DWORD\r
-\r
-.code\r
-.stack\r
-.MMX\r
-.XMM\r
-\r
-EXTERN TimerHandler: NEAR\r
-EXTERN ExceptionHandler: NEAR\r
-EXTERN mTimerVector: DWORD\r
-\r
-mExceptionCodeSize  DD  9\r
-\r
-InitDescriptor PROC C\r
-        lea     eax, [GDT_BASE]             ; EAX=PHYSICAL address of gdt\r
-        mov     dword ptr [gdtr + 2],eax    ; Put address of gdt into the gdtr\r
-        lgdt    fword ptr [gdtr]\r
-        lea     eax, [IDT_BASE]             ; EAX=PHYSICAL address of idt\r
-        mov     dword ptr [idtr + 2],eax    ; Put address of idt into the idtr\r
-        lidt    fword ptr [idtr]\r
-        ret\r
-InitDescriptor ENDP\r
-\r
-; VOID\r
-; InstallInterruptHandler (\r
-;     UINTN Vector,\r
-;     VOID  (*Handler)(VOID)\r
-;     )\r
-InstallInterruptHandler    PROC C    \\r
-  Vector:DWORD,          \\r
-  Handler:DWORD\r
-\r
-        push    edi\r
-        pushfd                              ; save eflags\r
-        cli                                 ; turn off interrupts\r
-        sub     esp, 6                      ; open some space on the stack\r
-        mov     edi, esp\r
-        sidt    es:[edi]                    ; get fword address of IDT\r
-        mov     edi, es:[edi+2]             ; move offset of IDT into EDI\r
-        add     esp, 6                      ; correct stack\r
-        mov     eax, Vector                 ; Get vector number\r
-        shl     eax, 3                      ; multiply by 8 to get offset\r
-        add     edi, eax                    ; add to IDT base to get entry\r
-        mov     eax, Handler                ; load new address into IDT entry\r
-        mov     word ptr es:[edi], ax       ; write bits 15..0 of offset\r
-        shr     eax, 16                     ; use ax to copy 31..16 to descriptors\r
-        mov     word ptr es:[edi+6], ax     ; write bits 31..16 of offset\r
-        popfd                               ; restore flags (possible enabling interrupts)\r
-        pop     edi\r
-        ret\r
-\r
-InstallInterruptHandler    ENDP\r
-\r
-JmpCommonIdtEntry  macro\r
-    ; jmp     commonIdtEntry - this must be hand coded to keep the assembler from\r
-    ;                          using a 8 bit reletive jump when the entries are\r
-    ;                          within 255 bytes of the common entry.  This must\r
-    ;                          be done to maintain the consistency of the size\r
-    ;                          of entry points...\r
-    db      0e9h                        ; jmp 16 bit reletive \r
-    dd      commonIdtEntry - $ - 4      ;  offset to jump to\r
-endm\r
-\r
-    align 02h\r
-SystemExceptionHandler PROC\r
-INT0:\r
-    push    0h      ; push error code place holder on the stack\r
-    push    0h\r
-    JmpCommonIdtEntry\r
-;    db      0e9h                        ; jmp 16 bit reletive \r
-;    dd      commonIdtEntry - $ - 4      ;  offset to jump to\r
-    \r
-INT1:\r
-    push    0h      ; push error code place holder on the stack\r
-    push    1h\r
-    JmpCommonIdtEntry\r
-    \r
-INT2:\r
-    push    0h      ; push error code place holder on the stack\r
-    push    2h\r
-    JmpCommonIdtEntry\r
-    \r
-INT3:\r
-    push    0h      ; push error code place holder on the stack\r
-    push    3h\r
-    JmpCommonIdtEntry\r
-    \r
-INT4:\r
-    push    0h      ; push error code place holder on the stack\r
-    push    4h\r
-    JmpCommonIdtEntry\r
-    \r
-INT5:\r
-    push    0h      ; push error code place holder on the stack\r
-    push    5h\r
-    JmpCommonIdtEntry\r
-    \r
-INT6:\r
-    push    0h      ; push error code place holder on the stack\r
-    push    6h\r
-    JmpCommonIdtEntry\r
-    \r
-INT7:\r
-    push    0h      ; push error code place holder on the stack\r
-    push    7h\r
-    JmpCommonIdtEntry\r
-    \r
-INT8:\r
-;   Double fault causes an error code to be pushed so no phony push necessary\r
-    nop\r
-    nop\r
-    push    8h\r
-    JmpCommonIdtEntry\r
-    \r
-INT9:\r
-    push    0h      ; push error code place holder on the stack\r
-    push    9h\r
-    JmpCommonIdtEntry\r
-    \r
-INT10:\r
-;   Invalid TSS causes an error code to be pushed so no phony push necessary\r
-    nop\r
-    nop\r
-    push    10\r
-    JmpCommonIdtEntry\r
-    \r
-INT11:\r
-;   Segment Not Present causes an error code to be pushed so no phony push necessary\r
-    nop\r
-    nop\r
-    push    11\r
-    JmpCommonIdtEntry\r
-    \r
-INT12:\r
-;   Stack fault causes an error code to be pushed so no phony push necessary\r
-    nop\r
-    nop\r
-    push    12\r
-    JmpCommonIdtEntry\r
-    \r
-INT13:\r
-;   GP fault causes an error code to be pushed so no phony push necessary\r
-    nop\r
-    nop\r
-    push    13\r
-    JmpCommonIdtEntry\r
-    \r
-INT14:\r
-;   Page fault causes an error code to be pushed so no phony push necessary\r
-    nop\r
-    nop\r
-    push    14\r
-    JmpCommonIdtEntry\r
-    \r
-INT15:\r
-    push    0h      ; push error code place holder on the stack\r
-    push    15\r
-    JmpCommonIdtEntry\r
-    \r
-INT16:\r
-    push    0h      ; push error code place holder on the stack\r
-    push    16\r
-    JmpCommonIdtEntry\r
-    \r
-INT17:\r
-;   Alignment check causes an error code to be pushed so no phony push necessary\r
-    nop\r
-    nop\r
-    push    17\r
-    JmpCommonIdtEntry\r
-    \r
-INT18:\r
-    push    0h      ; push error code place holder on the stack\r
-    push    18\r
-    JmpCommonIdtEntry\r
-    \r
-INT19:\r
-    push    0h      ; push error code place holder on the stack\r
-    push    19\r
-    JmpCommonIdtEntry\r
-\r
-INTUnknown:\r
-REPEAT  (32 - 20)\r
-    push    0h      ; push error code place holder on the stack\r
-;    push    xxh     ; push vector number\r
-    db      06ah\r
-    db      ( $ - INTUnknown - 3 ) / 9 + 20 ; vector number\r
-    JmpCommonIdtEntry\r
-ENDM\r
-SystemExceptionHandler ENDP\r
-\r
-SystemTimerHandler PROC\r
-    push    0\r
-    push    mTimerVector\r
-    JmpCommonIdtEntry\r
-SystemTimerHandler ENDP\r
-\r
-commonIdtEntry:\r
-; +---------------------+\r
-; +    EFlags           +\r
-; +---------------------+\r
-; +    CS               +\r
-; +---------------------+\r
-; +    EIP              +\r
-; +---------------------+\r
-; +    Error Code       +\r
-; +---------------------+\r
-; +    Vector Number    +\r
-; +---------------------+\r
-; +    EBP              +\r
-; +---------------------+ <-- EBP\r
-\r
-  cli\r
-  push ebp\r
-  mov  ebp, esp\r
-\r
-  ;\r
-  ; Align stack to make sure that EFI_FX_SAVE_STATE_IA32 of EFI_SYSTEM_CONTEXT_IA32\r
-  ; is 16-byte aligned\r
-  ;\r
-  and     esp, 0fffffff0h\r
-  sub     esp, 12\r
-\r
-;; UINT32  Edi, Esi, Ebp, Esp, Ebx, Edx, Ecx, Eax;\r
-  push    eax\r
-  push    ecx\r
-  push    edx\r
-  push    ebx\r
-  lea     ecx, [ebp + 6 * 4]\r
-  push    ecx                          ; ESP\r
-  push    dword ptr [ebp]              ; EBP\r
-  push    esi\r
-  push    edi\r
-\r
-;; UINT32  Gs, Fs, Es, Ds, Cs, Ss;\r
-  mov  eax, ss\r
-  push eax\r
-  movzx eax, word ptr [ebp + 4 * 4]\r
-  push eax\r
-  mov  eax, ds\r
-  push eax\r
-  mov  eax, es\r
-  push eax\r
-  mov  eax, fs\r
-  push eax\r
-  mov  eax, gs\r
-  push eax\r
-\r
-;; UINT32  Eip;\r
-  push    dword ptr [ebp + 3 * 4]\r
-\r
-;; UINT32  Gdtr[2], Idtr[2];\r
-  sub  esp, 8\r
-  sidt fword ptr [esp]\r
-  sub  esp, 8\r
-  sgdt fword ptr [esp]\r
-\r
-;; UINT32  Ldtr, Tr;\r
-  xor  eax, eax\r
-  str  ax\r
-  push eax\r
-  sldt ax\r
-  push eax\r
-\r
-;; UINT32  EFlags;\r
-  push    dword ptr [ebp + 5 * 4]\r
-\r
-;; UINT32  Cr0, Cr1, Cr2, Cr3, Cr4;\r
-  mov  eax, cr4\r
-  or   eax, 208h\r
-  mov  cr4, eax\r
-  push eax\r
-  mov  eax, cr3\r
-  push eax\r
-  mov  eax, cr2\r
-  push eax\r
-  xor  eax, eax\r
-  push eax\r
-  mov  eax, cr0\r
-  push eax\r
-\r
-;; UINT32  Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;\r
-  mov     eax, dr7\r
-  push    eax\r
-;; clear Dr7 while executing debugger itself\r
-  xor     eax, eax\r
-  mov     dr7, eax\r
-\r
-  mov     eax, dr6\r
-  push    eax\r
-;; insure all status bits in dr6 are clear...\r
-  xor     eax, eax\r
-  mov     dr6, eax\r
-\r
-  mov     eax, dr3\r
-  push    eax\r
-  mov     eax, dr2\r
-  push    eax\r
-  mov     eax, dr1\r
-  push    eax\r
-  mov     eax, dr0\r
-  push    eax\r
-\r
-;; FX_SAVE_STATE_IA32 FxSaveState;\r
-  sub esp, 512\r
-  mov edi, esp\r
-  db 0fh, 0aeh, 00000111y ;fxsave [edi]\r
-\r
-;; UINT32  ExceptionData;\r
-  push    dword ptr [ebp + 2 * 4]\r
-\r
-;; Prepare parameter and call\r
-  mov     edx, esp\r
-  push    edx\r
-  mov     eax, dword ptr [ebp + 1 * 4]\r
-  push    eax\r
-  cmp     eax, 32\r
-  jb      CallException\r
-  call    TimerHandler\r
-  jmp     ExceptionDone\r
-CallException:\r
-  call    ExceptionHandler\r
-ExceptionDone:\r
-  add     esp, 8\r
-\r
-  cli\r
-;; UINT32  ExceptionData;\r
-  add esp, 4\r
-\r
-;; FX_SAVE_STATE_IA32 FxSaveState;\r
-  mov esi, esp\r
-  db 0fh, 0aeh, 00001110y ; fxrstor [esi]\r
-  add esp, 512\r
-\r
-;; UINT32  Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;\r
-  pop     eax\r
-  mov     dr0, eax\r
-  pop     eax\r
-  mov     dr1, eax\r
-  pop     eax\r
-  mov     dr2, eax\r
-  pop     eax\r
-  mov     dr3, eax\r
-;; skip restore of dr6.  We cleared dr6 during the context save.\r
-  add     esp, 4\r
-  pop     eax\r
-  mov     dr7, eax\r
-\r
-;; UINT32  Cr0, Cr1, Cr2, Cr3, Cr4;\r
-  pop     eax\r
-  mov     cr0, eax\r
-  add     esp, 4    ; not for Cr1\r
-  pop     eax\r
-  mov     cr2, eax\r
-  pop     eax\r
-  mov     cr3, eax\r
-  pop     eax\r
-  mov     cr4, eax\r
-\r
-;; UINT32  EFlags;\r
-  pop     dword ptr [ebp + 5 * 4]\r
-\r
-;; UINT32  Ldtr, Tr;\r
-;; UINT32  Gdtr[2], Idtr[2];\r
-;; Best not let anyone mess with these particular registers...\r
-  add     esp, 24\r
-\r
-;; UINT32  Eip;\r
-  pop     dword ptr [ebp + 3 * 4]\r
-\r
-;; UINT32  Gs, Fs, Es, Ds, Cs, Ss;\r
-;; NOTE - modified segment registers could hang the debugger...  We\r
-;;        could attempt to insulate ourselves against this possibility,\r
-;;        but that poses risks as well.\r
-;;\r
-  pop     gs\r
-  pop     fs\r
-  pop     es\r
-  pop     ds\r
-  pop     dword ptr [ebp + 4 * 4]\r
-  pop     ss\r
-\r
-;; UINT32  Edi, Esi, Ebp, Esp, Ebx, Edx, Ecx, Eax;\r
-  pop     edi\r
-  pop     esi\r
-  add     esp, 4   ; not for ebp\r
-  add     esp, 4   ; not for esp\r
-  pop     ebx\r
-  pop     edx\r
-  pop     ecx\r
-  pop     eax\r
-\r
-  mov     esp, ebp\r
-  pop     ebp\r
-  add     esp, 8\r
-  iretd\r
-\r
-\r
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r
-; data\r
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r
-\r
-        align 02h\r
-\r
-gdtr    dw GDT_END - GDT_BASE - 1   ; GDT limit\r
-        dd 0                        ; (GDT base gets set above)\r
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r
-;   global descriptor table (GDT)\r
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r
-\r
-        align 02h\r
-\r
-public GDT_BASE\r
-GDT_BASE:\r
-; null descriptor\r
-NULL_SEL            equ $-GDT_BASE\r
-        dw 0            ; limit 15:0\r
-        dw 0            ; base 15:0\r
-        db 0            ; base 23:16\r
-        db 0            ; type\r
-        db 0            ; limit 19:16, flags\r
-        db 0            ; base 31:24\r
-\r
-; linear data segment descriptor\r
-LINEAR_SEL      equ $-GDT_BASE\r
-        dw 0FFFFh       ; limit 0xFFFFF\r
-        dw 0            ; base 0\r
-        db 0\r
-        db 092h         ; present, ring 0, data, expand-up, writable\r
-        db 0CFh                 ; page-granular, 32-bit\r
-        db 0\r
-\r
-; linear code segment descriptor\r
-LINEAR_CODE_SEL equ $-GDT_BASE\r
-        dw 0FFFFh       ; limit 0xFFFFF\r
-        dw 0            ; base 0\r
-        db 0\r
-        db 09Ah         ; present, ring 0, data, expand-up, writable\r
-        db 0CFh                 ; page-granular, 32-bit\r
-        db 0\r
-\r
-; system data segment descriptor\r
-SYS_DATA_SEL    equ $-GDT_BASE\r
-        dw 0FFFFh       ; limit 0xFFFFF\r
-        dw 0            ; base 0\r
-        db 0\r
-        db 092h         ; present, ring 0, data, expand-up, writable\r
-        db 0CFh                 ; page-granular, 32-bit\r
-        db 0\r
-\r
-; system code segment descriptor\r
-SYS_CODE_SEL    equ $-GDT_BASE\r
-        dw 0FFFFh       ; limit 0xFFFFF\r
-        dw 0            ; base 0\r
-        db 0\r
-        db 09Ah         ; present, ring 0, data, expand-up, writable\r
-        db 0CFh                 ; page-granular, 32-bit\r
-        db 0\r
-\r
-; spare segment descriptor\r
-SPARE3_SEL  equ $-GDT_BASE\r
-        dw 0            ; limit 0xFFFFF\r
-        dw 0            ; base 0\r
-        db 0\r
-        db 0            ; present, ring 0, data, expand-up, writable\r
-        db 0            ; page-granular, 32-bit\r
-        db 0\r
-\r
-; spare segment descriptor\r
-SPARE4_SEL  equ $-GDT_BASE\r
-        dw 0            ; limit 0xFFFFF\r
-        dw 0            ; base 0\r
-        db 0\r
-        db 0            ; present, ring 0, data, expand-up, writable\r
-        db 0            ; page-granular, 32-bit\r
-        db 0\r
-\r
-; spare segment descriptor\r
-SPARE5_SEL  equ $-GDT_BASE\r
-        dw 0            ; limit 0xFFFFF\r
-        dw 0            ; base 0\r
-        db 0\r
-        db 0            ; present, ring 0, data, expand-up, writable\r
-        db 0            ; page-granular, 32-bit\r
-        db 0\r
-\r
-GDT_END:\r
-\r
-        align 02h\r
-\r
-\r
-\r
-idtr            dw IDT_END - IDT_BASE - 1   ; IDT limit\r
-        dd 0                        ; (IDT base gets set above)\r
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r
-;   interrupt descriptor table (IDT)\r
-;\r
-;   Note: The hardware IRQ's specified in this table are the normal PC/AT IRQ\r
-;       mappings.  This implementation only uses the system timer and all other\r
-;       IRQs will remain masked.  The descriptors for vectors 33+ are provided\r
-;       for convenience.\r
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r
-\r
-;idt_tag db "IDT",0     \r
-        align 02h\r
-\r
-public IDT_BASE\r
-IDT_BASE:\r
-; divide by zero (INT 0)\r
-DIV_ZERO_SEL        equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; debug exception (INT 1)\r
-DEBUG_EXCEPT_SEL    equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; NMI (INT 2)\r
-NMI_SEL             equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; soft breakpoint (INT 3)\r
-BREAKPOINT_SEL      equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; overflow (INT 4)\r
-OVERFLOW_SEL        equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; bounds check (INT 5)\r
-BOUNDS_CHECK_SEL    equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; invalid opcode (INT 6)\r
-INVALID_OPCODE_SEL  equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; device not available (INT 7)\r
-DEV_NOT_AVAIL_SEL   equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; double fault (INT 8)\r
-DOUBLE_FAULT_SEL    equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; Coprocessor segment overrun - reserved (INT 9)\r
-RSVD_INTR_SEL1      equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; invalid TSS (INT 0ah)\r
-INVALID_TSS_SEL     equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; segment not present (INT 0bh)\r
-SEG_NOT_PRESENT_SEL equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; stack fault (INT 0ch)\r
-STACK_FAULT_SEL     equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; general protection (INT 0dh)\r
-GP_FAULT_SEL        equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; page fault (INT 0eh)\r
-PAGE_FAULT_SEL      equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; Intel reserved - do not use (INT 0fh)\r
-RSVD_INTR_SEL2      equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; floating point error (INT 10h)\r
-FLT_POINT_ERR_SEL   equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; alignment check (INT 11h)\r
-ALIGNMENT_CHECK_SEL equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; (10001110)type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; machine check (INT 12h)\r
-MACHINE_CHECK_SEL   equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; (10001110)type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; SIMD floating-point exception (INT 13h)\r
-SIMD_EXCEPTION_SEL  equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; (10001110)type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-REPEAT  (32 - 20)\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; (10001110)type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-ENDM\r
-\r
-; 72 unspecified descriptors\r
-        db (72 * 8) dup(0)\r
-        \r
-; IRQ 0 (System timer) - (INT 68h)\r
-IRQ0_SEL            equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; (10001110)type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; IRQ 1 (8042 Keyboard controller) - (INT 69h)\r
-IRQ1_SEL            equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; (10001110)type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; Reserved - IRQ 2 redirect (IRQ 2) - DO NOT USE!!! - (INT 6ah)\r
-IRQ2_SEL            equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; (10001110)type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; IRQ 3 (COM 2) - (INT 6bh)\r
-IRQ3_SEL            equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; (10001110)type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; IRQ 4 (COM 1) - (INT 6ch)\r
-IRQ4_SEL            equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; (10001110)type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; IRQ 5 (LPT 2) - (INT 6dh)\r
-IRQ5_SEL            equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; (10001110)type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; IRQ 6 (Floppy controller) - (INT 6eh)\r
-IRQ6_SEL            equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; (10001110)type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; IRQ 7 (LPT 1) - (INT 6fh)\r
-IRQ7_SEL            equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; (10001110)type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; IRQ 8 (RTC Alarm) - (INT 70h)\r
-IRQ8_SEL            equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; (10001110)type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; IRQ 9 - (INT 71h)\r
-IRQ9_SEL            equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; (10001110)type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; IRQ 10 - (INT 72h)\r
-IRQ10_SEL            equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; (10001110)type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; IRQ 11 - (INT 73h)\r
-IRQ11_SEL            equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; (10001110)type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; IRQ 12 (PS/2 mouse) - (INT 74h)\r
-IRQ12_SEL            equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; (10001110)type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; IRQ 13 (Floating point error) - (INT 75h)\r
-IRQ13_SEL            equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; (10001110)type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; IRQ 14 (Secondary IDE) - (INT 76h)\r
-IRQ14_SEL            equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; (10001110)type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-; IRQ 15 (Primary IDE) - (INT 77h)\r
-IRQ15_SEL            equ $-IDT_BASE\r
-        dw 0            ; offset 15:0\r
-        dw SYS_CODE_SEL ; selector 15:0\r
-        db 0            ; 0 for interrupt gate\r
-        db 0eh OR 80h   ; (10001110)type = 386 interrupt gate, present\r
-        dw 0            ; offset 31:16\r
-\r
-        db (1 * 8) dup(0)\r
-\r
-IDT_END:\r
-\r
-END\r