home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / odtlktv4.zip / ODTLKT / TOOLKIT / INC / BSEXCPT.INC < prev    next >
Text File  |  1995-12-04  |  11KB  |  309 lines

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