Changeset 21329 for trunk/src/kernel32/exceptions.cpp
- Timestamp:
- Jul 7, 2009, 7:40:22 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/exceptions.cpp
r21302 r21329 352 352 353 353 // walk the exception chain 354 while( (pFrame != NULL) && ( pFrame != ((void *)0xFFFFFFFF)) )354 while( (pFrame != NULL) && ((ULONG)((ULONG)pFrame & 0xFFFFF000) != 0xFFFFF000) ) 355 355 { 356 356 dprintf(("KERNEL32: RtlDispatchException - pframe=%08X, pframe->Prev=%08X", pFrame, pFrame->Prev)); … … 492 492 PrintWin32ExceptionChain(frame); 493 493 494 while (( frame != (PWINEXCEPTION_FRAME)0xffffffff) && (frame != pEndFrame))494 while (((ULONG)((ULONG)frame & 0xFFFFF000) != 0xFFFFF000) && (frame != pEndFrame)) 495 495 { 496 496 /* Check frame address */ … … 711 711 // any local buffers also can be made static to save 712 712 // stack space and possibly avoid out of stack exception. 713 if(pERepRec->ExceptionNum == XCPT_GUARD_PAGE_VIOLATION) 713 if(pERepRec->ExceptionNum == XCPT_GUARD_PAGE_VIOLATION) 714 714 { 715 715 strcpy(szTrapDump, "Guard Page Violation"); 716 716 return; 717 717 } 718 718 719 719 PSZ pszExceptionName = "<unknown>"; /* points to name/type excpt */ 720 720 APIRET rc = XCPT_CONTINUE_SEARCH; /* excpt-dep. code */ … … 963 963 static char szSYMInfo[260]; 964 964 static char Name[260]; 965 965 966 966 DosQueryModuleName(ulModule, sizeof(Name), Name); 967 967 … … 1294 1294 1295 1295 map = Win32MemMapNotify::findMapByView(pERepRec->ExceptionInfo[1], &offset, accessflag); 1296 if(!map) 1296 if(!map) 1297 1297 goto continueFail; 1298 1298 … … 1309 1309 } 1310 1310 continueFail: 1311 1312 /* 1313 * vladest: OK, try to implement write AUTOCOMMIT 1314 * last chance after MMAP commit is failed 1315 */ 1316 if (XCPT_ACCESS_VIOLATION == pERepRec->ExceptionNum && 1317 (/*pERepRec->ExceptionInfo[0] == XCPT_READ_ACCESS ||*/ 1318 pERepRec->ExceptionInfo[0] == XCPT_WRITE_ACCESS) && 1319 pERepRec->ExceptionInfo[1] != XCPT_DATA_UNKNOWN) 1320 { 1321 ULONG offset, accessflag; 1322 1323 DosQueryMem((PVOID) pERepRec->ExceptionInfo[1], 1324 &offset, &accessflag); 1325 dprintf(("KERNEL32: OS2ExceptionHandler: failed address info 0x%X size 0x%X. flag %X\n", 1326 pERepRec->ExceptionInfo[1], offset, accessflag)); 1327 /* check for valid address */ 1328 if (!pERepRec->ExceptionInfo[1] || 1329 pERepRec->ExceptionInfo[1] == 0xAAAAAAAA || 1330 !offset || offset == 0xAAAAAAAA) 1331 goto CrashAndBurn; 1332 /* memory committed, but no write access */ 1333 if (accessflag & PAG_GUARD) 1334 accessflag &=~PAG_GUARD; 1335 1336 DosSetMem((PVOID) pERepRec->ExceptionInfo[1], offset, 1337 accessflag | PAG_WRITE | PAG_COMMIT); 1338 dprintf(("KERNEL32: OS2ExceptionHandler: commiting 0x%X size 0x%X\n", 1339 pERepRec->ExceptionInfo[1], offset)); 1340 goto continueexecution; 1341 } 1342 1311 1343 1312 1344 ////#define DEBUGSTACK … … 1344 1376 USHORT *eip = (USHORT *)pCtxRec->ctx_RegEip; 1345 1377 1346 if(teb && eip && *eip == SETTHREADCONTEXT_INVALID_LOCKOPCODE) 1378 if(teb && eip && *eip == SETTHREADCONTEXT_INVALID_LOCKOPCODE) 1347 1379 { 1348 1380 //Is this a pending SetThreadContext exception? 1349 1381 //(see detailed description in the HMDeviceThreadClass::SetThreadContext method) 1350 if(teb->o.odin.context.ContextFlags) 1382 if(teb->o.odin.context.ContextFlags) 1351 1383 { 1352 1384 dprintfException(pERepRec, pERegRec, pCtxRec, p); … … 1488 1520 //Make sure we detect a stack overflow condition before the system does 1489 1521 if(!fIsOS2Image && 1490 pERepRec->ExceptionInfo[1] >= stackbottom && 1522 pERepRec->ExceptionInfo[1] >= stackbottom && 1491 1523 pERepRec->ExceptionInfo[1] < stacktop 1492 ) 1524 ) 1493 1525 {//this is a guard page exception for the thread stack 1494 1526 APIRET rc; 1495 1527 ULONG ulAddress, cbSize, ulMemFlags; 1496 1528 1497 1529 //round down to page boundary 1498 1530 ulAddress = pERepRec->ExceptionInfo[1] & ~0xFFF; … … 1506 1538 #endif 1507 1539 1508 if(ulAddress == stackbottom + PAGE_SIZE) 1540 if(ulAddress == stackbottom + PAGE_SIZE) 1509 1541 {//we don't have any stack left, throw an XCPT_UNABLE_TO_GROW_STACK 1510 1542 //exception … … 1550 1582 if(ret == TRUE) 1551 1583 goto continueexecution; 1552 } 1584 } 1553 1585 } 1554 1586 … … 1565 1597 //#ifdef DEBUG 1566 1598 // dprintfException(pERepRec, pERegRec, pCtxRec, p); 1567 //#endif 1599 //#endif 1568 1600 goto continuesearch; 1569 1601 } … … 1653 1685 PEXCEPTIONREGISTRATIONRECORD pExceptRec = (PEXCEPTIONREGISTRATIONRECORD)QueryExceptionChain(); 1654 1686 1655 while(pExceptRec != 0 && (ULONG)pExceptRec != -1) 1687 while(pExceptRec != 0 && (ULONG)pExceptRec != -1) 1656 1688 { 1657 if(pExceptRec->ExceptionHandler == OS2ExceptionHandler) 1689 if(pExceptRec->ExceptionHandler == OS2ExceptionHandler) 1658 1690 { 1659 1691 fFound = TRUE; … … 1662 1694 pExceptRec = pExceptRec->prev_structure; 1663 1695 } 1664 if(!fFound) 1696 if(!fFound) 1665 1697 { 1666 1698 OS2SetExceptionHandler(pExceptionRegRec); … … 1670 1702 //***************************************************************************** 1671 1703 // Remove exception handler if it was registered previously 1672 // 1704 // 1673 1705 //***************************************************************************** 1674 1706 void WIN32API ODIN_UnsetExceptionHandler(void *pExceptionRegRec) … … 1678 1710 BOOL fFound = FALSE; 1679 1711 1680 while(pExceptRec != 0 && (ULONG)pExceptRec != -1) 1712 while(pExceptRec != 0 && (ULONG)pExceptRec != -1) 1681 1713 { 1682 if(pExceptRec == pExceptionRegRec) 1714 if(pExceptRec == pExceptionRegRec) 1683 1715 { 1684 1716 fFound = TRUE; … … 1691 1723 pExceptRec = (PEXCEPTIONREGISTRATIONRECORD)QueryExceptionChain(); 1692 1724 1693 if(fFound && pExceptRec != (PEXCEPTIONREGISTRATIONRECORD)pExceptionRegRec) 1725 if(fFound && pExceptRec != (PEXCEPTIONREGISTRATIONRECORD)pExceptionRegRec) 1694 1726 { 1695 1727 dprintf(("ERROR: ODIN_UnsetExceptionHandler: INSIDE!!!: exc rec %p, head %p\n", pExceptionRegRec, pExceptRec));
Note:
See TracChangeset
for help on using the changeset viewer.