home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v2.zip / DDKX86 / DBCSDD / INC_DBCS / BSEXCPT.INC < prev    next >
Text File  |  1995-04-14  |  12KB  |  317 lines

  1. ;*DDK*************************************************************************/
  2. ;
  3. ; COPYRIGHT (C) Microsoft Corporation, 1989
  4. ; COPYRIGHT    Copyright (C) 1995 IBM Corporation
  5. ;
  6. ;    The following IBM OS/2 WARP source code is provided to you solely for
  7. ;    the purpose of assisting you in your development of OS/2 WARP device
  8. ;    drivers. You may use this code in accordance with the IBM License
  9. ;    Agreement provided in the IBM Device Driver Source Kit for OS/2. This
  10. ;    Copyright statement may not be removed.;
  11. ;*****************************************************************************/
  12. ; static char *SCCSID = "@(#)bsexcpt.h  6.5 91/08/22";  
  13. ;       SCCSID = @(#)bsexcpt.h  6.5 91/08/22   
  14. ;*************************** START OF SPECIFICATION ************************ *                                                                         *
  15. ;* Source File Name: BSEXCPT.H                                             *
  16. ;*                                                                         *
  17. ;* Descriptive Name: Thread Exception Constants and Structure Definitions. *
  18. ;*                                                                         *
  19. ;*                                                                         *
  20. ;* Function: This file provides constants and data structure definitions   *
  21. ;*      required by application programs to use 32-bit thread exceptions   *
  22. ;*      management facility.                                               *
  23. ;*                                                                         *
  24. ;***************************  END OF SPECIFICATION ************************  
  25. ;* User Exception Handler Return Codes:
  26. ;  
  27. XCPT_CONTINUE_SEARCH    EQU    00000000H       ;  Exception not handled     
  28. XCPT_CONTINUE_EXECUTION    EQU    0FFFFFFFFH       ;  Exception handled         
  29. XCPT_CONTINUE_STOP    EQU    00716668H       ;  Exception handled by      
  30.                                                 ;  debugger (via DosDebug)   
  31. ;* fHandlerFlags values (see ExceptionReportRecord):
  32. ;*
  33. ;* The user may only set (but not clear) the EH_NONCONTINUABLE flag.
  34. ;* All other flags are set by the system.
  35. ;*
  36. ;  
  37. EH_NONCONTINUABLE    EQU    1H           ;  Noncontinuable exception           
  38. EH_UNWINDING    EQU    2H                ;  Unwind is in progress              
  39. EH_EXIT_UNWIND    EQU    4H              ;  Exit unwind is in progress         
  40. EH_STACK_INVALID    EQU    8H            ;  Stack out of limits or unaligned   
  41. EH_NESTED_CALL    EQU    10H             ;  Nested exception handler call      
  42. ;* Unwind all exception handlers (see DosUnwindException API)
  43. ;  
  44. UNWIND_ALL    EQU    0 
  45. ;*   Exception values are 32-bit values laid out as follows:
  46. ;*
  47. ;*   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  48. ;*   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  49. ;*   +---+-+-------------------------+-------------------------------+
  50. ;*   |Sev|C|       Facility          |               Code            |
  51. ;*   +---+-+-------------------------+-------------------------------+
  52. ;*
  53. ;*   where
  54. ;*
  55. ;*       Sev - is the severity code
  56. ;*           00 - Success
  57. ;*           01 - Informational
  58. ;*           10 - Warning
  59. ;*           11 - Error
  60. ;*
  61. ;*       C - is the Customer code flag
  62. ;*
  63. ;*       Facility - is the facility code
  64. ;*
  65. ;*       Code - is the facility's status code
  66. ;*
  67. ;*   Exceptions specific to OS/2 2.0 (e.g. XCPT_SIGNAL) will be marked
  68. ;*   with a facility code of 1.
  69. ;*
  70. ;*   System defined exceptions have a facility code of zero.
  71. ;*
  72. ;*   Each exception may also have several pieces of additional information.
  73. ;*   These are stored in the ExceptionInfo fields of the
  74. ;*   ExceptionReportRecord. They are documented here with the exceptions
  75. ;*   only for ease of reference.
  76. ;  
  77. XCPT_FATAL_EXCEPTION    EQU    0C0000000H 
  78. XCPT_SEVERITY_CODE    EQU    0C0000000H 
  79. XCPT_CUSTOMER_CODE    EQU    20000000H 
  80. XCPT_FACILITY_CODE    EQU    1FFF0000H 
  81. XCPT_EXCEPTION_CODE    EQU    0000FFFFH 
  82. ;* Violation flags in ExceptionInfo
  83. ;  
  84. XCPT_UNKNOWN_ACCESS    EQU    00000000H       ;  Unknown access            
  85. XCPT_READ_ACCESS    EQU    00000001H       ;  Read access               
  86. XCPT_WRITE_ACCESS    EQU    00000002H       ;  Write access              
  87. XCPT_EXECUTE_ACCESS    EQU    00000004H       ;  Execute access            
  88. XCPT_SPACE_ACCESS    EQU    00000008H       ;  Address space access      
  89. XCPT_LIMIT_ACCESS    EQU    00000010H       ;  Address space limit       
  90.                                                 ;  violation                 
  91. XCPT_DATA_UNKNOWN    EQU    0FFFFFFFFH 
  92. ;* Signal numbers for XCPT_SIGNAL
  93. ;  
  94. XCPT_SIGNAL_INTR    EQU    1 
  95. XCPT_SIGNAL_KILLPROC    EQU    3 
  96. XCPT_SIGNAL_BREAK    EQU    4 
  97. ;* Portable non-fatal software generated exceptions
  98. ;  
  99. XCPT_GUARD_PAGE_VIOLATION    EQU    80000001H 
  100.       ;  ExceptionInfo[ 0 ] - Access Code: XCPT_READ_ACCESS
  101. ;                                          XCPT_WRITE_ACCESS   
  102.       ;  ExceptionInfo[ 1 ] - FaultAddr   
  103. XCPT_UNABLE_TO_GROW_STACK    EQU    80010001H 
  104. ;* Portable fatal hardware generated exceptions
  105. ;  
  106. XCPT_DATATYPE_MISALIGNMENT    EQU    0C000009EH 
  107.       ;  ExceptionInfo[ 0 ] - Access Code: XCPT_READ_ACCESS
  108. ;                                          XCPT_WRITE_ACCESS   
  109.       ;  ExceptionInfo[ 1 ] - Alignment   
  110.       ;  ExceptionInfo[ 2 ] - FaultAddr   
  111. XCPT_BREAKPOINT    EQU    0C000009FH 
  112. XCPT_SINGLE_STEP    EQU    0C00000A0H 
  113. XCPT_ACCESS_VIOLATION    EQU    0C0000005H 
  114.       ;  ExceptionInfo[ 0 ] - Access Code: XCPT_READ_ACCESS
  115. ;                                          XCPT_WRITE_ACCESS
  116. ;                                          XCPT_SPACE_ACCESS
  117. ;                                          XCPT_LIMIT_ACCESS
  118. ;                                          XCPT_UNKNOWN_ACCESS   
  119.       ;  ExceptionInfo[ 1 ] - FaultAddr (XCPT_READ_ACCESS/XCPT_WRITE_ACCESS)
  120. ;                             Selector  (XCPT_SPACE_ACCESS)
  121. ;                             -1        (XCPT_LIMIT_ACCESS)   
  122. XCPT_ILLEGAL_INSTRUCTION    EQU    0C000001CH 
  123. XCPT_FLOAT_DENORMAL_OPERAND    EQU    0C0000094H 
  124. XCPT_FLOAT_DIVIDE_BY_ZERO    EQU    0C0000095H 
  125. XCPT_FLOAT_INEXACT_RESULT    EQU    0C0000096H 
  126. XCPT_FLOAT_INVALID_OPERATION    EQU    0C0000097H 
  127. XCPT_FLOAT_OVERFLOW    EQU    0C0000098H 
  128. XCPT_FLOAT_STACK_CHECK    EQU    0C0000099H 
  129. XCPT_FLOAT_UNDERFLOW    EQU    0C000009AH 
  130. XCPT_INTEGER_DIVIDE_BY_ZERO    EQU    0C000009BH 
  131. XCPT_INTEGER_OVERFLOW    EQU    0C000009CH 
  132. XCPT_PRIVILEGED_INSTRUCTION    EQU    0C000009DH 
  133. ;* Portable fatal software generated exceptions
  134. ;  
  135. XCPT_IN_PAGE_ERROR    EQU    0C0000006H 
  136.       ;  ExceptionInfo[ 0 ] - FaultAddr   
  137. XCPT_PROCESS_TERMINATE    EQU    0C0010001H 
  138. XCPT_ASYNC_PROCESS_TERMINATE    EQU    0C0010002H 
  139.       ;  ExceptionInfo[ 0 ] - TID of 'terminator' thread   
  140. XCPT_NONCONTINUABLE_EXCEPTION    EQU    0C0000024H 
  141. XCPT_INVALID_DISPOSITION    EQU    0C0000025H 
  142. ;* Non-portable fatal exceptions
  143. ;  
  144. XCPT_INVALID_LOCK_SEQUENCE    EQU    0C000001DH 
  145. XCPT_ARRAY_BOUNDS_EXCEEDED    EQU    0C0000093H 
  146. XCPT_B1NPX_ERRATA_02    EQU    0C0010004H 
  147. ;* Misc exceptions
  148. ;  
  149. XCPT_UNWIND    EQU    0C0000026H 
  150. XCPT_BAD_STACK    EQU    0C0000027H 
  151. XCPT_INVALID_UNWIND_TARGET    EQU    0C0000028H 
  152. ;* Signal Exceptions
  153. ;  
  154. XCPT_SIGNAL    EQU    0C0010003H 
  155.       ;  ExceptionInfo[ 0 ] - Signal Number   
  156. ;* ContextRecord
  157. ;*
  158. ;* This is the machine specific register contents for the thread
  159. ;* at the time of the exception. Note that only the register sets
  160. ;* specified by ContextFlags contain valid data. Conversely, only
  161. ;* registers specified in ContextFlags will be restored if an exception
  162. ;* is handled.
  163. ;  
  164. ;* The following flags control the contents of the ContextRecord.
  165. ;  
  166. CONTEXT_CONTROL    EQU    00000001H   ;  SS:ESP, CS:EIP, EFLAGS,      
  167.                                              ;  EBP                          
  168. CONTEXT_INTEGER    EQU    00000002H   ;  EAX, EBX, ECX, EDX, ESI,     
  169.                                              ;  EDI                          
  170. CONTEXT_SEGMENTS    EQU    00000004H   ;  DS, ES, FS, GS               
  171. CONTEXT_FLOATING_POINT    EQU    00000008H   ;  Numeric coprocessor state    
  172. CONTEXT_FULL    EQU    (CONTEXT_CONTROL  OR  CONTEXT_INTEGER  OR                        CONTEXT_SEGMENTS  OR  CONTEXT_FLOATING_POINT)
  173.  
  174. _fpreg    STRUC
  175. losig    DD    ?
  176. hisig    DD    ?
  177. signexp    DW    ?
  178. _fpreg    ENDS
  179.  
  180. FPREG struc
  181. db size _fpreg dup(?)
  182. FPREG ends
  183.  
  184.  
  185. _CONTEXT    STRUC
  186.   ; 
  187. ;  * The flags values within this flag control the contents of
  188. ;  * a ContextRecord.
  189. ;  *
  190. ;  * If the ContextRecord is used as an input parameter, then
  191. ;  * for each portion of the ContextRecord controlled by a flag
  192. ;  * whose value is set, it is assumed that that portion of the
  193. ;  * ContextRecord contains valid context. If the ContextRecord
  194. ;  * is being used to modify a thread's context, then only that
  195. ;  * portion of the thread's context will be modified.
  196. ;  *
  197. ;  * If the ContextRecord is used as an Input/Output parameter to
  198. ;  * capture the context of a thread, then only those portions of the
  199. ;  * thread's context corresponding to set flags will be returned.
  200. ;    
  201. ContextFlags    DD    ?
  202.   ; 
  203. ;  * This section is specified/returned if the ContextFlags
  204. ;  * contains the flag CONTEXT_FLOATING_POINT.
  205. ;    
  206. ctx_env    DD    7 DUP (?)
  207. ctx_stack    DB    SIZE _fpreg * 8 DUP (?)
  208.   ; 
  209. ;  * This section is specified/returned if the ContextFlags
  210. ;  * contains the flag CONTEXT_SEGMENTS.
  211. ;    
  212. ctx_SegGs    DD    ?
  213. ctx_SegFs    DD    ?
  214. ctx_SegEs    DD    ?
  215. ctx_SegDs    DD    ?
  216.   ; 
  217. ;  * This section is specified/returned if the ContextFlags
  218. ;  * contains the flag CONTEXT_INTEGER.
  219. ;    
  220. ctx_RegEdi    DD    ?
  221. ctx_RegEsi    DD    ?
  222. ctx_RegEax    DD    ?
  223. ctx_RegEbx    DD    ?
  224. ctx_RegEcx    DD    ?
  225. ctx_RegEdx    DD    ?
  226.   ; 
  227. ;  * This section is specified/returned if the ContextFlags
  228. ;  * contains the flag CONTEXT_CONTROL.
  229. ;    
  230. ctx_RegEbp    DD    ?
  231. ctx_RegEip    DD    ?
  232. ctx_SegCs    DD    ?
  233. ctx_EFlags    DD    ?
  234. ctx_RegEsp    DD    ?
  235. ctx_SegSs    DD    ?
  236. _CONTEXT    ENDS
  237.  
  238. CONTEXTRECORD struc
  239. db size _CONTEXT dup(?)
  240. CONTEXTRECORD ends
  241.  
  242. PCONTEXTRECORD struc
  243.     dd ?
  244. PCONTEXTRECORD ends
  245.  
  246. ;* ExceptionReportRecord
  247. ;*
  248. ;* This structure contains machine independant information about an
  249. ;* exception/unwind. No system exception will ever have more than
  250. ;* EXCEPTION_MAXIMUM_PARAMETERS parameters. User exceptions are not
  251. ;* bound to this limit.
  252. ;  
  253. EXCEPTION_MAXIMUM_PARAMETERS    EQU    4  ;  Enough for all system exceptions   
  254.  
  255. _EXCEPTIONREPORTRECORD    STRUC
  256. ExceptionNum    DD    ?                ;  Exception number                  
  257. fHandlerFlags    DD    ?               ;  Exception attributes              
  258. NestedExceptionReportRecord    DD    ?
  259.                                         ;  Preceding exception's report      
  260.                                         ;  record if nested exception        
  261. ExceptionAddress    DD    ?            ;  Exception address                 
  262. cParameters    DD    ?                 ;  Size of exception specific        
  263.                                         ;  information                       
  264. ExceptionInfo    DD    EXCEPTION_MAXIMUM_PARAMETERS DUP (?)
  265.                                         ;  Exception specfic information     
  266. _EXCEPTIONREPORTRECORD    ENDS
  267.  
  268. EXCEPTIONREPORTRECORD struc
  269. db size _EXCEPTIONREPORTRECORD dup(?)
  270. EXCEPTIONREPORTRECORD ends
  271.  
  272. PEXCEPTIONREPORTRECORD struc
  273.     dd ?
  274. PEXCEPTIONREPORTRECORD ends
  275.  
  276. ;* ExceptionRegistrationRecord
  277. ;*
  278. ;* These are linked together to form a chain of exception handlers that
  279. ;* will be dispatched to upon receipt of an exception.
  280. ;  
  281.  
  282. _EXCEPTIONREGISTRATIONRECORD    STRUC
  283. prev_structure      DD      ?
  284. ExceptionHandler    DD      ?
  285. _EXCEPTIONREGISTRATIONRECORD    ENDS
  286.  
  287. EXCEPTIONREGISTRATIONRECORD struc
  288.         db size _EXCEPTIONREGISTRATIONRECORD dup(?)
  289. EXCEPTIONREGISTRATIONRECORD ends
  290.  
  291. PEXCEPTIONREGISTRATIONRECORD struc
  292.         dd ?
  293. PEXCEPTIONREGISTRATIONRECORD ends
  294.  
  295.  
  296. ;* End of exception chain marker.
  297. ;  
  298. END_OF_CHAIN    EQU     -1
  299.  
  300.