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