Changeset 97861 in vbox for trunk/src/VBox/Runtime/common/compiler/vcc
- Timestamp:
- Dec 23, 2022 4:55:55 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/compiler/vcc/except-seh-vcc.cpp
r96559 r97861 48 48 #endif 49 49 50 51 /** 52 * Calls an exception filter w/o doing any control guard checks. 53 * 54 * Doing this within an inline function to prevent disabling CFG for any other 55 * calls that __C_specific_handler might be doing. 56 * 57 * Presumably, the presumption here is that since the target address here is 58 * taken from tables assumed to be readonly and generated by the compiler, there 59 * is no need to do any CFG checks. Besides, the target isn't a function that 60 * is safe to be called out of context and thus doesn't belong in the CFG tables 61 * in any way. 62 */ 63 __declspec(guard(ignore)) 64 DECLINLINE(LONG) CallFilterFunction(PEXCEPTION_FILTER pfnFilter, PEXCEPTION_POINTERS pXcptPtrs, 65 PEXCEPTION_REGISTRATION_RECORD pXcptRegRec) 66 { 67 return pfnFilter(pXcptPtrs, pXcptRegRec); 68 } 69 70 71 /** 72 * Calls an exception finally block w/o doing any control guard checks. 73 * 74 * See CallFilterFunction for details. 75 */ 76 __declspec(guard(ignore)) 77 DECLINLINE(void) CallFinallyFunction(PTERMINATION_HANDLER const pfnTermHandler, BOOLEAN fAbend, 78 PEXCEPTION_REGISTRATION_RECORD pXcptRegRec) 79 { 80 pfnTermHandler(fAbend, pXcptRegRec); 81 } 50 82 51 83 … … 112 144 PEXCEPTION_FILTER const pfnFilter = (PEXCEPTION_FILTER)(pDispCtx->ImageBase + uFltTermHandler); 113 145 EXCEPTION_POINTERS XcptPtrs = { pXcptRec, pCpuCtx }; 114 /** @todo shouldn't we do a guard check on this call? */ 115 lRet = pfnFilter(&XcptPtrs, pXcptRegRec); 146 lRet = CallFilterFunction(pfnFilter, &XcptPtrs, pXcptRegRec); 116 147 117 148 AssertCompile(EXCEPTION_CONTINUE_SEARCH == 0); … … 120 151 } 121 152 122 /* Return if we're supposed to continue execution (the conven sion153 /* Return if we're supposed to continue execution (the convention 123 154 it to match negative values rather than the exact defined value): */ 124 155 AssertCompile(EXCEPTION_CONTINUE_EXECUTION == -1); … … 152 183 ? pDispCtx->TargetIp - pDispCtx->ImageBase 153 184 : UINT32_MAX; 185 //RTAssertMsg2("__C_specific_handler: unwind: idxScope=%#x cScopes=%#x uTargetPc=%#x fXcpt=%#x\n", idxScope, cScopes, uTargetPc, pXcptRec->ExceptionFlags); 154 186 155 187 for (; idxScope < cScopes; idxScope++) … … 177 209 uint32_t const uTgtEnd = pScopeTab->ScopeRecord[idxTgtScope].EndAddress; 178 210 uint32_t const cbTgtScope = uTgtEnd - uTgtBegin; 179 if ( uTargetPc - uTgtBegin < uTgtBegin211 if ( uTargetPc - uTgtBegin < cbTgtScope 180 212 && uTgtBegin < uTgtEnd /* paranoia */) 213 { 214 //RTAssertMsg2("__C_specific_handler: ExceptionContinueSearch (#1)\n"); 181 215 return ExceptionContinueSearch; 216 } 182 217 } 183 218 } … … 188 223 PTERMINATION_HANDLER const pfnTermHandler = (PTERMINATION_HANDLER)(pDispCtx->ImageBase + uFltTermHandler); 189 224 pDispCtx->ScopeIndex = idxScope + 1; 190 / ** @todo shouldn't we do a guard check on this call? */191 pfnTermHandler(TRUE /*fAbend*/, pXcptRegRec);225 //RTAssertMsg2("__C_specific_handler: Calling __finally %p (idxScope=%#x)\n", pfnTermHandler, idxScope); 226 CallFinallyFunction(pfnTermHandler, TRUE /*fAbend*/, pXcptRegRec); 192 227 } 193 228 /* Exception filter & handler entries are skipped, unless the exception … … 196 231 else if ( uXcptHandler == uTargetPc 197 232 && (pXcptRec->ExceptionFlags & EXCEPTION_TARGET_UNWIND)) 233 { 234 //RTAssertMsg2("__C_specific_handler: ExceptionContinueSearch (#2)\n"); 198 235 return ExceptionContinueSearch; 236 } 199 237 } 200 238 }
Note:
See TracChangeset
for help on using the changeset viewer.