home *** CD-ROM | disk | FTP | other *** search
/ Media Share 13 / mediashare_13.zip / mediashare_13 / ZIPPED / PROGRAM / DDJ9403A.ZIP / UC394.ZIP / 386.INC < prev    next >
Text File  |  1993-12-04  |  5KB  |  125 lines

  1. ;
  2. ;                80386/80486 exceptions
  3. ;
  4. DIVIDE_ERROR    EQU     0       ; fault
  5. DEBUGGER_INT    EQU     1       ; fault or trap
  6. NONMASKABLE_INT EQU     2       ; interrupt
  7. BREAKPOINT      EQU     3       ; trap
  8. OVERFLOW_INT    EQU     4       ; trap - interrupt on overflow ( INTO )
  9. BOUND_VIOLATION EQU     5       ; fault - array boundary violation ( BOUND )
  10. INVALID_OPCODE  EQU     6       ; fault
  11. MATH_NOT_AVL    EQU     7       ; fault - coprocessor not available
  12. DOUBLE_FAULT    EQU     8       ; abort
  13. MATHSEG_OVERRUN EQU     9       ; coprocessor segment overrun (reserved on 486)
  14. INVALID_TSS     EQU     10      ; fault
  15. SEG_NOT_PRESENT EQU     11      ; fault
  16. STACK_EXCEPTION EQU     12      ; fault
  17. GENERAL_PROTECT EQU     13      ; fault - General Protection Violation
  18. PAGE_FAULT      EQU     14      ; fault
  19. RESERVED_EXCEPT EQU     15
  20. MATH_ERROR      EQU     16      ; fault - coprocessor error
  21. ALIGNMENT_CHECK EQU     17      ; fault - ( 80486 only )
  22.  
  23. ;
  24. ;
  25. ;                   Task Segment State
  26. ;
  27. TSS_386         STRUC
  28.  TSS_BACK_LINK   DW      ?       ; Selector of the TSS previously executing
  29.                  DW      0
  30.  TSS_ESP0        DD      ?       ; ESP for RING 0 execution
  31.  TSS_SS0         DW      ?       ; SS for RING 0 execution
  32.                  DW      0
  33.  TSS_ESP1        DD      ?       ; ESP for RING 1 execution
  34.  TSS_SS1         DW      ?       ; SS for RING 1 execution
  35.                  DW      0
  36.  TSS_ESP2        DD      ?       ; ESP for RING 2 execution
  37.  TSS_SS2         DW      ?       ; SS for RING 2 execution
  38.                  DW      0
  39.  TSS_CR3         DD      ?       ; Task CR3 ( page directory address )
  40.  TSS_EIP         DD      ?       ; Task EIP
  41.  TSS_EFLAGS      DD      ?       ; Task EFLAGS register
  42.  TSS_EAX         DD      ?
  43.  TSS_ECX         DD      ?
  44.  TSS_EDX         DD      ?
  45.  TSS_EBX         DD      ?
  46.  TSS_ESP         DD      ?
  47.  TSS_EBP         DD      ?
  48.  TSS_ESI         DD      ?
  49.  TSS_EDI         DD      ?
  50.  TSS_ES          DW      ?
  51.                  DW      0
  52.  TSS_CS          DW      ?
  53.                  DW      0
  54.  TSS_SS          DW      ?
  55.                  DW      0
  56.  TSS_DS          DW      ?
  57.                  DW      0
  58.  TSS_FS          DW      ?
  59.                  DW      0
  60.  TSS_GS          DW      ?
  61.                  DW      0
  62.  TSS_LDTR        DW      ?       ; Selector for the task LDT
  63.                  DW      0
  64.  TSS_TRAP_WORD   DW      ?       ; contains T bit ( trap on task switch )
  65.  TSS_IOBP        DW      ?       ; a base of IO permission bitmap
  66. TSS_386         ENDS
  67.  
  68. ;
  69. ;               CR0 (control register 0) breakdown -- not in VMM.inc
  70. ;
  71. NE_Bit  EQU     00000000000000000000000000100000B       ; Numeric exception
  72. WP_Bit  EQU     00000000000000010000000000000000B       ; Write protect
  73. AM_Bit  EQU     00000000000001000000000000000000B       ; Alignment mask
  74. NW_Bit  EQU     00100000000000000000000000000000B       ; No write-through
  75. CD_Bit  EQU     01000000000000000000000000000000B       ; Cache disable
  76.  
  77. ;
  78. ;                  Segment Descriptors
  79. ;
  80. SEGDESCRIPTOR   STRUC
  81.  Seg_Desc_Limit_0_15   DW      ?               ; Limit bits 0 - 15
  82.  Seg_Desc_Base_0_23    DW      ?               ; Base BITS 0 - 15
  83.  Seg_Desc_Base_16_23   DB      ?               ; Base BITS 16 - 23
  84.  Seg_Desc_Access_Right DB      ?               ; Access right byte
  85.  Seg_Desc_Gran_Byte    DB      ?               ; Granularity, etc
  86.  Seg_Desc_Base_24_31   DB      ?               ; Base bits 24 - 31
  87. SEGDESCRIPTOR   ENDS
  88.  
  89. CALLGATEDESCRPT STRUC
  90.  Gate_Offset_O_15      DW      ?               ; offset, low 16
  91.  Gate_Selector         DW      ?               ; selector
  92.  Gate_DWord_Count      DB      ?               ; (D)Word parameter count
  93.  Gate_Access_Rights    DB      ?               ; present,dpl,system,type
  94.  Gate_Offset_16_31     DW      ?               ; offset, upper 16
  95. CALLGATEDESCRPT ENDS
  96.  
  97. ; call gate upper dword
  98. CGATE_OFFSET_16_31_MASK         equ     0FFFF0000h
  99. CGATE_ACCESS_RIGHTS_MASK        equ     0FF00h
  100. CGATE_DWORD_COUNT_MASK          equ     0FFh
  101. ; call gate lower dword
  102. CGATE_SELECTOR_MASK             equ     0FFFF0000h
  103. CGATE_OFFSET_0_15_MASK          equ     0FFFFh
  104.  
  105. DESC_TYPE_MASK  equ     00001111B       ; TYPE field for system and gate descriptors
  106.  
  107. DESC_TYPE_UNUSED        equ     0       ; invalid descriptor
  108. DESC_TYPE_286_TSS       equ     1       ; 80286 TSS descriptor
  109. DESC_TYPE_LDT           equ     2
  110. DESC_TYPE_BUSY_286_TSS  equ     3
  111. DESC_TYPE_286_CALL_GATE equ     4
  112. DESC_TYPE_TASK_GATE     equ     5
  113. DESC_TYPE_286_INT_GATE  equ     6
  114. DESC_TYPE_286_TRAP_GATE equ     7
  115. DESC_TYPE_386_TSS       equ     9       ; 80386/80486 TSS
  116. DESC_TYPE_BUSY_386_TSS  equ     11      ; 80386/80486 busy TSS
  117. DESC_TYPE_386_CALL_GATE equ     12      ; 80386/80486 call gate
  118. DESC_TYPE_386_INT_GATE  equ     14      ; 80386/80486 interrupt gate
  119. DESC_TYPE_386_TRAP_GATE equ     15      ; 80386/80486 trap gate
  120.  
  121. GATE32_RING3    equ     (D_PRES+D_DPL3+D_CTRL+DESC_TYPE_386_CALL_GATE) shl 8
  122. GATE16_RING3    equ     (D_PRES+D_DPL3+D_CTRL+DESC_TYPE_286_CALL_GATE) shl 8
  123.  
  124. CALLGATE_DDCOUNT_MASK   equ     1fh     ; dword count < 32
  125.