Changeset 710 for trunk/src/kernel32/exceptions.cpp
- Timestamp:
- Aug 27, 1999, 12:44:21 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/exceptions.cpp
r699 r710 1 /* $Id: exceptions.cpp,v 1.1 5 1999-08-25 17:05:57 sandervlExp $ */1 /* $Id: exceptions.cpp,v 1.16 1999-08-27 10:44:21 phaller Exp $ */ 2 2 3 3 /* … … 868 868 PVOID p) 869 869 { 870 /********************************* 871 * Internally handled exceptions * 872 *********************************/ 873 874 /* Access violation at a known location */ 875 if (pERepRec->ExceptionNum == XCPT_ACCESS_VIOLATION) 876 { 877 Win32MemMap *map; 878 BOOL fWriteAccess = FALSE; 879 880 if(pERepRec->ExceptionInfo[1] == 0 && 881 pERepRec->ExceptionInfo[1] == XCPT_DATA_UNKNOWN) 882 goto continueFail; 883 884 map = Win32MemMap::findMap(pERepRec->ExceptionInfo[1]); 885 if(map == NULL) 886 goto continueFail; 887 888 switch(pERepRec->ExceptionInfo[0]) 889 { 890 case XCPT_READ_ACCESS: 891 if(map->hasReadAccess() == FALSE) 892 goto continueFail; 893 break; 894 895 case XCPT_WRITE_ACCESS: 896 if(map->hasWriteAccess() == FALSE) 897 goto continueFail; 898 fWriteAccess = TRUE; 899 break; 900 901 case XCPT_EXECUTE_ACCESS: 902 if(map->hasExecuteAccess() == FALSE) 903 goto continueFail; 904 break; 905 906 default: 907 goto continueFail; 908 } 909 910 //Might want to consider mapping more than one page if access is at 911 //a high offset in the page 912 //@@@PH: mapping 16k or 32k might be significally faster in terms of transfer speed 913 if(map->commitPage((LPVOID)pERepRec->ExceptionInfo[1], 1, fWriteAccess) == TRUE) 914 return (XCPT_CONTINUE_EXECUTION); 915 916 //no break; 917 } 918 continueFail: 919 920 921 /************************ 922 * Pass-thru exceptions * 923 ************************/ 924 870 925 // pERegRec->prev_structure = 0; 871 926 dprintfException(pERepRec, pERegRec, pCtxRec, p); … … 874 929 switch(pERepRec->ExceptionNum) 875 930 { 876 case XCPT_FLOAT_DENORMAL_OPERAND:877 case XCPT_FLOAT_DIVIDE_BY_ZERO:878 case XCPT_FLOAT_INEXACT_RESULT:879 case XCPT_FLOAT_INVALID_OPERATION:880 case XCPT_FLOAT_OVERFLOW:881 case XCPT_FLOAT_STACK_CHECK:882 case XCPT_FLOAT_UNDERFLOW:883 931 case XCPT_FLOAT_DENORMAL_OPERAND: 932 case XCPT_FLOAT_DIVIDE_BY_ZERO: 933 case XCPT_FLOAT_INEXACT_RESULT: 934 case XCPT_FLOAT_INVALID_OPERATION: 935 case XCPT_FLOAT_OVERFLOW: 936 case XCPT_FLOAT_STACK_CHECK: 937 case XCPT_FLOAT_UNDERFLOW: 938 dprintf(("KERNEL32: OS2ExceptionHandler: FPU exception, fix and continue\n")); 884 939 pCtxRec->ctx_env[0] |= 0x1F; 885 940 pCtxRec->ctx_stack[0].losig = 0; 886 941 pCtxRec->ctx_stack[0].hisig = 0; 887 942 pCtxRec->ctx_stack[0].signexp = 0; 888 889 return (XCPT_CONTINUE_EXECUTION); 890 891 case XCPT_PROCESS_TERMINATE: 892 case XCPT_ASYNC_PROCESS_TERMINATE: 893 SetExceptionChain((ULONG)0); 894 return (XCPT_CONTINUE_SEARCH); 895 896 case XCPT_ACCESS_VIOLATION: 897 { 898 Win32MemMap *map; 899 BOOL fWriteAccess = FALSE; 900 901 if(pERepRec->ExceptionInfo[1] == 0 && pERepRec->ExceptionInfo[1] == XCPT_DATA_UNKNOWN) { 902 goto continueFail; 903 } 904 map = Win32MemMap::findMap(pERepRec->ExceptionInfo[1]); 905 if(map == NULL) { 906 goto continueFail; 907 } 908 switch(pERepRec->ExceptionInfo[0]) { 909 case XCPT_READ_ACCESS: 910 if(map->hasReadAccess() == FALSE) { 911 goto continueFail; 912 } 913 break; 914 case XCPT_WRITE_ACCESS: 915 if(map->hasWriteAccess() == FALSE) { 916 goto continueFail; 917 } 918 fWriteAccess = TRUE; 919 break; 920 case XCPT_EXECUTE_ACCESS: 921 if(map->hasExecuteAccess() == FALSE) { 922 goto continueFail; 923 } 924 break; 925 default: 926 goto continueFail; 927 } 928 //Might want to consider mapping more than one page if access is at 929 //a high offset in the page 930 if(map->commitPage((LPVOID)pERepRec->ExceptionInfo[1], 1, fWriteAccess) == TRUE) 931 return (XCPT_CONTINUE_EXECUTION); 932 933 //no break; 934 } 935 continueFail: 936 937 case XCPT_BREAKPOINT: 938 case XCPT_ARRAY_BOUNDS_EXCEEDED: 939 case XCPT_DATATYPE_MISALIGNMENT: 940 case XCPT_ILLEGAL_INSTRUCTION: 941 case XCPT_PRIVILEGED_INSTRUCTION: 942 case XCPT_INVALID_LOCK_SEQUENCE: 943 case XCPT_INTEGER_DIVIDE_BY_ZERO: 944 case XCPT_INTEGER_OVERFLOW: 945 case XCPT_SINGLE_STEP: 946 case XCPT_GUARD_PAGE_VIOLATION: 947 case XCPT_UNABLE_TO_GROW_STACK: 948 case XCPT_IN_PAGE_ERROR: 949 case XCPT_SIGNAL: 950 dprintf(("KERNEL32: OS2ExceptionHandler: Continue and kill\n")); 951 pCtxRec->ctx_RegEip = (ULONG)KillWin32Process; 952 pCtxRec->ctx_RegEsp = pCtxRec->ctx_RegEsp + 0x10; 953 pCtxRec->ctx_RegEax = pERepRec->ExceptionNum; 954 pCtxRec->ctx_RegEbx = pCtxRec->ctx_RegEip; 955 return (XCPT_CONTINUE_EXECUTION); 956 957 default: //non-continuable exceptions 943 return (XCPT_CONTINUE_EXECUTION); 944 945 case XCPT_PROCESS_TERMINATE: 946 case XCPT_ASYNC_PROCESS_TERMINATE: 947 SetExceptionChain((ULONG)0); 948 return (XCPT_CONTINUE_SEARCH); 949 950 case XCPT_ACCESS_VIOLATION: 951 case XCPT_BREAKPOINT: 952 case XCPT_ARRAY_BOUNDS_EXCEEDED: 953 case XCPT_DATATYPE_MISALIGNMENT: 954 case XCPT_ILLEGAL_INSTRUCTION: 955 case XCPT_PRIVILEGED_INSTRUCTION: 956 case XCPT_INVALID_LOCK_SEQUENCE: 957 case XCPT_INTEGER_DIVIDE_BY_ZERO: 958 case XCPT_INTEGER_OVERFLOW: 959 case XCPT_SINGLE_STEP: 960 case XCPT_GUARD_PAGE_VIOLATION: 961 case XCPT_UNABLE_TO_GROW_STACK: 962 case XCPT_IN_PAGE_ERROR: 963 case XCPT_SIGNAL: 964 dprintf(("KERNEL32: OS2ExceptionHandler: Continue and kill\n")); 965 pCtxRec->ctx_RegEip = (ULONG)KillWin32Process; 966 pCtxRec->ctx_RegEsp = pCtxRec->ctx_RegEsp + 0x10; 967 pCtxRec->ctx_RegEax = pERepRec->ExceptionNum; 968 pCtxRec->ctx_RegEbx = pCtxRec->ctx_RegEip; 969 return (XCPT_CONTINUE_EXECUTION); 970 971 default: //non-continuable exceptions 958 972 return (XCPT_CONTINUE_SEARCH); 959 973 } … … 1005 1019 USHORT sel = GetFS(); 1006 1020 1007 SetExceptionChain(val); 1021 SetExceptionChain(val); 1008 1022 SetFS(sel); 1009 1023 }
Note:
See TracChangeset
for help on using the changeset viewer.