Annotation of os232sdk/toolkt20/c/os2h/bsexcpt.h, revision 1.1.1.1

1.1       root        1: /*     SCCSID = @(#)except32.h        13.5 90/03/27 */
                      2: 
                      3: /*************************** START OF SPECIFICATION *****************
                      4:  *
                      5:  * Source File Name: except32.h
                      6:  *
                      7:  * Descriptive Name: Thread Exception Constants and Structure Definitions.
                      8:  *
                      9:  * Copyright: IBM Corp. 1989
                     10:  * Copyright: Microsoft Corp. 1989
                     11:  *
                     12:  * Function: This file provides constants and data structure
                     13:  *     definitions required by application programs to use 32 bit
                     14:  *     thread exceptions management facility.
                     15:  *
                     16:  * Notes: None.
                     17:  *
                     18:  *************************** END OF SPECIFICATION *******************/
                     19: 
                     20: /*
                     21:  * User Exception Handler Return Codes:
                     22:  */
                     23: #define NOT_HANDLED            -1      /* exception not handled */
                     24: #define HANDLED                        0       /* exception handled (= NO_ERROR) */
                     25: 
                     26: /*
                     27:  * fHandlerFlags values (see ExceptionStructure):
                     28:  *
                     29:  * The exception manager sets EH_UNWINDING and EH_NESTED_CALL.
                     30:  * The user exception handler sets EH_NONCONTINUABLE.
                     31:  */
                     32: #define EH_UNWINDING       0x01 /* Set if call is being made for an unwind */
                     33:                                 /* operation. Otherwise call is being made */
                     34:                                 /* for an exception                        */
                     35: #define EH_NONCONTINUABLE   0x02 /* Set if exception is non-continuable            */
                     36: #define EH_NESTED_CALL     0x04 /* Set when an exception occurs while an   */
                     37:                                 /* exception is active for the current     */
                     38:                                 /* handler                                 */
                     39: 
                     40: /*
                     41:  * Unwind all exception handlers (see DosUnwindException API)
                     42:  */
                     43: #define UNWIND_ALL             0
                     44: 
                     45: /*
                     46:  * ExceptionNum values (see ExceptionStructure):
                     47:  *
                     48:  * This includes all exceptions and signals supported by 32 bit thread
                     49:  * exception management.
                     50:  *
                     51:  * The exception numbers are distrubuted as follows:
                     52:  *
                     53:  *     0x00000000-0x7fffffff - reserved for OS/2 use only
                     54:  *     0x80000000-0xffffffff - available for application specific use
                     55:  */
                     56: #define XCPT_INVALID           0       /* invalid exception number */
                     57:        /* Supported Exceptions and Signals */
                     58: #define XCPT_DIV               1       /* Divide Error */
                     59: #define XCPT_OVERFLOW          2       /* Overflow */
                     60: #define XCPT_BOUND             3       /* Bound Check */
                     61: #define XCPT_OP                        4       /* Invalid Opcode */
                     62: #define XCPT_GP                        5       /* General Protection Fault */
                     63: #define XCPT_FPERR             6       /* NPX Error */
                     64: #define XCPT_GPF               7       /* Gaurd Page Fault */
                     65: #define XCPT_GPAF              8       /* Guard Page Alloc Failure */
                     66: #define XCPT_PTERM             9       /* Process Termination (sync) */
                     67: #define XCPT_BREAK             10      /* Control Break */
                     68: #define XCPT_INTR              11      /* Control C */
                     69: #define XCPT_TERM              12      /* Kill Process */
                     70: #define XCPT_APTERM            13      /* Process Termination (async) */
                     71: 
                     72: 
                     73: /*
                     74:  * Bit mask to indicate which type of error code is in the rest of
                     75:  * the ExceptionInfo field when the ExceptionNum is set to XCPT_GP.
                     76:  * The high bit is clear for general protection (GP) faults and set
                     77:  * for page faults.  The EC_CR2 field is validate when this bit is set.
                     78:  */
                     79: #define XCPTF_PF    0x80000000     /* if set, page fault */
                     80:                                    /* if clear, GP fault */
                     81: 
                     82: 
                     83: /*
                     84:  * Exception Context.
                     85:  *
                     86:  * This is the machine specific register contents for the thread
                     87:  * at the time of the exception.
                     88:  */
                     89: struct ExceptionContext {      /* XCPTCTX */
                     90:        ULONG  EC_edi;          /* general purpose regs */
                     91:        ULONG  EC_esi;
                     92:        ULONG  EC_ebp;
                     93:        ULONG  EC_esp;
                     94:        ULONG  EC_ebx;
                     95:        ULONG  EC_edx;
                     96:        ULONG  EC_ecx;
                     97:        ULONG  EC_eax;
                     98:        ULONG  EC_eip;
                     99:        ULONG  EC_eflags;
                    100:        USHORT EC_cs;           /* segment registers */
                    101:        USHORT EC_ss;
                    102:        USHORT EC_ds;
                    103:        USHORT EC_es;
                    104:        USHORT EC_fs;
                    105:        USHORT EC_gs;
                    106:        ULONG  EC_cr0;          /* machine state word (r/o) */
                    107:        ULONG  EC_cr2;          /* for GP fault (r/o) */
                    108: };
                    109: 
                    110: typedef struct ExceptionContext            ECS;
                    111: typedef struct ExceptionContext *   PECS;
                    112: 
                    113: 
                    114: /*
                    115:  * Exception Structure.
                    116:  *
                    117:  * A pointer to this structure is passed to the user's thread
                    118:  * exception handler.  It contains the entire exception context.
                    119:  */
                    120: 
                    121: struct ExceptionStructure {        /* XCPTSTRUCT */
                    122: 
                    123:        ULONG   fHandlerFlags;      /* bit 0, clear for exception       */
                    124:                                    /*        set for unwind            */
                    125:                                    /* bit 1, set if not continuable    */
                    126:                                    /* bit 2, set if nested call        */
                    127: 
                    128:        struct  ExceptionHandler    *pCurrentEH;
                    129: 
                    130:        /* The following values are undefined for unwind operation      */
                    131: 
                    132:        ULONG   ExceptionNum;       /* exception number                 */
                    133: 
                    134:        struct  ExceptionContext    *pExceptionContext;
                    135: 
                    136:        ULONG   cbExceptionInfo;    /* Size of Exception Specific Info  */
                    137: 
                    138:        ULONG   ExceptionInfo[1];   /* Exception Specfic Info           */
                    139: };
                    140: 
                    141: typedef struct ExceptionStructure   XCPT;
                    142: typedef struct ExceptionStructure * PXCPT;
                    143: 
                    144: 
                    145: /*
                    146:  * Exception Handler Structure.
                    147:  *
                    148:  * This structure is used by APPs to register and unregister user
                    149:  * thread exception handlers.  The APP only needs to set the
                    150:  * exception_handler_routine field.  It should never modify the
                    151:  * prev_handler field (modified by the OS/2 kernel only). Upon
                    152:  * registration the structure remains in user space.  Therefore,
                    153:  * once a structure is registered, APPs should not modify any of the
                    154:  * fields until it is unregistered.
                    155:  *
                    156:  * NOTE: Field prev_handler MUST be first field in structure (see code
                    157:  * in DosSetExceptionHandler API).
                    158:  */
                    159: struct ExceptionHandler {      /* XCPTHAND */
                    160:                        /* prev_handler MUST BE FIRST */
                    161:        struct  ExceptionHandler    *prev_handler;
                    162: 
                    163:        ULONG   (*exception_handler_routine)(PXCPT);
                    164: };
                    165: 
                    166: typedef struct ExceptionHandler            EHS;
                    167: typedef struct ExceptionHandler *   PEHS;

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.